This project is aimed at creating a simple compiler using the C programming language. The compiler will be able to parse a given source code and generate executable machine code.
In this project, we will be implementing a basic compiler
- The compiler will generate the following output files:
- A log file containing compilation information and errors. Log
- A symbol table containing information about the variables and functions in the source code. Log
- A file containing the tokens extracted from the source code. Tokens
- A file containing the source code without spaces, comments, and empty lines. Cleaned Code
- ( 0.1 ) the compiler can read a source text file and print it to a new text file.
- ( 0.2 ) read char by char
- ( 0.3 ) Lexial analysis
-
( 0.3.1 ) symbol table
-
( 0.3.2 ) find tokens: identifires, operators, keywords only in a basic way
| Name | Type | Size | Dimension | Line of Declaration | Line of Use | Address |
-
( 0.3.3 ) find tokens: identifires, operators, keywords, numbers, strings, comments, and special characters
-
( 0.4 ) Show the tokens in a new text file
-
( 0.5 ) Show symbol table in a new text file
-
( 0.6 ) Show the errors in a new text file ( log file )
-
( 0.7 ) Show compilation info in the log file and in the console
-
( 0.8 ) Show the source code without spaces, comments and empty lines in a new text file
-
( 0.9 ) Solve spacing errors: the compiler should ignore spaces, tabs, and new lines
-
To get started with this project, follow these steps:
- Clone the repository:
git clone https://github.com/your-username/itse121-compiler.git
- Install the required dependencies.
- Build the project using the provided build script.
- Run the compiler on a sample source code file.
To use the compiler, run the following command:
```bash
$ make compiler
$ ./compiler
```
To contribute to this project, follow these steps:
- Fork this repository.
- Create a branch:
git checkout -b <branch-name>
- Make your changes and commit them:
git commit -m '<commit-message>'
- Push to the original branch:
git push origin <project-name>/<location>
- Create the pull request.
This project is licensed under the MIT License - see the LICENSE file for details.