Table of Contents
In this project we implement two phase of decaf compiler .
First phase is Lexical analysis and It takes modified source code from language preprocessors that are written in the form of sentences.
The lexical analyzer breaks these syntaxes into a series of tokens, by removing any whitespace or comments in the source code.
If the lexical analyzer finds a token invalid, it generates an error.
Also In the first phase we have Preprocessor which handle DEFINE macro before breaks syntaxes into a series of tokens.
In the second phase we need to Parsing code .
Parsing or (syntax analysis) is the process of analyzing text containing a sequence of tokens to determine its grammatical structure with respect to grammar.
In this project we can give the decaf code as an input and in the last if syntax of code was true we get series of tokens else we get syntax error.
This section should list any major frameworks/libraries used to bootstrap your project. Leave any add-ons/plugins for the acknowledgements section. Here are a few examples.
This is an example of how you may give instructions on setting up your project locally. follow these simple example steps.
we have two JAR files in src/compiler directory , one of them is jflex-full-1.8.2.jar and another is java-cup-11b.jar .
- First in Terminal you should go to src/compiler directory
- you should use command like this for go to directory
cd src/compiler
- then for compile you should use this command
java -jar jflex-full-1.8.2.jar Scanner_Jflex.flex
- First in Terminal you should go to src/compiler directory
- you should use command like this for go to directory
cd src/compiler
- then for compile you should use this command
java -jar java-cup-11b.jar Parser.cup
For run and use this project you should create new text file and write your decaf code in that. then you should copy that text file's address .
open the project and go to Testing.java in src/compiler directory
then in line 9 paste that copied address in the file methode argument
now run Testing.java .
you can see the result in your IDE Run console.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the GNU General Public License v3.0 License. See LICENSE.txt
for more information.
name :Mohammad mahdi noori
email : mohamadnoori123@gmail.com
Project Link: Link
Use this space to list resources you find helpful and would like to give credit to. I've included a few of my favorites to kick things off!