Skip to content

Commit

Permalink
Final Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
namangup committed Apr 25, 2022
1 parent c304645 commit 56eed97
Show file tree
Hide file tree
Showing 97 changed files with 4,335 additions and 873 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ out/
# Temporary Files
src/parser.out
src/parsetab.py
tmp/
tmp/
htmlcov/
.coverage
dot/*.dot
29 changes: 25 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ PYTHON=python3
SRC=./src
LEXER_TEST=./test/lexer
PARSER_TEST=./test/semantics
FINAL_TEST=./tests/final

install:
$(PYTHON) -m pip install --ignore-installed -r ./requirements.txt
Expand All @@ -13,14 +14,34 @@ lexer-tests:
done

parser-tests:
mkdir -p out/parser
mkdir -p out/tac out/symtab
mkdir -p dot/pdf
for i in {1..5} ; do \
$(PYTHON) -Wignore $(SRC)/parser.py -o out/parser/$$i.csv $(PARSER_TEST)/test$$i.c; \
$(PYTHON) -Wignore $(SRC)/parser.py $(PARSER_TEST)/test$$i.c; \
dot -Tpdf -o dot/pdf/$$i.pdf dot/$$i.dot; \
done

final-tests:
mkdir -p out/tac out/symtab out/exec out/assembly
for i in {1..33} ; do \
$(PYTHON) -Wignore $(SRC)/parser.py $(FINAL_TEST)/$$i.c; \
$(PYTHON) -Wignore $(SRC)/codegen.py out/tac/$$i.txt; \
gcc -w -m32 -o out/exec/$$i.out out/assembly/$$i.s src/lib.o -lm 2> /dev/null; \
done

compile:
mkdir -p out/tac out/symtab out/exec out/assembly
- rm out/tac/$(TEST).txt out/assembly/$(TEST).s out/exec/$(TEST).out
$(PYTHON) -Wignore $(SRC)/parser.py $(FINAL_TEST)/$(TEST).c
$(PYTHON) -Wignore $(SRC)/codegen.py out/tac/$(TEST).txt
gcc -w -m32 -o out/exec/$(TEST).out out/assembly/$(TEST).s src/lib.o -lm 2> /dev/null

make exec:
for i in {1..33} ; do \
./out/exec/$$i.out; \
done

clean:
-rm dot/{1..5}.dot
-rm dot/pdf/{1..5}.pdf
-rm dot/*.dot
-rm dot/pdf/*.pdf
-rm -r out
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ optional arguments:
-o OUT, --out OUT Store output of parser in a file
```

### Codegen
```
python src/codegen.py
usage: codegen.py infile
```

### Generating Automaton Graph
> Note: This is a time consuming step.
Expand Down
Binary file modified docs/specs.pdf
Binary file not shown.
Loading

0 comments on commit 56eed97

Please sign in to comment.