S - Intranet - Department of Computer Science: Login
S - Intranet - Department of Computer Science: Login
S - Intranet - Department of Computer Science: Login
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
A SableCC Grammar with transformations<br />
Followed by the productions:<br />
Productions<br />
grammar = exp_list {-> New grammar([exp_list.exp])};<br />
exp_list {-> exp*} = exp exp_list_tail* {-> [exp exp_list_tail.exp]};<br />
exp_list_tail {-> exp} = comma exp {-> exp};<br />
exp =<br />
{plus} exp plus factor {-> New exp.plus(exp, factor.exp) }<br />
| {minus} exp minus factor {-> New exp.minus(exp, factor.exp) }<br />
| {factor} factor {-> factor.exp}<br />
;<br />
factor {-> exp} =<br />
{mult} factor mult term {-> New exp.mult(factor.exp, term.exp )}<br />
| {div} factor div term {-> New exp.div(factor.exp, term.exp ) }<br />
| {term} term {-> term.exp}<br />
;<br />
term {-> exp} =<br />
{number} number {-> New exp.number(number)}<br />
| {exp} l_par exp r_par {-> exp}<br />
;<br />
74