Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

op precedence pseudo-bnf

  • Loading branch information...
commit 9667c21e8be74652fe9accd1f4b997edac09eca8 1 parent 5940ac9
Sami Samhuri authored

Showing 1 changed file with 25 additions and 0 deletions. Show diff stats Hide diff stats

  1. +25 0 op-precedence.txt
25 op-precedence.txt
... ... @@ -0,0 +1,25 @@
  1 +keyword := 'if' | 'while' | 'until' | 'repeat' | 'for' | 'do' | 'break' |
  2 + 'print' | 'else' | 'end'
  3 +identifier := /[a-zA-Z][[:alnum:]]+/
  4 +number := /\d+/
  5 +boolean-literal := 'true' | 'false'
  6 +
  7 +factor := '(' boolean-expression ')' | identifier | number
  8 +signed-factor := '-' factor | '+' factor | factor
  9 +term := signed-factor (/[*/]/ signed-factor)*
  10 +arithmetic-expression := term (/[-+]/ term)*
  11 +
  12 +bit-op := '|' | '&' | '^'
  13 +bit-expression := arithmetic-expression (bit-op arithmetic-expression)*
  14 +
  15 +rel-op := '==' | '!=' | '>' | '>=' | '<' | '<='
  16 +relation := bit-expression (rel-op bit-expression)*
  17 +
  18 +boolean-factor := boolean-literal | relation
  19 +not-factor := '!' boolean-factor | boolean-factor
  20 +boolean-term := not-factor ('&&' not-factor)*
  21 +boolean-expression := boolean-term ('||' boolean-term)*
  22 +
  23 +assignment := identifier '=' boolean-expression
  24 +
  25 +expression := assignment | boolean-expression

0 comments on commit 9667c21

Please sign in to comment.
Something went wrong with that request. Please try again.