README for lab2: Lexing & Parsing (Ling Li and Xin Yu, Jan. 29, 2001) ---------------------------------------------------------------------- Lexer and parser for functional C. All 3 tests ran perfectly. ---------------------------------------------------------------------- Changed files: fc_ast_lex.mll The lexer fc_ast_parse.mly The parser fc_ast_type.mlz Add UPlusOp and UBAndOp to type unop fc_ast_eval.ml Modify print_unop to deal with UPlusOp, UBAndOp fc_ast_util.ml Modify eval_unop to deal with UPlusOp, UBAndOp; Add function eval_uplus; Leave eval_ubandop unimplemented. ---------------------------------------------------------------------- Done things: 0. Everything needed for those 3 tests, such as function, struct, basic operators, pointer ... 1. Conversion of escape sequences in string and character. 2. Built-in types are returned as specific tokens. (it can also be returned as TokTypeId) 3. Function with abstract declaration; function as argument; function as return value. 4. Treat struct define as typedef. 5. Everything can be empty -- it seems to be. ---------------------------------------------------------------------- Problems: 1. Can't do self-reference of structure: struct node { int key; node *next; }; 2. Missing token after unbalanced IF statement: if (1) 3; 4 + 5 4 is missed. 3. The scoping system is yet awkward. ---------------------------------------------------------------------- This file together with the programs of lex/parse can be found at http://www.cs.caltech.edu/~ling/course/cs134b/lab2