Closed joagre closed 11 months ago
I tried to write a grammar to parse the following toy example:
switch 1 { case 2: 3, 42 case 4: 5 }
I tried with the following but it is not the way to do it:
SwitchStmt <- "switch" _ Expr _ "{" _ CaseStmt+ _ "}" CaseStmt <- "case" _ Expr _ ":" _ ExprList ExprList <- Expr (_ "," _ Expr)* Expr <- [0-9]+ _ <- WS* WS <- " " / "\t" / "\n" / "\r"
Any hints?
Cheers /J
I tried to write a grammar to parse the following toy example:
I tried with the following but it is not the way to do it:
Any hints?
Cheers /J