bairui

Assignment Expression Grammar

Jun 26th, 2011
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. "Grammar for Jack Crenshaw's Assignment Expression Parser (Part 3):
  2. "<assignment> ::= <name> = <expression>
  3. "<expression> ::= <term> ( <add> | <subtract> )*
  4. "<subtract> ::= '-' <term>
  5. "<add> ::= '+' <term>
  6. "<term> ::= <factor> ( <multiply> | <divide> )*
  7. "<divide> ::= '/' <factor>
  8. "<multiply> ::= '*' <factor>
  9. "<factor> ::= <number> | '(' <expression> ')' | <ident>
  10. "<ident> ::= <func> | <name>
  11. "<func> ::= <name> '(' ')'
  12. "<name> ::= <alpha> <alphanum>*
  13. "<alpha> ::= [a-zA-Z_]
  14. "<alphanum> ::= <alpha> | <digit>
  15. "<number> ::= <digit>+
  16. "<digit> ::= [0-9]
Advertisement
Add Comment
Please, Sign In to add comment