Fixed problem with pl0.peg.

This commit is contained in:
yhirose 2015-07-29 21:48:28 -04:00
parent 5a09846a15
commit 8c029c07eb

View File

@ -1,18 +1,19 @@
program <- block '.' _ program <- _ block '.' _
block <- const var procedure statement block <- const var procedure statement
const <- ('CONST' _ ident '=' _ number (',' _ ident '=' _ number)* ';' _)? const <- ('CONST' _ ident '=' _ number (',' _ ident '=' _ number)* ';' _)?
var <- ('VAR' _ ident (',' _ ident)* ';' _)? var <- ('VAR' _ ident (',' _ ident)* ';' _)?
procedure <- ('PROCEDURE' _ ident ';' _ block ';' _)* procedure <- ('PROCEDURE' _ ident ';' _ block ';' _)*
statement <- (assignment / call / statements / if / while / write)? statement <- (assignment / call / statements / if / while / out / in)?
assignment <- ident ':=' _ expression assignment <- ident ':=' _ expression
call <- 'CALL' _ ident call <- 'CALL' _ ident
statements <- 'BEGIN' _ statement (';' _ statement )* 'END' _ statements <- 'BEGIN' _ statement (';' _ statement )* 'END' _
if <- 'IF' _ condition 'THEN' _ statement if <- 'IF' _ condition 'THEN' _ statement
while <- 'WHILE' _ condition 'DO' _ statement while <- 'WHILE' _ condition 'DO' _ statement
out <- '!' _ expression out <- '!' _ expression
in <- '?' _ ident
condition <- odd / compare condition <- odd / compare
odd <- 'ODD' _ expression odd <- 'ODD' _ expression