ARTIDE is A Really Tiny Integrated Delopment Enviroment for the mini-C programming language which provide only compiler and debugger. ARTIDE written in Python. ARTIDE was originally start from a term project of compiler design course in KAIST.
Week | Description |
---|---|
week9 | |
week10 | |
week11 | |
week12 | |
week13 | |
week14 | Implement interpreter/debugger and code generator |
week15 | Final presentation |
week16 | Final report |
The mini-C programming language is a proper subset of ANSI C (C89/C90).
The mini-C supports:
- Primitive data types:
int
,float
,double
,char
,str
+array
andpointer
types for them. - Primitive operations: arithmetic, comparison&relational, logical, bitwise, and assignmnet operations.
The mini-C does not supports:
struct
,union
, andenum
types.- User defined types.
- Type qualifiers:
signed
,unsigned
,const
,volatile
,extern
,static
,auto
, andregister
.
The front end of the mini-C compiler consist of three different parts, namely, lexical, syntax, and semantic analyzer. The lexical and syntax analyzer implemented by using PLY (Python Lex-Yacc) library (PLY-3.11). The PLY libary has two modules Lex and Yacc.
The lexical analyzer uses Lex module of the PLY library. Token specification of mini-C can be found in lexical_analyzer.py
. It can covers all the tokens of ANSI C (C89/C90).
The syntax anlayzer uses Yacc module of the PLY library. Context free grammer within BNF can be found in syntax_analyzer.py
. The parsing mechnism of generated syntax analyzer is LALR(1).
The semantic analyzer of the mini-C compiler provides static and type checking features.
- Static checking
- Check the existence of duplicated identifier error.
- Check weather the
continue
andbreak
statement are located inside loop or not.
- Type checking
- Check the types of operands for arithmetic operators.
- Check the types of destination and source element in assignment operator.
In both two checking phases, the semantic analyzer insert some cast operations if it need to and possible to match the types of operands.
The middle end of the mini-C compiler is just intermideate code generator. It generates intermideate code as the form of three address code.
Back end of mini-C compiler in ARTIDE has only code generator.
Code generator of mini-C compiler in ARTIDE supports only x86 ISA with AT&T syntax.