项目作者: MatthewC221

项目描述 :
Decaf compiler
高级语言: C
项目地址: git://github.com/MatthewC221/Compiler.git
创建时间: 2017-02-11T04:43:08Z
项目社区:https://github.com/MatthewC221/Compiler

开源协议:

下载


Decaf compiler (MIT OCW 6.035)

The compiler has my own elements (both intentionally and unintentionally) to it because it is self-studied.
Explanation of components

* Scanner - syntax scanner that divides the text file into symbols, strings, integers and operands

* Parser - mostly non contextual, analyses everything the scanner gives it and decides if everything makes sense within the context of that line. Using a stack and shifting + reducing (shift-reduce parser)

* Semantic analyser - analyses the context of everything, void return in an integer function, string comparison with integer, variable exists, out of bounds array reference, etc…

Code generator - in the works…

RUNNING SCANNER/PARSER/SEMANTIC

chmod 755 semantic_test.pl
./semantic_test.pl

Example: ./scanner parse new1 (where new1 is in parser_tests/)

Alt text