Datasets:
wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 101
values | language stringclasses 26
values |
|---|---|---|---|
Write-Host 'result' | Write-Host 'result' | Correct. | PowerShell |
for x in range(67)
print(x) | for x in range(67):
print(x) | Colon after for. | Python |
var x = 50; | var x = 50; | Correct. | Dart |
if num = 99 | if num == 99 | Use ==. | Ruby |
div {{ color=green; }} | div {{ color: green; }} | Use colon. | CSS |
@media screen {{ body {{}} }} | @media screen {{ body {{}} }} | Correct. | CSS |
DELETE FROM orders WHERE id=84 | DELETE FROM orders WHERE id=84; | Add semicolon. | SQL |
if ($bar = 18) | if ($bar == 18) | Use ==. | Perl |
<hr></hr> | <hr> | Self-closing. | HTML |
list:
- item1
- item2 | list:
- item1
- item2 | Correct. | YAML |
for i in $(ls); do echo $i; done | for i in $(ls); do echo $i; done | Correct. | Shell |
title: test
name: test, | title: test
name: test | Remove comma. | YAML |
cin >> bar
cout << bar; | cin >> bar;
cout << bar; | Add semicolon. | C++ |
for i=1,1 do print(i) end | for i=1,1 do print(i) end | Correct. | Lua |
if (y = 33) | if (y == 33) | Use ==. | C++ |
print('info') | print('info') | Correct. | R |
val temp: Int = 'message' | val temp: String = 'message' | Fix type. | Kotlin |
a = 72 | a=72 | No spaces. | Shell |
let result: number = 'info'; | let result: string = 'info'; | Fix type. | TypeScript |
class = 'test' | class_name = 'test' | 'class' is a keyword. | Python |
92result = 10 | result92 = 10 | Variable cannot start with digit. | Python |
if count = 42 then
print('test')
end | if count == 42 then
print('test')
end | Use ==. | Lua |
[38, 87, 22 | [38, 87, 22] | Close bracket. | Ruby |
data[64] | if (data.indices.contains(64)) data[64] | Check index. | Kotlin |
println('info') | println("info") | Double quotes. | Scala |
items(99) | if length(items) >= 99, items(99), end | Check length. | MATLAB |
sys.sqrt(63) | import sys
sys.sqrt(63) | Import module first. | Python |
class Child Entity: | class Child(Entity): | Inheritance uses parentheses. | Python |
const http = require('http'); http.createServer((req,res) => res.end('data')).listen(64); | const http = require('http'); http.createServer((req,res) => res.end('data')).listen(64); | Correct. | Node.js |
x == '29' | x === 29 | Use strict equality. | JavaScript |
echo 'value' | echo 'value'; | Add semicolon. | PHP |
var x int | var x int | Correct. | Go |
compute | compute() | Add parentheses. | Swift |
<a href='https://test.org' target='_blank'> | <a href='https://test.org' target='_blank' rel='noopener'> | Add rel for security. | HTML |
const count = 53; count = 28; | let count = 53; count = 28; | Cannot reassign const. | JavaScript |
x := 85 | x := 85 | Correct. | Go |
def compute
puts 'world'
end | def compute
puts 'world'
end | Correct. | Ruby |
fs.readFile('data.txt', (err,data) => {{ if(err) throw err; }}); | fs.readFile('data.txt', (err,data) => {{ if(err) {{ console.error(err); return; }} }}); | Better error handling. | Node.js |
assert num > 4 | assert num > 4 | Correct. | Python |
if foo > 31
puts 'info' | if foo > 31
puts 'info'
end | Add 'end'. | Ruby |
int main() {{ return 0; }} | int main() {{ return 0; }} | Correct. | C++ |
$values[3] = 5; | if (isset($values[3])) $values[3] = 5; | Check existence. | PHP |
<br></br> | <br> | Self-closing. | HTML |
'data' + 38 | 'data' + str(38) | Can't add int to string. | Python |
$x = 5; if ($x -eq 5) { Write-Host 'yes' } | $x = 5; if ($x -eq 5) { Write-Host 'yes' } | Correct. | PowerShell |
if (y = 50) {{}} | if (y === 50) {{}} | Use === for equality. | JavaScript |
let val = 64; | let val = 64; | Correct. | JavaScript |
int[] list = new int[77];
list[77] = 5; | int[] list = new int[77];
if (77 < list.length) list[77] = 5; | Check bounds. | Java |
SELECT * FROM products WHRE email=34; | SELECT * FROM products WHERE email=34; | Fix WHERE. | SQL |
void main() {{ print('hello') }} | void main() {{ print('hello'); }} | Add semicolon. | Dart |
values[58] | if (length(values) >= 58) values[58] | Check length. | R |
let b = 53; b += 1; | let mut b = 53; b += 1; | Need mut to modify. | Rust |
<root><child>text</child></root> | <root><child>text</child></root> | Correct. | XML |
try {{ throw 'value'; }} catch(e) {{}} | try {{ throw new Error('value'); }} catch(e) {{}} | Throw Error objects. | JavaScript |
if (y = 93) {{}} | if (y == 93) {{}} | Use ==. | Kotlin |
val bar = 'data' | val bar = "data" | Double quotes. | Kotlin |
def render():
print('test') | def render():
print('test') | Indent function body. | Python |
class Order {{ int num; }}; | class Order {{ public: int num; }}; | Make public. | C++ |
WHERE email = '91' | WHERE email = 91 | Don't quote integer. | SQL |
match index {{ 1 => {{}} }} | match index {{ 1 => {{}} _ => {{}} }} | Match must be exhaustive. | Rust |
let s = String::from("data"); let r=&s; s.push_str("!"); | let mut s = String::from("data"); let r=&s; println!("{{}}", r); s.push_str("!"); | Cannot mutate while borrowed. | Rust |
const bar; | const bar = 23; | Initialize const. | JavaScript |
let b: Int = 'data' | let b: String = 'data' | Fix type. | Swift |
raise 'world' | raise Exception('world') | Raise needs an exception class. | Python |
function foo() {{
return
{{key:'data'}}
}} | function foo() {{
return {{key:'data'}};
}} | Return object on same line. | JavaScript |
function test(): void {{ return 95; }} | function test(): number {{ return 95; }} | Return type mismatch. | TypeScript |
<p>data <b>world</p></b> | <p>data <b>world</b></p> | Nest properly. | HTML |
String count = 'value'; | String count = "value"; | Double quotes. | Java |
else
print('value') | else:
print('value') | Colon after else. | Python |
.User {{ color: red; }} | .User {{ color: red; }} | Correct. | CSS |
#main {{ color: #333; }} | #main {{ color: #333; }} | Correct. | CSS |
switch(item){{ case 51: break; }} | switch(item){{ case 51: break; default: break; }} | Add default case. | Java |
[39, 74, 89 | [39, 74, 89] | Close bracket. | Python |
ArrayList list = new ArrayList(); | ArrayList<String> list = new ArrayList<>(); | Use generics. | Java |
System.out.println('result') | System.out.println('result'); | Add semicolon. | Java |
void foo();
int main(){{foo();}} | void foo(); // prototype
int main(){{foo();}} | Declare before use. | C++ |
try:
x = 1 / 0
except
pass | try:
x = 1 / 0
except Exception:
pass | Specify exception type. | Python |
{{'id':'value'}} | {{"id":"value"}} | Use double quotes. | JSON |
function foo() {{ echo 'hello'; }} | function foo() {{ echo 'hello'; }} | Correct. | PHP |
with open('input.csv') as fh:
data = fh.read() | with open('input.csv') as fh:
data = fh.read() | Correct. | Python |
INSERT INTO items VALUES ('test',44) | INSERT INTO items (id, status) VALUES ('test',44); | Specify columns. | SQL |
lambda x: x+1 | lambda x: x+1 | Correct lambda. | Python |
if [ $item = 45 ]; then | if [ "$item" = 45 ]; then | Quote variable. | Shell |
if (index = 75) {{}} | if (index == 75) {{}} | Use ==. | Java |
<?php
// code
?> | <?php
// code
?> | Correct. | PHP |
def process(num):
return num + 1 | def process(num):
return num + 1 | Correct. | Python |
data[36] | if data.indices.contains(36) {{ data[36] }} | Check index. | Swift |
<person age=91> | <person age="91"> | Quote attribute. | XML |
function handle(data)
print(data)
end | function handle(data)
print(data)
end | Correct. | Lua |
class Order {{ int item; }}
obj.item=5; | class Order {{ public int item; }}
obj.item=5; | Make field public. | Java |
// comment | /* comment */ | Use /* */. | CSS |
if (temp = 34) {} | if (temp == 34) {} | Use ==. | Dart |
const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('world')); app.listen(70); | const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('world')); app.listen(70, () => console.log('listening')); | Add callback. | Node.js |
["test", 71] | ["test", 71] | Correct. | JSON |
List<int> list = [1,2,3]; | List<int> list = [1,2,3]; | Correct. | Dart |
let bar = 'world' | let bar = "world" | Double quotes. | Swift |
UPDATE products SET email='world' WHERE status=45 | UPDATE products SET email='world' WHERE status=45; | Add semicolon. | SQL |
if index = 25 | if index == 25 | Use ==. | Go |
name: data
age: 60 | name: data
age: 60 | Correct. | YAML |
$x = 5; echo $x | $x = 5; echo $x; | Missing semicolon. | PHP |
End of preview. Expand in Data Studio
Code-Syntax-Expanded
A massive, high-quality synthetic dataset for training LLMs to identify and correct syntax errors across 33 programming languages. Contains 5+ million unique examples (~1.1 GB) with English explanations β no artificial padding, no duplicate rows.
π Dataset Overview
| Property | Value |
|---|---|
| Total rows | 5,000,000+ |
| File size | ~1.1 GB (uncompressed CSV) |
| Languages | 33 |
| Unique templates | 160+ error patterns |
| Format | CSV (4 columns) |
| License | ODA-TL v1.0 |
π Dataset Structure
Each row contains:
| Column | Description |
|---|---|
wrong_code |
Code snippet containing a syntax error |
correct_code |
Corrected version of the snippet |
explanation |
Concise English explanation of the error and fix |
language |
Programming language (e.g., Python, JavaScript, Rust) |
π§ Languages Covered
General Purpose
Python, JavaScript, TypeScript, Java, C#, C++, Rust, Go, Ruby, PHP, Perl, Swift, Kotlin, R, MATLAB, Scala, Lua, Dart
Web Technologies
HTML, CSS
Database
SQL (MySQL/PostgreSQL-style)
Shell & Scripting
Bash, PowerShell
Markup & Configuration
YAML, JSON, XML, Markdown
Backend & Frameworks
Node.js (Express, fs, JWT, bcrypt, Mongoose)
π Dataset Statistics
| Language | Examples (approximate) | Key Error Types |
|---|---|---|
| Python | 350,000+ | Missing colons, indentation, == vs =, imports |
| JavaScript | 300,000+ | Missing parentheses, === vs ==, const reassignment |
| Rust | 200,000+ | Borrow checker, moves, mutable references |
| Java | 250,000+ | Semicolons, type mismatches, array bounds |
| SQL | 200,000+ | Missing commas, WHERE typos, quoting |
| HTML/CSS | 250,000+ | Nesting, self-closing tags, attribute quoting |
| Others | 3,200,000+ | Language-specific syntax rules |
π― Use Cases
- Fine-tuning LLMs for code correction and syntax repair
- Building code review assistants that detect common mistakes
- Teaching programming with a massive bank of error/fix examples
- Benchmarking model understanding of language-specific syntax
- Creating educational tools for learning programming languages
π‘ Example Entries
| wrong_code | correct_code | explanation | language |
|---|---|---|---|
if x > 5\n print('hello') |
if x > 5:\n print('hello') |
Colon missing after if. | Python |
console.log('world' |
console.log('world') |
Close parenthesis. | JavaScript |
let mut x=5; let r1=&mut x; let r2=&mut x; |
let mut x=5; { let r1=&mut x; } let r2=&mut x; |
Only one mutable borrow allowed. | Rust |
SELECT name age FROM users; |
SELECT name, age FROM users; |
Missing comma between columns. | SQL |
<p>Hello <b>world!</p></b> |
<p>Hello <b>world!</b></p> |
Improper nesting of tags. | HTML |
- Downloads last month
- 30