Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

Commit

Permalink
Use keywords in sample grammars
Browse files Browse the repository at this point in the history
  • Loading branch information
cglong committed May 2, 2012
1 parent da864cf commit e06ab69
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Grammars/tiny.txt
@@ -1,4 +1,4 @@
%Tokens begin end print read ( ) ; ID := , INTNUM + - * %
%Tokens begin end print read LEFTPAR RIGHTPAR SEMICOLON ID ASSIGN COMMA INTNUM PLUS MINUS MULTIPLY MODULO
%Non-terminals <Tiny-program> <statement-list> <statement> <id-list> <exp-list> <exp> <bin-op>
%Start <Tiny-program>
%Rules
Expand Down
2 changes: 1 addition & 1 deletion Grammars/tiny_new.txt
@@ -1,4 +1,4 @@
%Tokens begin end print read ( ) ; ID := , INTNUM + - * %
%Tokens begin end print read LEFTPAR RIGHTPAR SEMICOLON ID ASSIGN COMMA INTNUM PLUS MINUS MULTIPLY MODULO
%Non-terminals <Tiny-program> <statement-list> <statement> <id-list> <exp-list> <exp-arith> <exp-mul> <exp-mod> <term>
%Start <Tiny-program>
%Rules
Expand Down
2 changes: 2 additions & 0 deletions src/com/github/cglong/Grammartizer/GrammarReader.java
Expand Up @@ -43,6 +43,8 @@ else if(words[a].equals("ASSIGN"))
t = new Terminal(":=");
else if(words[a].equals("COMMA"))
t = new Terminal(",");
else if(words[a].equals("SEMICOLON"))
t = new Terminal(";");
else if(words[a].equals("PLUS"))
t = new Terminal("+");
else if(words[a].equals("MINUS"))
Expand Down

0 comments on commit e06ab69

Please sign in to comment.