smarter Makefile, fixed grammar

git-svn-id: svn://anubis/gvsu@113 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
josh 2008-06-01 19:18:51 +00:00
parent b6a5a19e1e
commit daae9b09b4
3 changed files with 9 additions and 7 deletions

View File

@ -1,12 +1,13 @@
PKG := jholtrop.gvsu.cs675.bottomup
PKGPATH := $(subst .,/,$(PKG))
PARSER := $(PKGPATH)/parser/Parser.java
GRAMMAR := arithmetic.grammar
all: sablecc prog
all: $(PARSER) prog
.PHONY: sablecc
sablecc:
sablecc arithmetic.grammar
$(PARSER): $(GRAMMAR)
sablecc $(GRAMMAR)
.PHONY: prog
prog:

View File

@ -3,7 +3,7 @@ Package jholtrop.gvsu.cs675.bottomup;
Tokens
blank = (' ' | 9 | 10 | 13);
number = ['0' .. '9']+ ('.' ['0' .. '9']+)?;
number = ['0' .. '9']+;
plus = '+';
minus = '-';
multiply = '*';
@ -22,7 +22,8 @@ Productions
term =
{multiplication} term multiply factor |
{division} term divide factor;
{division} term divide factor |
{factor} factor;
factor =
{number} number |

View File

@ -26,7 +26,7 @@ public class Evaluator
}
catch (Exception e)
{
System.out.println(e.getMessage());
System.out.println("Error: " + e.getMessage());
}
}
}