Advertisement
Ai4rei

!calc PEG

Oct 5th, 2016
3,189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PCRE 0.60 KB | None | 0 0
  1. expr            <- subexpr
  2. subexpr         <- operation | subexpr_notop
  3. subexpr_notop   <- function | '(' subexpr ')' | literal
  4. literal         <- decimal | hexadecimal | 'true' | 'false'
  5. decimal         <- [0-9]+ ( '.' [0-9]* )?
  6. hexadecimal     <- '0x' [0-9a-fA-F]+
  7. operation       <- ( unary_operator subexpr ) | ( subexpr_notop binary_operator subexpr )
  8. binary_operator <- '+' | '-' | '*' | '/' | '%' | '^' | '&' | '|' | '==' '='? | '!=' '='? | '<' | '>' | '<=' | '>='
  9. unary_operator  <- '-' | '~'
  10. function        <- function_name '(' ( subexpr ( ',' subexpr )* )? ')'
  11. function_name   <- [a-z][a-z0-9]*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement