mohamadmahdi1234 / compiler_phase_two_IE

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Forks Stargazers Issues MIT License

compiler_phase2

mohammad mahdi noori

98243068


Table of Contents
  1. About The Project
  2. Getting Started
  3. Run Tests
  4. Contributing
  5. License
  6. Contact
  7. Acknowledgments

About The Project

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.

(back to top)

Built With

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.

(back to top)

Getting Started

This is an example of how you may give instructions on setting up your project locally. follow these simple example steps.

JAR_Files

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 .

compile jflex file (convert to java file)

  1. First in Terminal you should go to src/compiler directory
  2. you should use command like this for go to directory
     cd src/compiler
  3. then for compile you should use this command
    java -jar jflex-full-1.8.2.jar Scanner_Jflex.flex
    

compile CUP file

  1. First in Terminal you should go to src/compiler directory
  2. you should use command like this for go to directory
     cd src/compiler
  3. then for compile you should use this command
    java -jar java-cup-11b.jar Parser.cup
    

(back to top)

RUN_TESTS

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.

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the GNU General Public License v3.0 License. See LICENSE.txt for more information.

(back to top)

Contact

name :Mohammad mahdi noori

email : mohamadnoori123@gmail.com

Project Link: Link

(back to top)

Acknowledgments

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!

(back to top)

About

License:GNU General Public License v3.0


Languages

Language:Java 96.9%Language:Lex 3.1%