PCAT - Pascal Cloned with an ATtitude
something about PCAT:
- PCAT uses Standard ASCII character set, and case sensitive.
- Comments are enclosed in pairs of
(*
and*)
, not nested. - Support nested functions.
- Support interger, real, record values with implicit pointers, arrays and a few simple structured control constructs.
More details see The PCAT Programming Language Reference Manual.
-
g++ 4.6.3
For ubuntu, run
sudo aptitude install build-essential
to install it. -
Lex - GNU Flex: The Fast Lexical analyzer
-
Yacc - GNU Bison
Just run make
to build our program.
Main goal:
-
Recognize token in the PCAT program, including reserved words, operators, identifiers, comments.
-
for every token, list out its internal repressentation, value, line number & column number.
-
Besides, if there are some errors, print it out, with line number & column number.
-
For errors, try you best to ignore it and go on.
-
Parsing the tokens recognized from Lexer (with Bison)
-
Make a Abstract Semantic Tree (AST)
-
Code style correct based on AST
-
Type checking based on AST
-
Code generation