110-01 NCU CE3006 Compiler
- Scanner
- Parser
- Lex, Regular Expression
- First Set
- Follow Set
- lex, yacc
- stack, matrix calculator, list
./test_data/*.lsp
, ./hidden_data/*.lsp
LISP that need to process
ps. hidden_data is from demo on 2021/01/07
this can only (fully) solve basic features Q1 ~ Q8 and bonus features Q1 ~ Q2.
Feature | Description | Points | Public1 | Public2 | Hidden1 | Hidden2 |
---|---|---|---|---|---|---|
Syntax Validation | Print “syntax error” when parsing invalid syntax | 10 | ◯ | ◯ | ◯ | ◯ |
Implement print-num statement | 10 | ◯ | ◯ | ◯ | ◯ | |
Numerical Operations | Implement all numerical operations | 25 | ◯ | ◯ | ◯ | ◯ |
Logical Operations | Implement all logical operations | 25 | ◯ | ◯ | ◯ | ◯ |
if Expression | Implement if expression | 8 | ◯ | ◯ | ◯ | ◯ |
Variable Definition | Able to define a variable | 8 | ◯ | ◯ | ◯ | ◯ |
Function | Able to declare and call an anonymous function | 8 | ◯ | ◯ | ◯ | ◯ |
Named Function | Able to declare and call a named function | 6 | ◯ | ◯ | ◯ | ◯ |
Public test case points : Hidden test case points = 80% : 20% (pass partial get partial)
Feature | Description | Points | Public1 | Public2 | Hidden1 | Hidden2 |
---|---|---|---|---|---|---|
Recursion | Support recursive function call | 5 | ◯ | ◯ | ◯ | ◯ |
Type Checking | Print error messages for type errors | 5 | ◯ | ◯ | ◯ | ◯ |
Nested Function | Nested function | 5 | ◯ | ✕ | ◯ | ✕ |
First-class Function | Able to pass functions, support closure | 5 | ✕ | ◯ | ✕ | ◯ |
Public test case points : Hidden test case points = 0% : 100% (pass all get all)
Q3 test case 2: Segmentation Fault in ast.cpp#L167 std::string copy
Q4 test case 1: ids scope wrong
this can only solve sub-problems Q1 ~ Q6.
Makefile for lex
Makefile for both lex and yacc
plz follow MIT License