Syntax and Stack Overflow: A Methodology for Extracting a Corpus of Syntax Errors and Fixes

Alexander William Wong, Amir Salimi, Shaiful Alam Chowdhury, Abram Hindle

2019/07/13

Syntax and Stack Overflow: A Methodology for Extracting a Corpus of Syntax Errors and Fixes

Authors

Alexander William Wong, Amir Salimi, Shaiful Alam Chowdhury, Abram Hindle

Venue

Abstract

One problem when studying how to find and fix syntax errors is how to get natural and representative examples of syntax errors. Most syntax error datasets are not free, open, and public, or they are extracted from novice programmers and do not represent syntax errors that the general population of developers would make. Programmers of all skill levels post questions and answers to Stack Overflow which may contain snippets of source code along with corresponding text and tags. Many snippets do not parse, thus they are ripe for forming a corpus of syntax errors and corrections. Our primary contribu- tion is an approach for extracting natural syntax errors and their corresponding human made fixes to help syntax error research. A Python abstract syntax tree parser is used to determine preliminary errors and corrections on code blocks extracted from the SOTorrent data set. We further analyzed our code by executing the corrections in a Python interpreter. We applied our methodology to produce a public data set of 62,965 Python Stack Overflow code snippets with corresponding tags, errors, and stack traces. We found that errors made by Stack Overflow users do not match errors made by student developers or random mutations, implying there is a serious representativeness risk within the field. Finally we share our dataset openly so that future researchers can re-use and extend our syntax errors and fixes.

Bibtex

@inproceedings{wongICSME2019-syntax,
 abstract = {One problem when studying how to find and fix syntax errors is how to get natural and representative examples of syntax errors. Most syntax error datasets are not free, open, and public, or they are extracted from novice programmers and do not represent syntax errors that the general population of developers would make. Programmers of all skill levels post questions and answers to Stack Overflow which may contain snippets of source code along with corresponding text and tags.  Many snippets do not parse, thus they are ripe for forming a corpus of syntax errors and corrections. Our primary contribu- tion is an approach for extracting natural syntax errors and their corresponding human made fixes to help syntax error research.  A Python abstract syntax tree parser is used to determine preliminary errors and corrections on code blocks extracted from the SOTorrent data set. We further analyzed our code by executing the corrections in a Python interpreter. We applied our methodology to produce a public data set of 62,965 Python Stack Overflow code snippets with corresponding tags, errors, and stack traces. We found that errors made by Stack Overflow users do not match errors made by student developers or random mutations, implying there is a serious representativeness risk within the field.  Finally we share our dataset openly so that future researchers can re-use and extend our syntax errors and fixes.},
 accepted = {2019-07-13},
 author = {Alexander William Wong and Amir Salimi and Shaiful Alam Chowdhury and Abram Hindle},
 authors = {Alexander William Wong, Amir Salimi, Shaiful Alam Chowdhury, Abram Hindle},
 booktitle = {2019 IEEE International Conference on Software Maintenance and Evolution (ICSME)},
 code = {wongICSME2019-syntax},
 date = {2019-07-13},
 funding = {NSERC Discovery},
 location = {Cleveland, United States},
 pagerange = {318--322},
 pages = {318--322},
 rate = {26/46 or 56%},
 region = {Ohio},
 role = {Co-Author},
 title = {Syntax and Stack Overflow: A Methodology for Extracting a Corpus of Syntax Errors and Fixes},
 type = {inproceedings},
 url = {http://softwareprocess.ca/pubs/wongICSME2019-syntax.pdf},
 venue = {2019 IEEE International Conference on Software Maintenance and Evolution (ICSME)},
 year = {2019}
}