You're just showing off now :) Michael
On 25 February 2011 13:42, Terence Parr <[email protected]> wrote: > did a quick trial of java expression. i'll be damned if it doesn't seem to > work. sample input/output pairs below. > > Ter > -------------- > > e : '('! e ')'! > | 'this' > | 'super' > | INT > | ID > | type '.'^ 'class' > | e '.'^ ID > | e '.'^ 'this' > | e '.'^ 'super' '('^ expressionList? ')'! > | e '.'^ 'new'^ ID '('! expressionList? ')'! > | 'new'^ type ( '(' expressionList? ')'! | (options {k=1;}:'[' e ']'!)+) > | e '['^ e ']'! > | '('^ type ')'! e > | e ('++'^ | '--'^) > | e '('^ expressionList? ')'! > | ('+'^|'-'^|'++'^|'--'^) e > | ('~'^|'!'^) e > | e ('*'^|'/'^|'%'^) e > | e ('+'^|'-'^) e > | e ('<' '<' | '>' '>' '>' | '>' '>') e > | e ('<='^ | '>='^ | '>'^ | '<'^) e > | e 'instanceof'^ e > | e ('=='^ | '!='^) e > | e '&'^ e > | e '^'<assoc=right>^ e > | e '|'^ e > | e '&&'^ e > | e '||'^ e > // | e '?' e ':' e > | e ('='<assoc=right>^ > |'+='<assoc=right>^ > |'-='<assoc=right>^ > |'*='<assoc=right>^ > |'/='<assoc=right>^ > |'&='<assoc=right>^ > |'|='<assoc=right>^ > |'^='<assoc=right>^ > |'>>='<assoc=right>^ > |'>>>='<assoc=right>^ > |'<<='<assoc=right>^ > |'<<<='<assoc=right>^ > |'%='<assoc=right>^) e > ; > expressionList > : e (','! e)* > ; > type: ID > | ID '['^ ']'! > | 'int' > | 'int' '['^ ']'! > ; > > ------------- > > a -> a > 1 -> 1 > a+1 -> (+ a 1) > a*1 -> (* a 1) > a.b -> (. a b) > a-b+c -> (+ (- a b) c) > a+b*c -> (+ a (* b c)) > a.b+1 -> (+ (. a b) 1) > -a -> (- a) > -a+b -> (+ (- a) b) > -a.b -> (- (. a b)) > a^b^c -> (^ a (^ b c)) > a=b=c -> (= a (= b c)) > a=b=c+d.e -> (= a (= b (+ c (. d e)))) > a|b&c -> (| a (& b c)) > (a|b)&c -> (& (| a b) c) > (T)x -> (( T x) > new A().b -> (. (new A () b) > (T)t.f() -> (( (( T (. t f))) > a.f(x)==T.c -> (== (( (. a f) x) (. T c)) > a.f().g(x,1) -> (( (. (( (. a f)) g) x 1) > new T[((n-1) * x) + 1] -> (new T [ (+ (* (- n 1) x) 1)) > > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address > List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
