import edu.neu.ccs.demeterf.*; import edu.neu.ccs.demeterf.control.EdgeControl; import edu.neu.ccs.demeterf.util.Util; Main = ClassList Exp EOF. ClassDecl = "class" Ident Extend "{" + FieldList MethodDefs - *l "}" *l. MethodDefs = Constr MethodList. Extend: /*ClassExtend |*/ EmptyExtend. //ClassExtend = "extends" Ident. EmptyExtend = . Field = Type Ident ";". Method = Type Ident "(" FFormalList ")" "{" + MethodBody - *l "}" implements MethodI. FieldList: FieldCons | FieldEmpty implements List. FieldCons = *l Field FieldList implements ConsList. FieldEmpty = implements EmptyList. MethodList: MethodCons | MethodEmpty implements List. MethodCons = *l Method MethodList implements ConsList. MethodEmpty = implements EmptyList. Def = Type Ident "=" Exp ";" *l. MethodBody: DefCons | Return | RevDef. DefCons = Def MethodBody. Return = "return" *s Exp ";". Type: IntT | BoolT | UserT. IntT = "int". BoolT = "boolean". UserT = Ident. Constr = *l Ident "(" FFormalList ")" "{" + SuperConstr AssignList - *l "}" *l implements MethodI. SuperConstr: SuperCall | SuperEmpty. SuperCall = *l "super" "(" FExpList ")" ";". SuperEmpty = . Assign = VarExp *s "=" *s Exp ";" . Formal = Type Ident. AssignList: AssignCons | AssignEmpty implements List. AssignCons = *l Assign AssignList implements ConsList. AssignEmpty = implements EmptyList. FFormalList: FFormalCons | FFormalEmpty implements List. FFormalCons = Formal FormalList implements ConsList. FFormalEmpty = implements EmptyList. FormalList: FormalCons | FormalEmpty implements List. FormalCons = "," Formal FormalList implements ConsList. FormalEmpty = implements EmptyList. ClassList: ClassCons | ClassEmpty implements List. ClassCons = ClassDecl ClassList implements ConsList. ClassEmpty = implements EmptyList. Exp: Conjunct | AltExp. FExpList: FExpCons | FExpEmpty implements List. FExpCons = Exp ExpList implements ConsList. FExpEmpty = implements EmptyList. ExpList: ExpCons | ExpEmpty extends FExpList implements List. ExpCons = "," Exp ExpList implements ConsList. ExpEmpty = implements EmptyList. Conjunct = Compare ConjunctList implements ConjunctI. ConjunctList: ConjunctCons | ConjunctEmpty common implements ConjunctI. ConjunctCons = "&&" Compare ConjunctList implements ConsList. ConjunctEmpty = implements EmptyList. Compare = Term CompareList extends Exp implements CompareI. CompareList: CompareCons | CompareEmpty common implements CompareI. CompareCons = "<" Term CompareList implements ConsList. CompareEmpty = implements EmptyList. Term = Factor TermList extends Exp implements TermI. TermList: TermCons | TermEmpty common implements TermI. TermCons = "+" Factor TermList implements ConsList. TermEmpty = implements EmptyList. Factor = MethCall FactorList extends Exp implements FactorI. FactorList: FactorCons | FactorEmpty common implements FactorI. FactorCons = "*" MethCall FactorList implements ConsList. FactorEmpty = implements EmptyList. MethCall = Primary MethEnd extends Exp. MethEnd: Meth | MethEmpty. Meth = "." MethExp "(" FExpList ")". MethEmpty = implements EmptyList. Primary: Negate | ParenExp | IntLit | BoolLit | VarExp | IfExp | NewExp common extends Exp. Negate = "-" Exp. ParenExp = "(" Exp ")". IntLit = int. BoolLit = boolean. VarExp: SymExp | AddrExp. SymExp = Ident. AddrExp = " int ">". NewExp = "new" Type "(" FExpList ")". IfExp = "if" "(" Exp ")" "then" Exp "else" Exp. AltExp: AndExp | LessExp | AddExp | MultExp | NegExp | CallExp. AndExp = "(&& " Exp *s Exp ")" implements OpExp. LessExp = "(< " Exp *s Exp ")" implements OpExp. AddExp = "(+ " Exp *s Exp ")" implements OpExp. NegExp = "(- " Exp ")" implements OpExp. MultExp = "(* " Exp *s Exp ")" implements OpExp. MethExp: SymMethExp | AddrMethExp. SymMethExp = Ident. AddrMethExp = " int ">". CallExp = "(call (" Exp ")" "." MethExp "(" ExpList ")" ")". Value: IntV | BoolV | ObjV | NullV. NullV = "(NULL)". IntV = int. BoolV = boolean. ObjV = "(object " Type "," *s "[" ValueList "])". ValueList: ValueCons | ValueEmpty implements List. ValueCons = Value "," ValueList implements ConsList. ValueEmpty = implements EmptyList. RevDef = Exp RevDefRest. RevDefRest = Type Ident MethodBody. noparse TypePair = Type Type. MethDesc = String MethType FFormalList MethodBody. ConDesc = String MethType ValueList FFormalList AssignList. MethDescList: MethDescCons | MethDescEmpty implements List. MethDescCons = MethDesc "," *l MethDescList implements ConsList. MethDescEmpty = implements EmptyList. ConDescList: ConDescCons | ConDescEmpty implements List. ConDescCons = ConDesc "," *l ConDescList implements ConsList. ConDescEmpty = implements EmptyList. TypeList: TypeCons | TypeEmpty implements List. TypeCons = Type "," TypeList implements ConsList. TypeEmpty = implements EmptyList. ClassMeth = String MethDescList. ClassMethList: ClassMethCons | ClassMethEmpty implements List. ClassMethCons = ClassMeth ClassMethList implements ConsList. ClassMethEmpty = implements EmptyList. MethType = "(type " Type TypeList ")" extends Type. interface ConjunctI = . interface CompareI = . interface TermI = . interface FactorI = . interface OpExp = . interface MethodI = . interface List = . interface ConsList = . interface EmptyList = . RunErr = extends RuntimeException. TypeErr = extends RuntimeException. TransErr = extends RuntimeException.