You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ChocoPy/WORKLOG.md

22 lines
1.3 KiB

# Compiler Construction PA1 Worklog
## Team:
<br>Apoorva Ranade(ar6496)
<br>Sanjar Ahmadov(sa5640)
<br>Yinqi Sun(ys3540)
<br>
<br>
## Indentation:
- A stack is maintained by the lexer to keep track of indentations. A count is accumulated for the number of whitespace characters before the first token. If the count changes from the previous line count, a stack operation is performed. If count increases, another value is added to the stack. If count decreases, the topmost value is popped from the stack.
- The file: src/main/jflex/chocopy/pa1/ChocoPy.jflex, lines from 100 to 182, contain the code for the stack.
- Line 270 of the same file deals with additional dedents in case the input ends in an indented state.
## Challenges:
- Shift-reduce errors while parsing the grammar. One approach to fix is to change the grammar. We chose to fix this issue by adding a precedence as in the case of expr by adding right precedence for if and else.
- Handling errors was another challenge. This required debugging and small changes to program flow.
- Understanding the giving code was a small challenge and took some time before we could start coding.
## Improvements:
- Added more tests to rigorously check program flow and indentation.
- Support for multi-line strings.