DashAB Setup Instructions

[Prev ][Up ]

3.5 Configuring first project

  1. Click Create new project
  2. Select Java Project and then next to Project SDK select New -> JDK
  3. The installation process will give you an interactive interface (similar to finder) to locate the file. At the very top of the window select "Computer", then follow the directory path Macintosh
    HD/Library/Java/JavaVirtualMachines

    and select the folder jdk1.8.0_45.jdk (or whichever is the current version that you are installing).

  4. Click Next then click Next again.
  5. Name your project and click Finish
  6. Open Project manager (Default hotkey CMD-1)
  7. In the project menu that you just opened right-click on the src folder -> New -> File
  8. name the file
    hello.g4
  9. In the new file put the following content
    grammar hello; 
     
    rule: 'hello' id; 
    id  : STRING; 
     
    STRING: CHAR+; 
    CHAR: [a-z|A-Z]; 
    WS: ' '+ -> skip;
  10. CLTR-click on rule -> select Test Rule rule
  11. There are three new boxes that open:
    1. a small that appears to be to input a file name
    2. a larger one underneath
    3. To the right of that there is a box on top of which is "Parse tree | Profiler"

    in the second box type

    hello <your name>

    in the third box a tree should appear a parse tree

  12. Congratulations you’ve made your first Antlr4 parser