https://github.com/rebornplusplus/icg
Lexical Analysis and Intermediate Code Generation
https://github.com/rebornplusplus/icg
Last synced: about 1 year ago
JSON representation
Lexical Analysis and Intermediate Code Generation
- Host: GitHub
- URL: https://github.com/rebornplusplus/icg
- Owner: rebornplusplus
- Created: 2022-01-17T19:51:06.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-01-19T18:28:39.000Z (over 4 years ago)
- Last Synced: 2025-01-27T07:09:30.864Z (over 1 year ago)
- Language: Yacc
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Lexical Analysis and Intermediate Code Generation
Input a C code (with some syntaxes restricted such as includes), the lexical analyzer
analyzes the tokens, passes the token stream on to the Intermediate Code Generator
which generates a equivalent 8086 Assembly code using a predefined set of grammars.
Peephole Optimizer is used to optimize the 8086 Assembly code runtime.
### Make and run
Execute the following command to prepare the binaries.
```
$ make
```
A binary named `icg` will be generated. If you have a C-subset code in a file named
[input.c](./input.c), run the following command.
```
$ ./icg input.c
```
A equivalent 8086 Assembly code will be generated in [code.asm](./code.asm) file. Additionally, a text
file named [error.txt](./error.txt) is also created which contains list of errors encountered during
compilation i.e. code generation.
### Dependencies
* flex
* bison
* CMake