When one starts learning how to program, mistakes are made. The compiler, of course, is the first to tell the new programmer what is valid code and what isn’t. But beyond that, there are a whole lot of issues with one’s code that won’t necessarily keep it from compiling.
What it does
This project extends our university’s online judge so that it starts giving more warnings, warning the user about relatively easy to spot issues before the professor has to spend time on each student. Missing indentation and complex for loops are some examples of those kinds of warnings.
How I built it
A generic Abstract Syntax Tree (AST) ‘super-ast’ was created, this works as an intermediate AST so that we can analyze many different languages without having to write the analyzers multiple times. Therefore, there are the analyzers which work with our intermediate, generic AST. To obtain the super-ast, we need translators - tools that translate from source code into our generic AST.
As part of this project we provide a C++ translator using clang, and a Golang translator using the parser from its own compiler.
What's next for super-ast
Integrating with the schools judge!