language
stringclasses 1
value | code
stringlengths 6
12.3k
| avg_line_length
float64 2.79
91
| line_count
float64 1
367
| lang_specific_parse
stringlengths 60
1.08M
| ast_node_count
int64 2
6.81k
| num_errors
int64 0
499
| universal_schema
stringlengths 799
825k
| __index_level_0__
int64 0
81.2k
|
|---|---|---|---|---|---|---|---|---|
c
|
/*
* GPIOOutput.h
*
* Created on: Jul. 23, 2021
* Author: bruno
*/
#ifndef COMMON_STM32_GPIO_GPIOOUTPUT_H_
#define COMMON_STM32_GPIO_GPIOOUTPUT_H_
#include <common/stm32/mcu/MCU.h>
typedef struct {
MCU* mcu;
GPIO_TypeDef* port;
uint16_t pin;
} GPIOOutput;
void gpio_output_init(GPIOOutput* gpio, MCU* mcu, GPIO_TypeDef* port,
uint16_t pin, uint32_t mode, uint32_t pull, GPIO_PinState state);
void gpio_set(GPIOOutput* gpio, GPIO_PinState state);
void gpio_set_low(GPIOOutput* gpio);
void gpio_set_high(GPIOOutput* gpio);
void gpio_toggle(GPIOOutput* gpio);
#endif /* COMMON_STM32_GPIO_GPIOOUTPUT_H_ */
| 29.14
| 21
|
(translation_unit) "/*\n * GPIOOutput.h\n *\n * Created on: Jul. 23, 2021\n * Author: bruno\n */\n\n#ifndef COMMON_STM32_GPIO_GPIOOUTPUT_H_\n#define COMMON_STM32_GPIO_GPIOOUTPUT_H_\n\n#include <common/stm32/mcu/MCU.h>\n\ntypedef struct {\n MCU* mcu;\n GPIO_TypeDef* port;\n uint16_t pin;\n} GPIOOutput;\n\nvoid gpio_output_init(GPIOOutput* gpio, MCU* mcu, GPIO_TypeDef* port,\n uint16_t pin, uint32_t mode, uint32_t pull, GPIO_PinState state);\n\nvoid gpio_set(GPIOOutput* gpio, GPIO_PinState state);\nvoid gpio_set_low(GPIOOutput* gpio);\nvoid gpio_set_high(GPIOOutput* gpio);\nvoid gpio_toggle(GPIOOutput* gpio);\n\n#endif /* COMMON_STM32_GPIO_GPIOOUTPUT_H_ */\n"
(comment) "/*\n * GPIOOutput.h\n *\n * Created on: Jul. 23, 2021\n * Author: bruno\n */"
(preproc_ifdef) "#ifndef COMMON_STM32_GPIO_GPIOOUTPUT_H_\n#define COMMON_STM32_GPIO_GPIOOUTPUT_H_\n\n#include <common/stm32/mcu/MCU.h>\n\ntypedef struct {\n MCU* mcu;\n GPIO_TypeDef* port;\n uint16_t pin;\n} GPIOOutput;\n\nvoid gpio_output_init(GPIOOutput* gpio, MCU* mcu, GPIO_TypeDef* port,\n uint16_t pin, uint32_t mode, uint32_t pull, GPIO_PinState state);\n\nvoid gpio_set(GPIOOutput* gpio, GPIO_PinState state);\nvoid gpio_set_low(GPIOOutput* gpio);\nvoid gpio_set_high(GPIOOutput* gpio);\nvoid gpio_toggle(GPIOOutput* gpio);\n\n#endif"
(#ifndef) "#ifndef"
(identifier) "COMMON_STM32_GPIO_GPIOOUTPUT_H_"
(preproc_def) "#define COMMON_STM32_GPIO_GPIOOUTPUT_H_\n"
(#define) "#define"
(identifier) "COMMON_STM32_GPIO_GPIOOUTPUT_H_"
(preproc_include) "#include <common/stm32/mcu/MCU.h>\n"
(#include) "#include"
(system_lib_string) "<common/stm32/mcu/MCU.h>"
(type_definition) "typedef struct {\n MCU* mcu;\n GPIO_TypeDef* port;\n uint16_t pin;\n} GPIOOutput;"
(typedef) "typedef"
(struct_specifier) "struct {\n MCU* mcu;\n GPIO_TypeDef* port;\n uint16_t pin;\n}"
(struct) "struct"
(field_declaration_list) "{\n MCU* mcu;\n GPIO_TypeDef* port;\n uint16_t pin;\n}"
({) "{"
(field_declaration) "MCU* mcu;"
(type_identifier) "MCU"
(pointer_declarator) "* mcu"
(*) "*"
(field_identifier) "mcu"
(;) ";"
(field_declaration) "GPIO_TypeDef* port;"
(type_identifier) "GPIO_TypeDef"
(pointer_declarator) "* port"
(*) "*"
(field_identifier) "port"
(;) ";"
(field_declaration) "uint16_t pin;"
(primitive_type) "uint16_t"
(field_identifier) "pin"
(;) ";"
(}) "}"
(type_identifier) "GPIOOutput"
(;) ";"
(declaration) "void gpio_output_init(GPIOOutput* gpio, MCU* mcu, GPIO_TypeDef* port,\n uint16_t pin, uint32_t mode, uint32_t pull, GPIO_PinState state);"
(primitive_type) "void"
(function_declarator) "gpio_output_init(GPIOOutput* gpio, MCU* mcu, GPIO_TypeDef* port,\n uint16_t pin, uint32_t mode, uint32_t pull, GPIO_PinState state)"
(identifier) "gpio_output_init"
(parameter_list) "(GPIOOutput* gpio, MCU* mcu, GPIO_TypeDef* port,\n uint16_t pin, uint32_t mode, uint32_t pull, GPIO_PinState state)"
(() "("
(parameter_declaration) "GPIOOutput* gpio"
(type_identifier) "GPIOOutput"
(pointer_declarator) "* gpio"
(*) "*"
(identifier) "gpio"
(,) ","
(parameter_declaration) "MCU* mcu"
(type_identifier) "MCU"
(pointer_declarator) "* mcu"
(*) "*"
(identifier) "mcu"
(,) ","
(parameter_declaration) "GPIO_TypeDef* port"
(type_identifier) "GPIO_TypeDef"
(pointer_declarator) "* port"
(*) "*"
(identifier) "port"
(,) ","
(parameter_declaration) "uint16_t pin"
(primitive_type) "uint16_t"
(identifier) "pin"
(,) ","
(parameter_declaration) "uint32_t mode"
(primitive_type) "uint32_t"
(identifier) "mode"
(,) ","
(parameter_declaration) "uint32_t pull"
(primitive_type) "uint32_t"
(identifier) "pull"
(,) ","
(parameter_declaration) "GPIO_PinState state"
(type_identifier) "GPIO_PinState"
(identifier) "state"
()) ")"
(;) ";"
(declaration) "void gpio_set(GPIOOutput* gpio, GPIO_PinState state);"
(primitive_type) "void"
(function_declarator) "gpio_set(GPIOOutput* gpio, GPIO_PinState state)"
(identifier) "gpio_set"
(parameter_list) "(GPIOOutput* gpio, GPIO_PinState state)"
(() "("
(parameter_declaration) "GPIOOutput* gpio"
(type_identifier) "GPIOOutput"
(pointer_declarator) "* gpio"
(*) "*"
(identifier) "gpio"
(,) ","
(parameter_declaration) "GPIO_PinState state"
(type_identifier) "GPIO_PinState"
(identifier) "state"
()) ")"
(;) ";"
(declaration) "void gpio_set_low(GPIOOutput* gpio);"
(primitive_type) "void"
(function_declarator) "gpio_set_low(GPIOOutput* gpio)"
(identifier) "gpio_set_low"
(parameter_list) "(GPIOOutput* gpio)"
(() "("
(parameter_declaration) "GPIOOutput* gpio"
(type_identifier) "GPIOOutput"
(pointer_declarator) "* gpio"
(*) "*"
(identifier) "gpio"
()) ")"
(;) ";"
(declaration) "void gpio_set_high(GPIOOutput* gpio);"
(primitive_type) "void"
(function_declarator) "gpio_set_high(GPIOOutput* gpio)"
(identifier) "gpio_set_high"
(parameter_list) "(GPIOOutput* gpio)"
(() "("
(parameter_declaration) "GPIOOutput* gpio"
(type_identifier) "GPIOOutput"
(pointer_declarator) "* gpio"
(*) "*"
(identifier) "gpio"
()) ")"
(;) ";"
(declaration) "void gpio_toggle(GPIOOutput* gpio);"
(primitive_type) "void"
(function_declarator) "gpio_toggle(GPIOOutput* gpio)"
(identifier) "gpio_toggle"
(parameter_list) "(GPIOOutput* gpio)"
(() "("
(parameter_declaration) "GPIOOutput* gpio"
(type_identifier) "GPIOOutput"
(pointer_declarator) "* gpio"
(*) "*"
(identifier) "gpio"
()) ")"
(;) ";"
(#endif) "#endif"
(comment) "/* COMMON_STM32_GPIO_GPIOOUTPUT_H_ */"
| 135
| 0
|
{"language": "c", "success": true, "metadata": {"lines": 21, "avg_line_length": 29.14, "nodes": 103, "errors": 0, "source_hash": "5eb6dde7f311c90d604d828bbad635baac39bcb269a539564f71d11dfdbe7ee0", "categorized_nodes": 68}, "ast": {"root": "translation_unit", "nodes": [{"id": 0, "type": "preproc_ifdef", "text": "#ifndef COMMON_STM32_GPIO_GPIOOUTPUT_H_\n#define COMMON_STM32_GPIO_GPIOOUTPUT_H_\n\n#include <common/stm32/mcu/MCU.h>\n\ntypedef struct {\n MCU* mcu;\n GPIO_TypeDef* port;\n uint16_t pin;\n} GPIOOutput;\n\nvoid gpio_output_init(GPIOOutput* gpio, MCU* mcu, GPIO_TypeDef* port,\n uint16_t pin, uint32_t mode, uint32_t pull, GPIO_PinState state);\n\nvoid gpio_set(GPIOOutput* gpio, GPIO_PinState state);\nvoid gpio_set_low(GPIOOutput* gpio);\nvoid gpio_set_high(GPIOOutput* gpio);\nvoid gpio_toggle(GPIOOutput* gpio);\n\n#endif", "parent": null, "children": [1, 2, 3, 6, 9, 27, 59, 72, 82, 92, 102], "start_point": {"row": 7, "column": 0}, "end_point": {"row": 26, "column": 6}}, {"id": 1, "type": "#ifndef", "text": "#ifndef", "parent": 0, "children": [], "start_point": {"row": 7, "column": 0}, "end_point": {"row": 7, "column": 7}}, {"id": 2, "type": "identifier", "text": "COMMON_STM32_GPIO_GPIOOUTPUT_H_", "parent": 0, "children": [], "start_point": {"row": 7, "column": 8}, "end_point": {"row": 7, "column": 39}}, {"id": 3, "type": "preproc_def", "text": "#define COMMON_STM32_GPIO_GPIOOUTPUT_H_\n", "parent": 0, "children": [4, 5], "start_point": {"row": 8, "column": 0}, "end_point": {"row": 9, "column": 0}}, {"id": 4, "type": "#define", "text": "#define", "parent": 3, "children": [], "start_point": {"row": 8, "column": 0}, "end_point": {"row": 8, "column": 7}}, {"id": 5, "type": "identifier", "text": "COMMON_STM32_GPIO_GPIOOUTPUT_H_", "parent": 3, "children": [], "start_point": {"row": 8, "column": 8}, "end_point": {"row": 8, "column": 39}}, {"id": 6, "type": "preproc_include", "text": "#include <common/stm32/mcu/MCU.h>\n", "parent": 0, "children": [7, 8], "start_point": {"row": 10, "column": 0}, "end_point": {"row": 11, "column": 0}}, {"id": 7, "type": "#include", "text": "#include", "parent": 6, "children": [], "start_point": {"row": 10, "column": 0}, "end_point": {"row": 10, "column": 8}}, {"id": 8, "type": "system_lib_string", "text": "<common/stm32/mcu/MCU.h>", "parent": 6, "children": [], "start_point": {"row": 10, "column": 9}, "end_point": {"row": 10, "column": 33}}, {"id": 9, "type": "type_definition", "text": "typedef struct {\n MCU* mcu;\n GPIO_TypeDef* port;\n uint16_t pin;\n} GPIOOutput;", "parent": 0, "children": [10, 11, 26], "start_point": {"row": 12, "column": 0}, "end_point": {"row": 16, "column": 13}}, {"id": 10, "type": "typedef", "text": "typedef", "parent": 9, "children": [], "start_point": {"row": 12, "column": 0}, "end_point": {"row": 12, "column": 7}}, {"id": 11, "type": "struct_specifier", "text": "struct {\n MCU* mcu;\n GPIO_TypeDef* port;\n uint16_t pin;\n}", "parent": 9, "children": [12], "start_point": {"row": 12, "column": 8}, "end_point": {"row": 16, "column": 1}}, {"id": 12, "type": "struct", "text": "struct", "parent": 11, "children": [], "start_point": {"row": 12, "column": 8}, "end_point": {"row": 12, "column": 14}}, {"id": 13, "type": "field_declaration", "text": "MCU* mcu;", "parent": 11, "children": [14, 15], "start_point": {"row": 13, "column": 4}, "end_point": {"row": 13, "column": 13}}, {"id": 14, "type": "type_identifier", "text": "MCU", "parent": 13, "children": [], "start_point": {"row": 13, "column": 4}, "end_point": {"row": 13, "column": 7}}, {"id": 15, "type": "pointer_declarator", "text": "* mcu", "parent": 13, "children": [16, 17], "start_point": {"row": 13, "column": 7}, "end_point": {"row": 13, "column": 12}}, {"id": 16, "type": "*", "text": "*", "parent": 15, "children": [], "start_point": {"row": 13, "column": 7}, "end_point": {"row": 13, "column": 8}}, {"id": 17, "type": "field_identifier", "text": "mcu", "parent": 15, "children": [], "start_point": {"row": 13, "column": 9}, "end_point": {"row": 13, "column": 12}}, {"id": 18, "type": "field_declaration", "text": "GPIO_TypeDef* port;", "parent": 11, "children": [19, 20], "start_point": {"row": 14, "column": 4}, "end_point": {"row": 14, "column": 23}}, {"id": 19, "type": "type_identifier", "text": "GPIO_TypeDef", "parent": 18, "children": [], "start_point": {"row": 14, "column": 4}, "end_point": {"row": 14, "column": 16}}, {"id": 20, "type": "pointer_declarator", "text": "* port", "parent": 18, "children": [21, 22], "start_point": {"row": 14, "column": 16}, "end_point": {"row": 14, "column": 22}}, {"id": 21, "type": "*", "text": "*", "parent": 20, "children": [], "start_point": {"row": 14, "column": 16}, "end_point": {"row": 14, "column": 17}}, {"id": 22, "type": "field_identifier", "text": "port", "parent": 20, "children": [], "start_point": {"row": 14, "column": 18}, "end_point": {"row": 14, "column": 22}}, {"id": 23, "type": "field_declaration", "text": "uint16_t pin;", "parent": 11, "children": [24, 25], "start_point": {"row": 15, "column": 4}, "end_point": {"row": 15, "column": 17}}, {"id": 24, "type": "primitive_type", "text": "uint16_t", "parent": 23, "children": [], "start_point": {"row": 15, "column": 4}, "end_point": {"row": 15, "column": 12}}, {"id": 25, "type": "field_identifier", "text": "pin", "parent": 23, "children": [], "start_point": {"row": 15, "column": 13}, "end_point": {"row": 15, "column": 16}}, {"id": 26, "type": "type_identifier", "text": "GPIOOutput", "parent": 9, "children": [], "start_point": {"row": 16, "column": 2}, "end_point": {"row": 16, "column": 12}}, {"id": 27, "type": "declaration", "text": "void gpio_output_init(GPIOOutput* gpio, MCU* mcu, GPIO_TypeDef* port,\n uint16_t pin, uint32_t mode, uint32_t pull, GPIO_PinState state);", "parent": 0, "children": [28, 29], "start_point": {"row": 18, "column": 0}, "end_point": {"row": 19, "column": 73}}, {"id": 28, "type": "primitive_type", "text": "void", "parent": 27, "children": [], "start_point": {"row": 18, "column": 0}, "end_point": {"row": 18, "column": 4}}, {"id": 29, "type": "function_declarator", "text": "gpio_output_init(GPIOOutput* gpio, MCU* mcu, GPIO_TypeDef* port,\n uint16_t pin, uint32_t mode, uint32_t pull, GPIO_PinState state)", "parent": 27, "children": [30, 31], "start_point": {"row": 18, "column": 5}, "end_point": {"row": 19, "column": 72}}, {"id": 30, "type": "identifier", "text": "gpio_output_init", "parent": 29, "children": [], "start_point": {"row": 18, "column": 5}, "end_point": {"row": 18, "column": 21}}, {"id": 31, "type": "parameter_list", "text": "(GPIOOutput* gpio, MCU* mcu, GPIO_TypeDef* port,\n uint16_t pin, uint32_t mode, uint32_t pull, GPIO_PinState state)", "parent": 29, "children": [32, 37, 42, 47, 50, 53, 56], "start_point": {"row": 18, "column": 21}, "end_point": {"row": 19, "column": 72}}, {"id": 32, "type": "parameter_declaration", "text": "GPIOOutput* gpio", "parent": 31, "children": [33, 34], "start_point": {"row": 18, "column": 22}, "end_point": {"row": 18, "column": 38}}, {"id": 33, "type": "type_identifier", "text": "GPIOOutput", "parent": 32, "children": [], "start_point": {"row": 18, "column": 22}, "end_point": {"row": 18, "column": 32}}, {"id": 34, "type": "pointer_declarator", "text": "* gpio", "parent": 32, "children": [35, 36], "start_point": {"row": 18, "column": 32}, "end_point": {"row": 18, "column": 38}}, {"id": 35, "type": "*", "text": "*", "parent": 34, "children": [], "start_point": {"row": 18, "column": 32}, "end_point": {"row": 18, "column": 33}}, {"id": 36, "type": "identifier", "text": "gpio", "parent": 34, "children": [], "start_point": {"row": 18, "column": 34}, "end_point": {"row": 18, "column": 38}}, {"id": 37, "type": "parameter_declaration", "text": "MCU* mcu", "parent": 31, "children": [38, 39], "start_point": {"row": 18, "column": 40}, "end_point": {"row": 18, "column": 48}}, {"id": 38, "type": "type_identifier", "text": "MCU", "parent": 37, "children": [], "start_point": {"row": 18, "column": 40}, "end_point": {"row": 18, "column": 43}}, {"id": 39, "type": "pointer_declarator", "text": "* mcu", "parent": 37, "children": [40, 41], "start_point": {"row": 18, "column": 43}, "end_point": {"row": 18, "column": 48}}, {"id": 40, "type": "*", "text": "*", "parent": 39, "children": [], "start_point": {"row": 18, "column": 43}, "end_point": {"row": 18, "column": 44}}, {"id": 41, "type": "identifier", "text": "mcu", "parent": 39, "children": [], "start_point": {"row": 18, "column": 45}, "end_point": {"row": 18, "column": 48}}, {"id": 42, "type": "parameter_declaration", "text": "GPIO_TypeDef* port", "parent": 31, "children": [43, 44], "start_point": {"row": 18, "column": 50}, "end_point": {"row": 18, "column": 68}}, {"id": 43, "type": "type_identifier", "text": "GPIO_TypeDef", "parent": 42, "children": [], "start_point": {"row": 18, "column": 50}, "end_point": {"row": 18, "column": 62}}, {"id": 44, "type": "pointer_declarator", "text": "* port", "parent": 42, "children": [45, 46], "start_point": {"row": 18, "column": 62}, "end_point": {"row": 18, "column": 68}}, {"id": 45, "type": "*", "text": "*", "parent": 44, "children": [], "start_point": {"row": 18, "column": 62}, "end_point": {"row": 18, "column": 63}}, {"id": 46, "type": "identifier", "text": "port", "parent": 44, "children": [], "start_point": {"row": 18, "column": 64}, "end_point": {"row": 18, "column": 68}}, {"id": 47, "type": "parameter_declaration", "text": "uint16_t pin", "parent": 31, "children": [48, 49], "start_point": {"row": 19, "column": 8}, "end_point": {"row": 19, "column": 20}}, {"id": 48, "type": "primitive_type", "text": "uint16_t", "parent": 47, "children": [], "start_point": {"row": 19, "column": 8}, "end_point": {"row": 19, "column": 16}}, {"id": 49, "type": "identifier", "text": "pin", "parent": 47, "children": [], "start_point": {"row": 19, "column": 17}, "end_point": {"row": 19, "column": 20}}, {"id": 50, "type": "parameter_declaration", "text": "uint32_t mode", "parent": 31, "children": [51, 52], "start_point": {"row": 19, "column": 22}, "end_point": {"row": 19, "column": 35}}, {"id": 51, "type": "primitive_type", "text": "uint32_t", "parent": 50, "children": [], "start_point": {"row": 19, "column": 22}, "end_point": {"row": 19, "column": 30}}, {"id": 52, "type": "identifier", "text": "mode", "parent": 50, "children": [], "start_point": {"row": 19, "column": 31}, "end_point": {"row": 19, "column": 35}}, {"id": 53, "type": "parameter_declaration", "text": "uint32_t pull", "parent": 31, "children": [54, 55], "start_point": {"row": 19, "column": 37}, "end_point": {"row": 19, "column": 50}}, {"id": 54, "type": "primitive_type", "text": "uint32_t", "parent": 53, "children": [], "start_point": {"row": 19, "column": 37}, "end_point": {"row": 19, "column": 45}}, {"id": 55, "type": "identifier", "text": "pull", "parent": 53, "children": [], "start_point": {"row": 19, "column": 46}, "end_point": {"row": 19, "column": 50}}, {"id": 56, "type": "parameter_declaration", "text": "GPIO_PinState state", "parent": 31, "children": [57, 58], "start_point": {"row": 19, "column": 52}, "end_point": {"row": 19, "column": 71}}, {"id": 57, "type": "type_identifier", "text": "GPIO_PinState", "parent": 56, "children": [], "start_point": {"row": 19, "column": 52}, "end_point": {"row": 19, "column": 65}}, {"id": 58, "type": "identifier", "text": "state", "parent": 56, "children": [], "start_point": {"row": 19, "column": 66}, "end_point": {"row": 19, "column": 71}}, {"id": 59, "type": "declaration", "text": "void gpio_set(GPIOOutput* gpio, GPIO_PinState state);", "parent": 0, "children": [60, 61], "start_point": {"row": 21, "column": 0}, "end_point": {"row": 21, "column": 53}}, {"id": 60, "type": "primitive_type", "text": "void", "parent": 59, "children": [], "start_point": {"row": 21, "column": 0}, "end_point": {"row": 21, "column": 4}}, {"id": 61, "type": "function_declarator", "text": "gpio_set(GPIOOutput* gpio, GPIO_PinState state)", "parent": 59, "children": [62, 63], "start_point": {"row": 21, "column": 5}, "end_point": {"row": 21, "column": 52}}, {"id": 62, "type": "identifier", "text": "gpio_set", "parent": 61, "children": [], "start_point": {"row": 21, "column": 5}, "end_point": {"row": 21, "column": 13}}, {"id": 63, "type": "parameter_list", "text": "(GPIOOutput* gpio, GPIO_PinState state)", "parent": 61, "children": [64, 69], "start_point": {"row": 21, "column": 13}, "end_point": {"row": 21, "column": 52}}, {"id": 64, "type": "parameter_declaration", "text": "GPIOOutput* gpio", "parent": 63, "children": [65, 66], "start_point": {"row": 21, "column": 14}, "end_point": {"row": 21, "column": 30}}, {"id": 65, "type": "type_identifier", "text": "GPIOOutput", "parent": 64, "children": [], "start_point": {"row": 21, "column": 14}, "end_point": {"row": 21, "column": 24}}, {"id": 66, "type": "pointer_declarator", "text": "* gpio", "parent": 64, "children": [67, 68], "start_point": {"row": 21, "column": 24}, "end_point": {"row": 21, "column": 30}}, {"id": 67, "type": "*", "text": "*", "parent": 66, "children": [], "start_point": {"row": 21, "column": 24}, "end_point": {"row": 21, "column": 25}}, {"id": 68, "type": "identifier", "text": "gpio", "parent": 66, "children": [], "start_point": {"row": 21, "column": 26}, "end_point": {"row": 21, "column": 30}}, {"id": 69, "type": "parameter_declaration", "text": "GPIO_PinState state", "parent": 63, "children": [70, 71], "start_point": {"row": 21, "column": 32}, "end_point": {"row": 21, "column": 51}}, {"id": 70, "type": "type_identifier", "text": "GPIO_PinState", "parent": 69, "children": [], "start_point": {"row": 21, "column": 32}, "end_point": {"row": 21, "column": 45}}, {"id": 71, "type": "identifier", "text": "state", "parent": 69, "children": [], "start_point": {"row": 21, "column": 46}, "end_point": {"row": 21, "column": 51}}, {"id": 72, "type": "declaration", "text": "void gpio_set_low(GPIOOutput* gpio);", "parent": 0, "children": [73, 74], "start_point": {"row": 22, "column": 0}, "end_point": {"row": 22, "column": 36}}, {"id": 73, "type": "primitive_type", "text": "void", "parent": 72, "children": [], "start_point": {"row": 22, "column": 0}, "end_point": {"row": 22, "column": 4}}, {"id": 74, "type": "function_declarator", "text": "gpio_set_low(GPIOOutput* gpio)", "parent": 72, "children": [75, 76], "start_point": {"row": 22, "column": 5}, "end_point": {"row": 22, "column": 35}}, {"id": 75, "type": "identifier", "text": "gpio_set_low", "parent": 74, "children": [], "start_point": {"row": 22, "column": 5}, "end_point": {"row": 22, "column": 17}}, {"id": 76, "type": "parameter_list", "text": "(GPIOOutput* gpio)", "parent": 74, "children": [77], "start_point": {"row": 22, "column": 17}, "end_point": {"row": 22, "column": 35}}, {"id": 77, "type": "parameter_declaration", "text": "GPIOOutput* gpio", "parent": 76, "children": [78, 79], "start_point": {"row": 22, "column": 18}, "end_point": {"row": 22, "column": 34}}, {"id": 78, "type": "type_identifier", "text": "GPIOOutput", "parent": 77, "children": [], "start_point": {"row": 22, "column": 18}, "end_point": {"row": 22, "column": 28}}, {"id": 79, "type": "pointer_declarator", "text": "* gpio", "parent": 77, "children": [80, 81], "start_point": {"row": 22, "column": 28}, "end_point": {"row": 22, "column": 34}}, {"id": 80, "type": "*", "text": "*", "parent": 79, "children": [], "start_point": {"row": 22, "column": 28}, "end_point": {"row": 22, "column": 29}}, {"id": 81, "type": "identifier", "text": "gpio", "parent": 79, "children": [], "start_point": {"row": 22, "column": 30}, "end_point": {"row": 22, "column": 34}}, {"id": 82, "type": "declaration", "text": "void gpio_set_high(GPIOOutput* gpio);", "parent": 0, "children": [83, 84], "start_point": {"row": 23, "column": 0}, "end_point": {"row": 23, "column": 37}}, {"id": 83, "type": "primitive_type", "text": "void", "parent": 82, "children": [], "start_point": {"row": 23, "column": 0}, "end_point": {"row": 23, "column": 4}}, {"id": 84, "type": "function_declarator", "text": "gpio_set_high(GPIOOutput* gpio)", "parent": 82, "children": [85, 86], "start_point": {"row": 23, "column": 5}, "end_point": {"row": 23, "column": 36}}, {"id": 85, "type": "identifier", "text": "gpio_set_high", "parent": 84, "children": [], "start_point": {"row": 23, "column": 5}, "end_point": {"row": 23, "column": 18}}, {"id": 86, "type": "parameter_list", "text": "(GPIOOutput* gpio)", "parent": 84, "children": [87], "start_point": {"row": 23, "column": 18}, "end_point": {"row": 23, "column": 36}}, {"id": 87, "type": "parameter_declaration", "text": "GPIOOutput* gpio", "parent": 86, "children": [88, 89], "start_point": {"row": 23, "column": 19}, "end_point": {"row": 23, "column": 35}}, {"id": 88, "type": "type_identifier", "text": "GPIOOutput", "parent": 87, "children": [], "start_point": {"row": 23, "column": 19}, "end_point": {"row": 23, "column": 29}}, {"id": 89, "type": "pointer_declarator", "text": "* gpio", "parent": 87, "children": [90, 91], "start_point": {"row": 23, "column": 29}, "end_point": {"row": 23, "column": 35}}, {"id": 90, "type": "*", "text": "*", "parent": 89, "children": [], "start_point": {"row": 23, "column": 29}, "end_point": {"row": 23, "column": 30}}, {"id": 91, "type": "identifier", "text": "gpio", "parent": 89, "children": [], "start_point": {"row": 23, "column": 31}, "end_point": {"row": 23, "column": 35}}, {"id": 92, "type": "declaration", "text": "void gpio_toggle(GPIOOutput* gpio);", "parent": 0, "children": [93, 94], "start_point": {"row": 24, "column": 0}, "end_point": {"row": 24, "column": 35}}, {"id": 93, "type": "primitive_type", "text": "void", "parent": 92, "children": [], "start_point": {"row": 24, "column": 0}, "end_point": {"row": 24, "column": 4}}, {"id": 94, "type": "function_declarator", "text": "gpio_toggle(GPIOOutput* gpio)", "parent": 92, "children": [95, 96], "start_point": {"row": 24, "column": 5}, "end_point": {"row": 24, "column": 34}}, {"id": 95, "type": "identifier", "text": "gpio_toggle", "parent": 94, "children": [], "start_point": {"row": 24, "column": 5}, "end_point": {"row": 24, "column": 16}}, {"id": 96, "type": "parameter_list", "text": "(GPIOOutput* gpio)", "parent": 94, "children": [97], "start_point": {"row": 24, "column": 16}, "end_point": {"row": 24, "column": 34}}, {"id": 97, "type": "parameter_declaration", "text": "GPIOOutput* gpio", "parent": 96, "children": [98, 99], "start_point": {"row": 24, "column": 17}, "end_point": {"row": 24, "column": 33}}, {"id": 98, "type": "type_identifier", "text": "GPIOOutput", "parent": 97, "children": [], "start_point": {"row": 24, "column": 17}, "end_point": {"row": 24, "column": 27}}, {"id": 99, "type": "pointer_declarator", "text": "* gpio", "parent": 97, "children": [100, 101], "start_point": {"row": 24, "column": 27}, "end_point": {"row": 24, "column": 33}}, {"id": 100, "type": "*", "text": "*", "parent": 99, "children": [], "start_point": {"row": 24, "column": 27}, "end_point": {"row": 24, "column": 28}}, {"id": 101, "type": "identifier", "text": "gpio", "parent": 99, "children": [], "start_point": {"row": 24, "column": 29}, "end_point": {"row": 24, "column": 33}}, {"id": 102, "type": "#endif", "text": "#endif", "parent": 0, "children": [], "start_point": {"row": 26, "column": 0}, "end_point": {"row": 26, "column": 6}}]}, "node_categories": {"declarations": {"functions": [29, 61, 74, 84, 94], "variables": [9, 13, 18, 23, 27, 32, 37, 42, 47, 50, 53, 56, 59, 64, 69, 72, 77, 82, 87, 92, 97], "classes": [11, 12], "imports": [6, 7], "modules": [], "enums": []}, "statements": {"expressions": [], "assignments": [], "loops": [], "conditionals": [0, 1, 2, 5, 14, 17, 19, 22, 25, 26, 30, 33, 36, 38, 41, 43, 46, 49, 52, 55, 57, 58, 62, 65, 68, 70, 71, 75, 78, 81, 85, 88, 91, 95, 98, 101, 102], "returns": [], "exceptions": []}, "expressions": {"calls": [], "literals": [8], "identifiers": [], "binary_operations": [], "unary_operations": [], "member_access": []}}, "cross_language_map": {"function_declarations": [{"node_id": 29, "universal_type": "function", "name": "unknown", "text_snippet": "gpio_output_init(GPIOOutput* gpio, MCU* mcu, GPIO_TypeDef* port,\n uint16_t pin, uint32_t mode"}, {"node_id": 61, "universal_type": "function", "name": "unknown", "text_snippet": "gpio_set(GPIOOutput* gpio, GPIO_PinState state)"}, {"node_id": 74, "universal_type": "function", "name": "unknown", "text_snippet": "gpio_set_low(GPIOOutput* gpio)"}, {"node_id": 84, "universal_type": "function", "name": "unknown", "text_snippet": "gpio_set_high(GPIOOutput* gpio)"}, {"node_id": 94, "universal_type": "function", "name": "unknown", "text_snippet": "gpio_toggle(GPIOOutput* gpio)"}], "class_declarations": [{"node_id": 11, "universal_type": "class", "name": "{", "text_snippet": "struct {\n MCU* mcu;\n GPIO_TypeDef* port;\n uint16_t pin;\n}"}, {"node_id": 12, "universal_type": "class", "name": "unknown", "text_snippet": "struct"}], "import_statements": [{"node_id": 6, "text": "#include <common/stm32/mcu/MCU.h>\n"}, {"node_id": 7, "text": "#include"}]}, "original_source_code": "/*\n * GPIOOutput.h\n *\n * Created on: Jul. 23, 2021\n * Author: bruno\n */\n\n#ifndef COMMON_STM32_GPIO_GPIOOUTPUT_H_\n#define COMMON_STM32_GPIO_GPIOOUTPUT_H_\n\n#include <common/stm32/mcu/MCU.h>\n\ntypedef struct {\n MCU* mcu;\n GPIO_TypeDef* port;\n uint16_t pin;\n} GPIOOutput;\n\nvoid gpio_output_init(GPIOOutput* gpio, MCU* mcu, GPIO_TypeDef* port,\n uint16_t pin, uint32_t mode, uint32_t pull, GPIO_PinState state);\n\nvoid gpio_set(GPIOOutput* gpio, GPIO_PinState state);\nvoid gpio_set_low(GPIOOutput* gpio);\nvoid gpio_set_high(GPIOOutput* gpio);\nvoid gpio_toggle(GPIOOutput* gpio);\n\n#endif /* COMMON_STM32_GPIO_GPIOOUTPUT_H_ */\n"}
| 0
|
c
| "/*!\n * @brief ASN(x) STEMMA SOIL sensor library -- source file\n *\n * Library to support the ST(...TRUNCATED)
| 33.64
| 152
| "(translation_unit) \"/*!\\n * @brief ASN(x) STEMMA SOIL sensor library -- source file\\n *\\n * L(...TRUNCATED)
| 783
| 0
| "{\"language\": \"c\", \"success\": true, \"metadata\": {\"lines\": 152, \"avg_line_length\": 33.64,(...TRUNCATED)
| 1
|
c
| "// Copyright (c) 2006-2013 INRIA Nancy-Grand Est (France). All rights reserved.\n//\n// This file i(...TRUNCATED)
| 35.77
| 62
| "(translation_unit) \"// Copyright (c) 2006-2013 INRIA Nancy-Grand Est (France). All rights reserved(...TRUNCATED)
| 289
| 19
| "{\"language\": \"c\", \"success\": true, \"metadata\": {\"lines\": 62, \"avg_line_length\": 35.77, (...TRUNCATED)
| 2
|
c
| "//\n// Generated by class-dump 3.5 (64 bit).\n//\n// class-dump is Copyright (C) 1997-1998,(...TRUNCATED)
| 31.14
| 14
| "(translation_unit) \"//\\n// Generated by class-dump 3.5 (64 bit).\\n//\\n// class-dump is (...TRUNCATED)
| 95
| 9
| "{\"language\": \"c\", \"success\": true, \"metadata\": {\"lines\": 14, \"avg_line_length\": 31.14, (...TRUNCATED)
| 3
|
c
| "#include <string.h>\n#include <stdlib.h>\n#include \"vm_loader.h\"\n#include \"vm.h\"\n#include \"v(...TRUNCATED)
| 30.98
| 181
| "(translation_unit) \"#include <string.h>\\n#include <stdlib.h>\\n#include \"vm_loader.h\"\\n#includ(...TRUNCATED)
| 1,737
| 0
| "{\"language\": \"c\", \"success\": true, \"metadata\": {\"lines\": 181, \"avg_line_length\": 30.98,(...TRUNCATED)
| 4
|
c
| "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <time.h>\n#include \"stringL(...TRUNCATED)
| 35.02
| 103
| "(translation_unit) \"#include <stdio.h>\\n#include <stdlib.h>\\n#include <string.h>\\n#include <tim(...TRUNCATED)
| 589
| 0
| "{\"language\": \"c\", \"success\": true, \"metadata\": {\"lines\": 103, \"avg_line_length\": 35.02,(...TRUNCATED)
| 5
|
c
| "#include \"geminc.h\"\n#include \"naltxt.h\"\n\n\nWidget CreateLabelWidget ( Widget parent, char na(...TRUNCATED)
| 24.98
| 40
| "(translation_unit) \"#include \"geminc.h\"\\n#include \"naltxt.h\"\\n\\n\\nWidget CreateLabelWidget(...TRUNCATED)
| 128
| 0
| "{\"language\": \"c\", \"success\": true, \"metadata\": {\"lines\": 40, \"avg_line_length\": 24.98, (...TRUNCATED)
| 6
|
c
| "// Generated by Haxe 4.0.0-rc.2+77068e10c\n#ifndef INCLUDED_openfl_utils__Endian_Endian_Impl_\n#def(...TRUNCATED)
| 38.47
| 60
| "(translation_unit) \"// Generated by Haxe 4.0.0-rc.2+77068e10c\\n#ifndef INCLUDED_openfl_utils__End(...TRUNCATED)
| 691
| 38
| "{\"language\": \"c\", \"success\": true, \"metadata\": {\"lines\": 60, \"avg_line_length\": 38.47, (...TRUNCATED)
| 7
|
c
| "// can put any payload here.\n#include <stdio.h>\n\n// the C code for thompson's replicating progra(...TRUNCATED)
| 25.31
| 13
| "(translation_unit) \"// can put any payload here.\\n#include <stdio.h>\\n\\n// the C code for thomp(...TRUNCATED)
| 123
| 0
| "{\"language\": \"c\", \"success\": true, \"metadata\": {\"lines\": 13, \"avg_line_length\": 25.31, (...TRUNCATED)
| 8
|
c
| "//\n// RHReceivePacketCache.h\n// Pipeline\n//\n// Created by zhuruhong on 2019/9/28.\n// Copyr(...TRUNCATED)
| 23.62
| 13
| "(translation_unit) \"//\\n// RHReceivePacketCache.h\\n// Pipeline\\n//\\n// Created by zhuruhong(...TRUNCATED)
| 24
| 3
| "{\"language\": \"c\", \"success\": true, \"metadata\": {\"lines\": 13, \"avg_line_length\": 23.62, (...TRUNCATED)
| 9
|
MultiLang Code Parser Dataset (MLCPD)
MultiLang-Code-Parser-Dataset (MLCPD) provides a large-scale, unified dataset of parsed source code across 10 major programming languages, represented under a universal schema that captures syntax, semantics, and structure in a consistent format.
Each entry corresponds to one parsed source file and includes:
- Language metadata
- Code-level statistics (lines, errors, AST nodes)
- Universal Schema JSON (normalized structural representation)
MLCPD enables robust cross-language analysis, code understanding, and representation learning by providing a consistent, language-agnostic data structure suitable for both traditional ML and modern LLM-based workflows.
π Dataset Structure
MultiLang-Code-Parser-Dataset/
βββ c_parsed_1.parquet
βββ c_parsed_2.parquet
βββ c_parsed_3.parquet
βββ c_parsed_4.parquet
βββ c_sharp_parsed_1.parquet
βββ ...
βββ typescript_parsed_4.parquet
Each file corresponds to one partition of a language (~175k rows each).
Each record contains:
| Field | Type | Description |
|---|---|---|
language |
str |
Programming language name |
code |
str |
Raw source code |
avg_line_length |
float |
Average line length |
line_count |
int |
Number of lines |
lang_specific_parse |
str |
TreeSitter parse output |
ast_node_count |
int |
Number of AST nodes |
num_errors |
int |
Parse errors |
universal_schema |
str |
JSON-formatted unified schema |
π Key Statistics
| Metric | Value |
|---|---|
| Total Languages | 10 |
| Total Files | 40 |
| Total Records | 7,021,722 |
| Successful Conversions | 7,021,718 (99.9999%) |
| Failed Conversions | 4 (3 in C, 1 in C++) |
| Disk Size | ~114 GB (Parquet format) |
| Memory Size | ~600 GB (Parquet format) |
The dataset is clean, lossless, and statistically balanced across languages.
It offers both per-language and combined cross-language representations.
π Use Cases
MLCPD can be directly used for:
- Cross-language code representation learning
- Program understanding and code similarity tasks
- Syntax-aware pretraining for LLMs
- Code summarization, clone detection, and bug prediction
- Graph-based learning on universal ASTs
- Benchmark creation for cross-language code reasoning
π Features
- Universal Schema: A unified structural representation harmonizing AST node types across languages.
- Compact Format: Stored in Apache Parquet, allowing fast access and efficient querying.
- Cross-Language Compatibility: Enables comparative code structure analysis across multiple programming ecosystems.
- Error-Free Parsing: 99.9999% successful schema conversions across ~7M code files.
- Statistical Richness: Includes per-language metrics such as mean line count, AST size, and error ratios.
- Ready for ML Pipelines: Compatible with PyTorch, TensorFlow, Hugging Face Transformers, and graph-based models.
π₯ How to Access the Dataset
Using the Hugging Face datasets Library
This dataset is hosted on the Hugging Face Hub and can be easily accessed using the datasets library.
Install the Required Library
pip install datasets
Import Library
from datasets import load_dataset
Load the Entire Dataset
dataset = load_dataset(
"jugalgajjar/MultiLang-Code-Parser-Dataset"
)
Load a Specific Language File
dataset = load_dataset(
"jugalgajjar/MultiLang-Code-Parser-Dataset",
data_files="python_parsed_1.parquet"
)
Stream Data
dataset = load_dataset(
"jugalgajjar/MultiLang-Code-Parser-Dataset",
data_files="python_parsed_1.parquet",
streaming=True
)
Access Data Content (After Downloading)
try:
for example in dataset["train"].take(5):
print(example)
print("-"*25)
except Exception as e:
print(f"An error occurred: {e}")
Manual Download
You can also manually download specific language files from the Hugging Face repository page:
- Visit https://huggingface.co/datasets/jugalgajjar/MultiLang-Code-Parser-Dataset
- Navigate to the Files tab
- Click on the language file you want (e.g.,
python_parsed_1.parquet) - Use the Download button to save locally
π§Ύ Citation
If you use this dataset in your research or work, please cite the following paper:
Gajjar, J., & Subramaniakuppusamy, K. (2025).
MLCPD: A Unified Multi-Language Code Parsing Dataset with Universal AST Schema.
arXiv preprint arXiv:2510.16357
@article{gajjar2025mlcpd,
title={MLCPD: A Unified Multi-Language Code Parsing Dataset with Universal AST Schema},
author={Gajjar, Jugal and Subramaniakuppusamy, Kamalasankari},
journal={arXiv preprint arXiv:2510.16357},
year={2025}
}
π License
This dataset is released under the MIT License.
You are free to use, modify, and redistribute it for research and educational purposes, with proper attribution.
π Acknowledgements
- StarCoder Dataset for source code samples
- TreeSitter for parsing
- Hugging Face for dataset hosting
π§ Contact
For questions, collaborations, or feedback:
- Primary Author: Jugal Gajjar
- Email: [email protected]
- LinkedIn: linkedin.com/in/jugal-gajjar/
β If you find this dataset useful, consider liking the dataset and the GitHub repository and sharing your work that uses it.
- Downloads last month
- 118