Not Ordinary Tiger Language
no-tiger is the course project for Compiler, Zhejiang University, Spring 2019.
-
FLEX AND BISON IN C++ best workable example
-
compiler2018_big_picture slides from Lequn Chen, TA from SJTU (now PhD at UW)
- Flex: 2.5.37 (different version may cause UB)
- Bison: 3.0.4 (for Bison version >= 3.0.4, remove
sed
command inbuild.sh
since move semantics is already supported) - GCC: 7.3.0
You can easily install the newest Bison throwgh homebrew
. However, currently for Flex version >= 2.6, there exist some reference problems. Thus, we use the version 2.5.37 to develop and test. You might download the source from here and compile it yourself.
What needs to be pointed out is that macOS has a default Flex (2.5.35) and a default Bison (2.3), and they may cause some conflicts with your manual installed versions. Thus, you should export the new ones' path into ~/.bash_profile
to make them available. Type in these in terminal:
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' >> ~/.bash_profile
git clone --recursive [url]
sh build.sh
Our compiler can dump AST in XML format. The provided python script can help visualize the AST
python tools/visualize.py input.xml
-
C++ style Flex/Bison generated scanner/parser
-
support
main
(at exp1.c) -
Support basic control flow:
if while for break continue
-
Support function definition
-
Support expressions
-
XML AST format output
-
LLVM codegen
-
Support builtin array
-
Support builtin I/O functions
- cxxopts - Lightweight C++ command line option parser