0
votes

I'm using antlr IDE for eclipse with antlr 3.4 and have created the following combined grammar to use on propositional logic

grammar Propositional;

options {
  language = Java;
}

@header {
  package antlr;
}

@lexer::header {
  package antlr;
}

formula:expression;

term 
    : ATOM
    | '(' expression ')'
    ;

negation
    : ('~')* term
    ;

and
    : negation (('^') negation)*
    ;

or
    : and (('|') and)*
    ;

implies
    : or (('>') or)*
    ;

expression
    : implies (('#') implies)*
    ;    

ATOM : 'a'..'z'+;
WS : (' ' | '\t')+ {$channel = HIDDEN;};

When I save it says build successful and the interpreter works exactly how I want however the lexer and parser which are generated have many problems such as missing throw statements or incorrect constructors.

Any help would be greatly appreciated, Thanks!

1
FYI: I could not reproduce it with ANTLR 3.4 from the command line or from ANTLRWorks that uses ANTLR 1.4.3.Bart Kiers

1 Answers

0
votes

Solved: A bit silly but it didn't like the package being called antlr