Browsable Pico Grammar

CC-BY

Grammar extracted by Vadim Zaytsev, see the Grammar Zoo entry for details: toy/pico/unknown/sdf/extracted
Source used for this grammar: Jurgen Vinju, Pico.sdf, Identifiers.sdf, Types.sdf, February 2006 – September 2007

Summary

Syntax

PROGRAM ::=
	"begin" DECLS (STATEMENT (";" STATEMENT)*)? "end"
DECLS ::=
	"declare" (ID-TYPE ("," ID-TYPE)*)? ";"
ID-TYPE ::=
	PICO-ID ":" TYPE
STATEMENT ::=
	PICO-ID ":=" EXP
STATEMENT ::=
	"if" EXP "then" (STATEMENT (";" STATEMENT)*)? "else" (STATEMENT (";" STATEMENT)*)? "fi"
STATEMENT ::=
	"while" EXP "do" (STATEMENT (";" STATEMENT)*)? "od"
EXP ::=
	PICO-ID
EXP ::=
	NatCon
EXP ::=
	StrCon
EXP ::=
	EXP "+" EXP
EXP ::=
	EXP "-" EXP
EXP ::=
	EXP "||" EXP
EXP ::=
	"(" EXP ")"
TYPE ::=
	"natural"
TYPE ::=
	"string"
TYPE ::=
	"nil-type"

GrammarLabMaintained by Dr. Vadim Zaytsev a.k.a. @grammarware. Last updated in September 2015. []