Skip to content
Permalink
Browse files

#154. Added casting to grammar.

  • Loading branch information...
AZHenley committed Oct 2, 2019
1 parent 46b7a05 commit ac8b3f633f1e4194407f8826e447ef516a9347a9
Showing with 4 additions and 1 deletion.
  1. +4 −1 grammar.txt
@@ -27,7 +27,8 @@ argList = "(" [expr {"," expr}] ")"

expr = logical
logical = equality {("&&" | "||") equality}
equality = comparison {("!=" | "==") comparison } ;
equality = cast {("!=" | "==") cast}
cast = comparison {"as" ident}
comparison = addition {(">" | ">=" | "<" | "<=") addition}
addition = multiplication {( "-" | "+" ) multiplication}
multiplication = unary {( "/" | "*" ) unary}
@@ -38,4 +39,6 @@ special = primary | "new" varType | "typeof" "(" expr ")"
listLiteral = "[" [expr {"," expr}] "]"
primary = ident | int | float | string | "false" | "true" | "nil" | listLiteral

// Consider moving "(" expr ")" into primary from paran.

// Missing... interfaces, switch, contracts, typedef, typeof operator, casting, several literals (byte, hex, rune, char), function pointers, import, module, concurrency

0 comments on commit ac8b3f6

Please sign in to comment.
You can’t perform that action at this time.