summaryrefslogtreecommitdiffstats
path: root/src/parser.y
Commit message (Collapse)AuthorAgeFilesLines
* Change ID to var_ref for rule assign_exprkugwa2015-12-091-4/+2
| | | | ccmmc_ast_new_id() is not needed for the rule
* Allow using 'type name(void)' to define functions with no argumentTing-Wei Lan2015-12-071-0/+24
|
* Re-add line number fields in AST nodesTing-Wei Lan2015-12-071-128/+185
| | | | It is required to show line numbers in error messages.
* Drop all non-namespaced symbolsTing-Wei Lan2015-12-031-155/+219
| | | | | | | | | | | | | | 1. All data types and macros in headers, global variables and functions that have external linkage are namespaced. The only two files that allow non-namespaced symbols are main.c and common.h. common.h should not be included by any other headers. 2. Coding style is fixed when possible. 3. Drop unused variables or struct members. 4. 'name' macro is renamed to 'prog_name' to prevent conflicts with ast.h. 5. %union includes a CON_Type (now CcmmcValueConst) instead of a pointer to it. This prevents an unnecessary malloc. 6. Fix buffer overflow in draw.c. draw.c should not modify the input AST while generating the graph.
* Drop line_number and prog global variablesTing-Wei Lan2015-12-021-13/+9
| | | | | All important states should be stored in the local struct allocated in main function.
* Make the scanner and the parser reentrant and reduce non-namespaced symbolsTing-Wei Lan2015-12-011-6/+14
|
* Sort the list of tokens and non-terminalsTing-Wei Lan2015-11-301-15/+18
|
* The style of grammer rules is more consistent nowTing-Wei Lan2015-11-301-129/+130
|
* Drop tab usage in source filesTing-Wei Lan2015-11-301-47/+47
|
* Drop unused codeTing-Wei Lan2015-11-301-7/+1
|
* All source files should include vim modelinesTing-Wei Lan2015-11-301-0/+2
|
* Include our headers before including system headersTing-Wei Lan2015-11-301-1/+2
|
* Don't include lexer.c and move yyerror to the end of fileTing-Wei Lan2015-11-301-11/+11
|
* Enable POSIX extensionsTing-Wei Lan2015-11-131-0/+4
|
* Implement IF and IF...ELSE statementskugwa2015-11-131-5/+7
| | | | | 1. Use "%right DL_RPAREN ELSE" to solve SR conflict. 2. Fix a bug in assign_expr: token ID is not an AST_NODE.
* Complete rules and actions for remaining operators and arraysTing-Wei Lan2015-11-131-26/+84
| | | | | | 1. Actions for binary operators are completed. 2. Rules and actions for unary operators are added. 3. Arrays can be used in expressions now.
* Complete most of the semantic actions before relop_exprkugwa2015-11-131-47/+81
| | | | | if and if-then-else have not been implemented. Some actions after relop_expr is done for the test of for loop.
* Fix some actions to meet TA's speckugwa2015-11-131-10/+5
| | | | | | | | 1. dim_fn should be the child of ID 2. decl_list should be the child of VARIABLE_DECL_LIST_NODE 3. stmt_list should be the child of STMT_LIST_NODE 4. Add actions for decl_list 5. ID with initial value should use WITH_INIT_ID instead of NORMAL_ID
* It finally works for some simple programskugwa2015-11-121-21/+43
| | | | Complete actions of some nonterminals derived from global_decl.
* Merge TA's codes to ourskugwa2015-11-111-0/+580
Delete tmp funtion used in HW2. Move AST functions into ast.c. CONST_INT, CONST_FLOAT, and CONST_STRING all return CONST.