Skip to content
This repository was archived by the owner on Sep 23, 2023. It is now read-only.

modos/cool-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cool Language Parser

This is phase #2 of complier course project at shahid beheshti university.

see Phase 1.

to draw graphs and export parser you should use PGen.

Screenshots


How To Run


  1. Run PGen
java -jar PGen-2.2.1.jar
  1. Create a new project and draw your graphs, then save it somewhere.

  2. in the parser menu, click on 'Export Full Parser' and choose a folder so it generates a parser based on your graphs. if graphs have issues it shows you, you must fix them first.

  3. put the exported files in the parser folder in the src foler beside the CodeGen.java file.

  4. Put your scanner files in the scanner folder

  5. in Main.java, import parser, scanner and codeGen (codeGen here is not used but required for running project, codeGen codes developed in the next phase).

CompilerScanner scanner = new CompilerScanner(new FileReader(inputCoolFilePath));
CodeGen codeGen = new CodeGen();
Parser parser = new Parser(scanner, codeGen, "src/parser/table.npt");
  1. create your input file with .cool extension in the test/in folder

  2. Run Main.java

java <javaClassFile> --input <inputCoolFilePath> --output <outputFilePath> --table <tablePath>

it creates output file in the test/out and show you the syntax in the input file is correct or wrong. you can use script_java.sh instead.

About

cool language parser - compiler project

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors