Skip to content

pbaekgaard/ProjectP4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ProjectP4

  1. pip install antlr4-tools

  2. open antlr build.bat in the project folder

if you are experiencing bugs try to solutions here

How to use ANTLR to generate the parse tree

  1. Download antlr-4.12.0-complete.jar https://www.antlr.org/download.html

  2. SET CLASSPATH=.;C:\Users\krist\Desktop\antlrjar\antlr-4.12.0-complete.jar;%CLASSPATH%

  3. Add til path to bat filer: a => antlr4.bat og b => grun.bat

  • a:

    • java org.antlr.v4.Tool %*
  • b:

    • @ECHO OFF

    • SET TEST_CURRENT_DIR=%CLASSPATH:.;=%

    • if "%TEST_CURRENT_DIR%" == "%CLASSPATH%" ( SET CLASSPATH=.;%CLASSPATH% )

    • @ECHO ON

    • java org.antlr.v4.gui.TestRig %*

  1. (optional): test installationen: java org.antlr.v4.Tool

  2. cd til mappen med projektfiler

  3. antlr4 Grammar.g4

  4. javac Grammar*.java

  5. grun Grammar <grammar del der skal testes - ellers bare kør declarations> -gui

  • Hvis man vil have et træ skrevet ud i konsolen (som kan bruges til videre faser i compileren) => grun Grammar declarations -tree

  • Input her virker: if A2 + A3 then A3 + A4

  • Dernæst tryk CTRL Z for windows (CTRL D for Unix) => Tryk enter og den burde lave magi

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6