Browsable Pico Grammar

CC-BY

Grammar connected by Vadim Zaytsev, see the Grammar Zoo entry for details: toy/pico/unknown/sdf/connected
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
TYPE ::=
	"natural"
	"string"
	"nil-type"
STATEMENT ::=
	PICO-ID ":=" EXP
	"if" EXP "then" (STATEMENT (";" STATEMENT)*)? "else" (STATEMENT (";" STATEMENT)*)? "fi"
	"while" EXP "do" (STATEMENT (";" STATEMENT)*)? "od"
EXP ::=
	PICO-ID
	NatCon
	StrCon
	EXP "+" EXP
	EXP "-" EXP
	EXP "||" EXP
	"(" EXP ")"

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