Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- comment "//" ;
- comment "/*" "*/" ;
- comment "#" ;
- -----------------------------------------
- -- Programs
- -----------------------------------------
- PDefs. Program ::= [Def] ;
- separator nonempty Id ",";
- -----------------------------------------
- -- Definitions
- -----------------------------------------
- DQConst. Def ::= "using" QConst ";" ;
- DFun. Def ::= Type Id "(" [Arg] ")" Body ;
- DStat. Def ::= Stm2 ;
- terminator Def "" ;
- -----------------------------------------
- -- Argument
- -----------------------------------------
- ADecl. Arg ::= Type Id ;
- AType. Arg ::= Type ;
- separator Arg "," ;
- -----------------------------------------
- -- Body
- -----------------------------------------
- BStm. Body ::= "{" [Stm] "}" ;
- BEmpty. Body ::= ";" ;
- -----------------------------------------
- -- Declaration
- -----------------------------------------
- DDecl. Decl ::= Type [Var] ;
- DAss. Decl ::= Type Id "=" Exp ;
- DConst. Decl ::= "const" Type Id "=" Exp ;
- VVar. Var ::= Id ;
- separator Decl "," ;
- separator nonempty Var "," ;
- -----------------------------------------
- -- Statements
- -----------------------------------------
- STypeDef. Stm2 ::= "typedef" Type Id ";" ;
- SDecl. Stm2 ::= Decl ";" ;
- SExp. Stm ::= Exp ";" ;
- SEmpty. Stm ::= ";" ;
- SInit. Stm ::= Type Id "=" Exp ";" ;
- SReturn. Stm ::= "return" Exp ";" ;
- SWhile. Stm ::= "while" "(" Exp ")" Stm ;
- SBlock. Stm ::= "{" [Stm] "}" ;
- SIf. Stm ::= "if" "(" Exp ")" Stm ;
- SIfElse. Stm ::= "if" "(" Exp ")" Stm "else" Stm ;
- SQual. Stm ::= "using" QConst ";" ;
- coercions Stm 2 ;
- terminator Stm "" ;
- -----------------------------------------
- -- Expressions
- -----------------------------------------
- EInt. Exp16 ::= Integer ;
- EDouble. Exp16 ::= Double ;
- EChar. Exp16 ::= Char ;
- EString. Exp16 ::= [String] ;
- ETrue. Exp16 ::= "true";
- EFalse. Exp16 ::= "false";
- EConst. Exp15 ::= QConst ;
- EIndex. Exp15 ::= Id "[" Exp "]" ;
- ECall. Exp15 ::= Id "(" [Exp] ")" ;
- EMem. Exp14 ::= Exp14 "." Exp15 ;
- EFAccs. Exp14 ::= Exp14 "->" Exp15 ;
- EPostInc. Exp14 ::= Exp15 "++" ;
- EPostDec. Exp14 ::= Exp15 "--" ;
- EDeref. Exp14 ::= "*" Exp15 ;
- EPreInc. Exp13 ::= "++" Exp14 ;
- EPreDex. Exp13 ::= "--" Exp14 ;
- ENot. Exp13 ::= "!" Exp14 ;
- ENeg. Exp13 ::= "-" Exp14 ;
- EMul. Exp12 ::= Exp12 "*" Exp13 ;
- EDiv. Exp12 ::= Exp12 "/" Exp13 ;
- EMod. Exp12 ::= Exp12 "%" Exp13 ;
- EAdd. Exp11 ::= Exp11 "+" Exp12 ;
- ESub. Exp11 ::= Exp11 "-" Exp12 ;
- EShiftL. Exp10 ::= Exp10 "<<" Exp11 ;
- EShiftR. Exp10 ::= Exp10 ">>" Exp11 ;
- EGt. Exp9 ::= Exp9 ">" Exp10 ;
- ELt. Exp9 ::= Exp9 "<" Exp10 ;
- ELeq. Exp9 ::= Exp9 "<=" Exp10 ;
- EGeq. Exp9 ::= Exp9 ">=" Exp10 ;
- ENeq. Exp8 ::= Exp8 "!=" Exp9 ;
- EEq. Exp8 ::= Exp8 "==" Exp9 ;
- EAnd. Exp4 ::= Exp4 "&&" Exp5 ;
- EOr. Exp3 ::= Exp3 "||" Exp4 ;
- EAss. Exp2 ::= Exp3 "=" Exp2;
- EAssDec. Exp2 ::= Exp3 "-=" Exp2 ;
- EAssInc. Exp2 ::= Exp3 "+=" Exp2 ;
- EIfElse. Exp2 ::= Exp3 "?" Exp2 ":" Exp2 ;
- EThrow. Exp1 ::= "throw" Exp2 ;
- coercions Exp 16;
- separator Exp "," ;
- separator nonempty String "" ;
- -----------------------------------------
- -- Types
- -----------------------------------------
- Tbool. Type ::= "bool" ;
- Tdouble. Type ::= "double" ;
- Tint. Type ::= "int" ;
- Tvoid. Type ::= "void" ;
- Tconst. Type ::= QConst ;
- Tref. Type ::= Type "&" ;
- separator nonempty Type "," ;
- QCon. QConst ::= [Const] ;
- CId. Const ::= Id ;
- CTemp. Const ::= Id "<" [Type] ">" ;
- separator nonempty Const "::" ;
- position token Id (letter (letter | digit | '_')*) ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement