Dataset Viewer
Auto-converted to Parquet Duplicate
wrong_code
stringlengths
3
123
correct_code
stringlengths
3
155
explanation
stringclasses
83 values
language
stringclasses
23 values
if [ $c = 56 ]; then
if [ "$c" = 56 ]; then
Quote variable.
Shell
let a: number | null = null; a.toFixed(96);
let a: number | null = null; if(a!==null) a.toFixed(96);
Null check.
TypeScript
<?php // code ?>
<?php // code ?>
Correct.
PHP
let list=vec![52,41,87]; let first=&list[0]; list.push(79);
let mut list=vec![52,41,87]; let first=list[0]; list.push(79);
Copy instead of reference.
Rust
{{'name':'message'}}
{{"name":"message"}}
Use double quotes.
JSON
$z = 53; if ($z = 53) {{}}
$z = 53; if ($z == 53) {{}}
Use ==.
PHP
class Child Base:
class Child(Base):
Inheritance uses parentheses.
Python
SELECT id email FROM users;
SELECT id, email FROM users;
Add comma.
SQL
echo 'message'
echo 'message';
Add semicolon.
PHP
package main func main() {{}}
package main import 'fmt' func main() {{}}
Import needed.
Go
math.sqrt(80)
import math math.sqrt(80)
Import module first.
Python
System.out.println('hello')
System.out.println('hello');
Add semicolon.
Java
if ($c = 1) {{}}
if ($c -eq 1) {{}}
Use -eq.
PowerShell
data[24]
if (length(data) >= 24) data[24]
Check length.
R
var result int = 'world'
var result string = 'world'
Type mismatch.
Go
.Product {{ color: #fff; }}
.Product {{ color: #fff; }}
Correct.
CSS
raise 'value'
raise Exception('value')
Raise needs an exception class.
Python
def process(c): return c + 1
def process(c): return c + 1
Correct.
Python
values.forEach(function(foo) {{ console.log(foo); }})
values.forEach((foo) => {{ console.log(foo); }})
Arrow functions are cleaner.
JavaScript
const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('output')); app.listen(48);
const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('output')); app.listen(48, () => console.log('listening'));
Add callback.
Node.js
{{'title':16, 'title' 48}}
{{'title':16, 'title':48}}
Colon missing.
Python
let foo = 23;
let foo = 23;
Correct.
JavaScript
int* p = nullptr; *p=5;
int* p = new int; *p=5;
Allocate memory.
C++
<p>result <b>test</p></b>
<p>result <b>test</b></p>
Nest properly.
HTML
let foo: Int = 'info'
let foo: String = 'info'
Fix type.
Swift
<br></br>
<br>
Self-closing.
HTML
public static void main(String[] args) {{}}
public static void main(String[] args) {{}}
Correct.
Java
function render() {{ echo 'world'; }}
function render() {{ echo 'world'; }}
Correct.
PHP
foo = hello
foo = 'hello'
Quote strings.
Python
for i in $(ls); do echo $i; done
for i in $(ls); do echo $i; done
Correct.
Shell
17y = 10
y17 = 10
Variable cannot start with digit.
Python
print('result')
print('result')
Correct.
R
if c > 50 puts 'hello'
if c > 50 puts 'hello' end
Add 'end'.
Ruby
class User {{ int index; }} obj.index=5;
class User {{ public int index; }} obj.index=5;
Make field public.
Java
title: test age: world,
title: test age: world
Remove comma.
YAML
for (num in list)
for (num of list)
for...in iterates keys.
JavaScript
$values[76]
if ($values.Count -gt 76) {{ $values[76] }}
Check bounds.
PowerShell
'test' + 100
'test' + str(100)
Can't add int to string.
Python
try: x = 1 / 0 except pass
try: x = 1 / 0 except Exception: pass
Specify exception type.
Python
disp('test')
disp('test')
Correct.
MATLAB
try {{ throw 'data'; }} catch(e) {{}}
try {{ throw new Error('data'); }} catch(e) {{}}
Throw Error objects.
JavaScript
'test' + 98
'test' + 98.to_s
Convert int.
Ruby
else print('hello')
else: print('hello')
Colon after else.
Python
if ($data = 2)
if ($data == 2)
Use ==.
Perl
if (c = 72) {{}}
if (c == 72) {{}}
Use ==.
Java
class = 'message'
class_name = 'message'
'class' is a keyword.
Python
int[] items = new int[67]; items[67] = 5;
int[] items = new int[67]; if (67 < items.length) items[67] = 5;
Check bounds.
Java
def test puts 'result' end
def test puts 'result' end
Correct.
Ruby
let x: i32 = "output";
let x: &str = "output";
Type mismatch.
Rust
if temp = 16
if temp == 16
Use ==.
Ruby
DELETE FROM orders WHERE name=33
DELETE FROM orders WHERE name=33;
Add semicolon.
SQL
if (temp = 8) {{}}
if (temp === 8) {{}}
Use === for equality.
JavaScript
process
process()
Add parentheses.
Kotlin
<div><p>output</div></p>
<div><p>output</p></div>
Nest properly.
HTML
jwt.sign({{id:85}}, 'secret');
jwt.sign({{id:85}}, 'secret', {{expiresIn:'30m'}});
Add expiration.
Node.js
// comment
/* comment */
Use /* */.
CSS
<img src='test.jpg'>
<img src='test.jpg' alt='desc'>
Add alt text.
HTML
for (int i=0; i<88; i++) {{}}
for (int i=0; i<88; i++) {{}}
Correct.
Java
if y = 95
if y == 95
Use ==.
MATLAB
UPDATE items SET name='test' WHERE status=29
UPDATE items SET name='test' WHERE status=29;
Add semicolon.
SQL
assert x > 74
assert x > 74
Correct.
Python
let mut x=56; let r1=&mut x; let ref2=&mut x;
let mut x=56; {{ let r1=&mut x; }} let ref2=&mut x;
Only one mutable borrow.
Rust
arr(65)
if length(arr) >= 65, arr(65), end
Check length.
MATLAB
function bar(): void {{ return 9; }}
function bar(): number {{ return 9; }}
Return type mismatch.
TypeScript
cin >> data cout << data;
cin >> data; cout << data;
Add semicolon.
C++
<center>data</center>
<div style='text-align:center;'>data</div>
Use CSS.
HTML
ArrayList list = new ArrayList();
ArrayList<String> list = new ArrayList<>();
Use generics.
Java
[81, 32, 10
[81, 32, 10]
Close bracket.
Ruby
with open('log.txt') as f: data = f.read()
with open('log.txt') as f: data = f.read()
Correct.
Python
{{"age":"test",}}
{{"age":"test"}}
Remove trailing comma.
JSON
[23, 18, 99
[23, 18, 99]
Close bracket.
Python
<note name='test'/>
<note name="test"/>
Double quotes.
XML
function foo(x:string){{return x;}} foo(6);
function foo(x:string){{return x;}} foo('output');
Pass correct type.
TypeScript
if b = 23 {{}}
if b == 23 {{}}
Use ==.
Swift
data[16]
if (data.indices.contains(16)) data[16]
Check index.
Kotlin
fmt.Println 'message'
fmt.Println('message')
Missing parentheses.
Go
val val = 'world'
val val = "world"
Double quotes.
Kotlin
list: - item1 - item2
list: - item1 - item2
Correct.
YAML
int main() {{ return 0; }}
int main() {{ return 0; }}
Correct.
C++
print 'result'
print('result')
print needs parentheses.
Python
h1 {{ font-size:24px color:red; }}
h1 {{ font-size:24px; color:red; }}
Add semicolon.
CSS
String count = 'value';
String count = "value";
Double quotes.
Java
baz
baz()
Add parentheses.
Swift
<div color=green>
<div style='color:green;'>
Use style attribute.
CSS
let s1 = String::from("data"); let s2 = s1; println!("{{}}", s1);
let s1 = String::from("data"); let s2 = s1.clone(); println!("{{}}", s1);
Clone to avoid move.
Rust
result == '8'
result === 8
Use strict equality.
JavaScript
my @arr = (17,89,7);
my @arr = (17,89,7);
Correct.
Perl
x := 51
x := 51
Correct.
Go
if (y = 86)
if (y == 86)
Use ==.
C++
if val = 30
if val == 30
Use ==.
Go
echo value data
echo 'value data'
Quote to prevent splitting.
Shell
Write-Host 'data'
Write-Host 'data'
Correct.
PowerShell
function bar() {{ return {{key:'data'}} }}
function bar() {{ return {{key:'data'}}; }}
Return object on same line.
JavaScript
Order.save();
Order.save().then(()=>{{}}).catch(err=>{{}});
Handle promise.
Node.js
fs.readFile('config.json', (err,data) => {{ if(err) throw err; }});
fs.readFile('config.json', (err,data) => {{ if(err) {{ console.error(err); return; }} }});
Better error handling.
Node.js
let count = 'world'
let count = "world"
Double quotes.
Swift
console.log('test'
console.log('test')
Close parenthesis.
JavaScript
INSERT INTO products VALUES ('result',12)
INSERT INTO products (id, email) VALUES ('result',12);
Specify columns.
SQL
int values[80]; values[80]=5;
int values[80]; if(80<80){{}} else values[80]=5;
Bounds check.
C++
WHERE id = '46'
WHERE id = 46
Don't quote integer.
SQL
End of preview. Expand in Data Studio

Code Syntax Dataset (S)

A large-scale, high‑quality dataset for teaching large language models to identify and correct common syntax errors across 30+ programming languages.
Contains 500,000+ unique examples (≈110 MB) with English explanations – no artificial padding.


📊 Dataset Format

The dataset is provided as a single CSV file with the following columns:

Column Type Description
wrong_code string Code snippet containing a syntax error
correct_code string The corrected version of the same snippet
explanation string Concise, plain‑English explanation of the mistake and fix
language string Programming language (e.g., Python, JavaScript, Rust)

🧠 Languages Covered

The dataset includes examples from 30+ languages and technologies:

Category Languages
General‑purpose Python, JavaScript, TypeScript, Java, C#, C++, Rust, Go, Ruby, PHP, Perl, Swift, Kotlin, R, MATLAB
Web HTML, CSS
Database SQL (MySQL/PostgreSQL‑style)
Shell / Scripting Bash, PowerShell
Markup / Config YAML, JSON, XML, Markdown
Backend / Node.js Express, fs, JWT, bcrypt, Mongoose

💡 Example Entries

Here are a few sample rows to illustrate the dataset content:

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

Each example is unique – variable names, numbers, and string values are randomised, ensuring a wide variety of patterns for robust model training.


🎯 Use Cases

  • Fine‑tuning LLMs – train models to correct erroneous code or to generate correct code from buggy input.
  • Building code‑review assistants – create tools that automatically detect and suggest fixes for common syntax mistakes.
  • Educational materials – use the dataset as a large, searchable bank of common programming pitfalls.
  • Benchmarking – evaluate how well models understand language‑specific syntax rules.

📈 Dataset Statistics

Metric Value
Total rows ~500,000 – 550,000
File size ≈110 MB (uncompressed CSV)
Languages 30+
Unique templates 130+ error patterns, each parameterised with random values

📄 License

This dataset is released under the Open Metadata License (OpenMDW v1.1) – you are free to use, modify, and distribute it for any purpose, subject to the terms of that license.


🙋 Contributions & Feedback

If you have suggestions for additional languages, error patterns, or improvements, feel free to reach out or open an issue. We welcome contributions to make this dataset even more comprehensive.


Happy training! 🚀

Downloads last month
32