Advertisement
Guest User

Untitled

a guest
May 24th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
BNF 2.76 KB | None | 0 0
  1. <Statement> := ' '* (<Control> | <Operation | <Assignment>) ' '* ';'
  2. <Control> := 'if(' <CompoundBooleanOperation> ')' '\n'* '{' '\n'* <Statement>* '\n'* '}' ('\n'* 'else' '\n'* '{' <Statement>* '\n'* '}')?  | 'while(' <BooleanOp> ')' '\n'* '{' '\n'* <Statement>* '\n'* '}'
  3. <Operation> := <String> '(' ((<MathOperation> | <RealNumber> | <Variable>) (',' (<MathOperation> | <RealNumber> | <Variable>))*)? ')'
  4. <Assignment> := <Variable> ' '* '=' ' '* (<MathOperation> | <RealNumber>)
  5. <MathOperation> := <Variable> ' '* <BinaryMathOp> ' '* <Variable> | <Variable> ' '* <BinaryMathOp> ' '* <RealNumber> | <Variable> ' '* <BinaryMathOp> ' '* <MathOperation> | <Variable> ' '* <BinaryMathOp> ' '* <ParenthesisMathOp> | <RealNumber> ' '* <BinaryMathOp> ' '* <Variable> | <RealNumber> ' '* <BinaryMathOp> ' '* <RealNumber> | <RealNumber> ' '* <BinaryMathOp> ' '* <MathOperation> | <RealNumber> ' '* <BinaryMathOp> ' '* <ParenthesisMathOp> | <MathOperation> ' '* <BinaryMathOp> ' '* <Variable> | <MathOperation> ' '* <BinaryMathOp> ' '* <RealNumber> | <MathOperation> ' '* <BinaryMathOp> ' '* <MathOperation> | <MathOperation> ' '* <BinaryMathOp> ' '* <ParenthesisMathOp> | <ParenthesisMathOp> ' '* <BinaryMathOp> ' '* <Variable> | <ParenthesisMathOp> ' '* <BinaryMathOp> ' '* <RealNumber> | <ParenthesisMathOp> ' '* <BinaryMathOp> ' '* <MathOperation> | <ParenthesisMathOp> ' '* <BinaryMathOp> ' '* <ParenthesisMathOp>
  6. <ParenthesisMathOp> := '(' (<MathOperation> | <Variable> | <RealNumber>) ')'
  7. <Variable> := <String>
  8. <CompoundBooleanOperation> := <BooleanOperation> | <UnaryLogicalOp> '(' <BooleanOperation> ')'  | <CompoundBooleanOperation> <BinaryLogicalOp> <CompoundBooleanOperation>
  9. <BinaryLogicalOp> := '&&' | '||' '^'
  10. <UnaryLogicalOp> := '!'
  11. <BooleanOperation> := <Variable> <BooleanOp> <Variable> | <Variable> <BooleanOp> <RealNumber> | <Variable> <BooleanOp> <MathOperation> | <RealNumber> <BooleanOp> <Variable> | <RealNumber> <BooleanOp> <RealNumber> | <RealNumber> <BooleanOp> <MathOperation> | <MathOperation> <BooleanOp> <Variable> | <MathOperation> <BooleanOp> <RealNumber> | <MathOperation> <BooleanOp> <MathOperation>
  12. <BooleanOp> := '==' | '!=' | '<' | '>' | '>=' | '<='
  13. <RealNumber> := <DigitList> | <DigitList> '.' <DigitList> | '-' <DigitList> | '-' <DigitList> '.' <DigitList>
  14. <DigitList> := <Digit> | <Digit> <DigitList>
  15. <Digit> := '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
  16. <String> := <Character> | <Character> <String>
  17. <Character> := 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | 'A' | 'B' | 'C' | 'D' | 'E' 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z'
  18. <BinaryMathOp> := '+' | '-' | '*' | '/'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement