mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2024-12-22 11:55:30 +00:00
Fixed problem with pl0.peg.
This commit is contained in:
parent
5a09846a15
commit
8c029c07eb
@ -1,18 +1,19 @@
|
||||
|
||||
program <- block '.' _
|
||||
program <- _ block '.' _
|
||||
|
||||
block <- const var procedure statement
|
||||
const <- ('CONST' _ ident '=' _ number (',' _ ident '=' _ number)* ';' _)?
|
||||
var <- ('VAR' _ ident (',' _ ident)* ';' _)?
|
||||
procedure <- ('PROCEDURE' _ ident ';' _ block ';' _)*
|
||||
|
||||
statement <- (assignment / call / statements / if / while / write)?
|
||||
statement <- (assignment / call / statements / if / while / out / in)?
|
||||
assignment <- ident ':=' _ expression
|
||||
call <- 'CALL' _ ident
|
||||
statements <- 'BEGIN' _ statement (';' _ statement )* 'END' _
|
||||
if <- 'IF' _ condition 'THEN' _ statement
|
||||
while <- 'WHILE' _ condition 'DO' _ statement
|
||||
out <- '!' _ expression
|
||||
in <- '?' _ ident
|
||||
|
||||
condition <- odd / compare
|
||||
odd <- 'ODD' _ expression
|
||||
|
Loading…
Reference in New Issue
Block a user