1 | = INTRODUCTION =
|
---|
2 |
|
---|
3 | Welcome reader,
|
---|
4 |
|
---|
5 | You will find our solution on assignment 2 of Compiler Constructions 2008
|
---|
6 | giving at LIACS University. First we will you a grand overview of the files
|
---|
7 | altered, next we will bullet point the most important design decisions.
|
---|
8 |
|
---|
9 | And the grand finale will show the usage of the program.
|
---|
10 |
|
---|
11 | Enjoy!
|
---|
12 | Johan and Rick <hvdzwet@liacs.nl>
|
---|
13 |
|
---|
14 |
|
---|
15 | = FILES EDITED/ADDED =
|
---|
16 | A coercion.cc = Coercion and checking module C++ code
|
---|
17 | A coercion.h = Coercion and checking module C++ header
|
---|
18 | E comp.l = Main program lexer flex code
|
---|
19 | E comp.y = Main program parser bison code
|
---|
20 | E debug.c = Debug printing module C++ code
|
---|
21 | E debug.h = Debug printing module C++ header
|
---|
22 | A debug.sh = Debug cycle on single test file
|
---|
23 | A DOCUMENTATION.TXT = Reading right know :-)
|
---|
24 | A messages.cc = Messaging module C++ code
|
---|
25 | A messages.h = Messaging module C++ header
|
---|
26 |
|
---|
27 | = DESIGN DECISIONS =
|
---|
28 | * lastOP : Allowing to differentiate without altering the grammar of the language,
|
---|
29 | required the notion of storing the current RELOP and MULOP into lastOP, allowing
|
---|
30 | it to be read later on by the parser, to identity the proper NODE_*
|
---|
31 |
|
---|
32 | * Separate files for the use of Messaging, Coercion, Debug to keep code
|
---|
33 | readable and more understandable
|
---|
34 |
|
---|
35 | * For the sake of simplicity not all calls within the Parser are of type Node,
|
---|
36 | some are Symbol, to clearly define we are only using partial information out
|
---|
37 | of it.
|
---|
38 |
|
---|
39 | * Split calls for recognising the current ID, as the parser could traverse some
|
---|
40 | steps deep, allowing to change the lastID while the corresponding code has
|
---|
41 | not been called. A 'temporary' node will be created and passed along down below
|
---|
42 |
|
---|
43 | * Parameter listings will first have a unknown return value and made to a
|
---|
44 | linked list right away, ones the return value has found it recursively get
|
---|
45 | added to it pre-assessors
|
---|
46 |
|
---|
47 | * Creating a new node and type checking will done 'on the fly' e.g. a function
|
---|
48 | is called with a specific node -> conversion/coercion fails/warnings/errors
|
---|
49 | -> specific node or dummy value returned
|
---|
50 |
|
---|
51 |
|
---|
52 | = USAGE =
|
---|
53 | # Compile
|
---|
54 | $ make first
|
---|
55 | $ make
|
---|
56 | # Full blown debugging stack
|
---|
57 | $ ./comp -w -vvvv <testfile
|
---|
58 | # Lexer debugging only
|
---|
59 | $ ./comp -w -vvv <testfile
|
---|
60 | # All quiet
|
---|
61 | $ ./comp -n -qqqq <testfile
|
---|
62 | # Normal usage
|
---|
63 | $ ./comp <testfile
|
---|