Datasets:

Modalities:
Tabular
Text
Formats:
parquet
Languages:
English
ArXiv:
Tags:
code
DOI:
Libraries:
Datasets
Dask
License:
File size: 6,265 Bytes
e8e8454
 
 
 
 
 
 
 
3d3bf63
6966282
e8dc9be
77847d0
 
e8dc9be
6966282
e8dc9be
6966282
e8dc9be
 
 
 
6966282
e8dc9be
 
 
9b62ca6
e8dc9be
9b62ca6
e8dc9be
 
 
 
 
 
 
 
 
 
 
6966282
e8dc9be
6966282
e8dc9be
 
 
 
 
 
 
 
 
 
6966282
e8dc9be
6966282
e8dc9be
9b62ca6
e8dc9be
 
 
 
 
 
 
f8f18ca
 
9b62ca6
e8dc9be
 
6966282
e8dc9be
 
 
 
 
 
 
 
 
 
 
 
 
6966282
e8dc9be
 
 
 
 
 
 
 
 
 
 
 
6966282
 
 
 
 
 
 
 
 
 
 
9b62ca6
 
e8dc9be
9b62ca6
 
 
6966282
 
e8dc9be
9b62ca6
93218be
9b62ca6
6966282
 
e8dc9be
6966282
e8dc9be
9b62ca6
93218be
 
9b62ca6
 
 
 
 
e8dc9be
9b62ca6
93218be
 
9b62ca6
 
 
 
 
 
e8dc9be
9b62ca6
 
 
 
 
 
6966282
 
 
 
 
 
e8dc9be
 
 
 
6966282
e8dc9be
 
92088ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e8dc9be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6966282
e8dc9be
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
---
license: mit
language:
- en
tags:
- code
---

# MultiLang Code Parser Dataset (MLCPD)

[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![GitHub](https://img.shields.io/badge/GitHub-Repository-181717.svg?logo=github)](https://github.com/JugalGajjar/MultiLang-Code-Parser-Dataset)
[![arXiv](https://img.shields.io/badge/arXiv-2510.16357-b31b1b.svg)](https://arxiv.org/abs/2510.16357)


**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

```bash
pip install datasets
```

#### Import Library

```bash
from datasets import load_dataset
```

#### Load the Entire Dataset

```bash
dataset = load_dataset(
    "jugalgajjar/MultiLang-Code-Parser-Dataset"
)
```

#### Load a Specific Language File

```bash
dataset = load_dataset(
    "jugalgajjar/MultiLang-Code-Parser-Dataset",
    data_files="python_parsed_1.parquet"
)
```

#### Stream Data

```bash
dataset = load_dataset(
    "jugalgajjar/MultiLang-Code-Parser-Dataset",
    data_files="python_parsed_1.parquet",
    streaming=True
)
```

#### Access Data Content (After Downloading)

```bash
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:

1. Visit https://huggingface.co/datasets/jugalgajjar/MultiLang-Code-Parser-Dataset
2. Navigate to the Files tab
3. Click on the language file you want (e.g., `python_parsed_1.parquet`)
4. 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](https://arxiv.org/abs/2510.16357)

```bibtex
@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.<br>
You are free to use, modify, and redistribute it for research and educational purposes, with proper attribution.

---

## πŸ™ Acknowledgements

- [StarCoder Dataset](https://huggingface.co/datasets/bigcode/starcoderdata) for source code samples
- [TreeSitter](https://tree-sitter.github.io/tree-sitter/) for parsing
- [Hugging Face](https://huggingface.co/) for dataset hosting

---

## πŸ“§ Contact

For questions, collaborations, or feedback:

- **Primary Author**: Jugal Gajjar
- **Email**: [812jugalgajjar@gmail.com](mailto:812jugalgajjar@gmail.com)
- **LinkedIn**: [linkedin.com/in/jugal-gajjar/](https://www.linkedin.com/in/jugal-gajjar/)

---

⭐ If you find this dataset useful, consider liking the dataset and the [GitHub repository](https://github.com/JugalGajjar/MultiLang-Code-Parser-Dataset) and sharing your work that uses it.