Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

op precedence pseudo-bnf

  • Loading branch information...
commit 9667c21e8be74652fe9accd1f4b997edac09eca8 1 parent 5940ac9
Sami Samhuri authored
Showing with 25 additions and 0 deletions.
  1. +25 −0 op-precedence.txt
25 op-precedence.txt
View
@@ -0,0 +1,25 @@
+keyword := 'if' | 'while' | 'until' | 'repeat' | 'for' | 'do' | 'break' |
+ 'print' | 'else' | 'end'
+identifier := /[a-zA-Z][[:alnum:]]+/
+number := /\d+/
+boolean-literal := 'true' | 'false'
+
+factor := '(' boolean-expression ')' | identifier | number
+signed-factor := '-' factor | '+' factor | factor
+term := signed-factor (/[*/]/ signed-factor)*
+arithmetic-expression := term (/[-+]/ term)*
+
+bit-op := '|' | '&' | '^'
+bit-expression := arithmetic-expression (bit-op arithmetic-expression)*
+
+rel-op := '==' | '!=' | '>' | '>=' | '<' | '<='
+relation := bit-expression (rel-op bit-expression)*
+
+boolean-factor := boolean-literal | relation
+not-factor := '!' boolean-factor | boolean-factor
+boolean-term := not-factor ('&&' not-factor)*
+boolean-expression := boolean-term ('||' boolean-term)*
+
+assignment := identifier '=' boolean-expression
+
+expression := assignment | boolean-expression
Please sign in to comment.
Something went wrong with that request. Please try again.