java parser generator
home
features
documentation
grammars
downloads
site originally designed by ninth ave

Package org . sablecc . pascal ;

Helpers

a = 'a' | 'A'
b = 'b' | 'B'
d = 'd' | 'D'
e = 'e' | 'E'
g = 'g' | 'g'
i = 'i' | 'I'
l = 'l' | 'L'
m = 'm' | 'M'
n = 'n' | 'N'
o = 'o' | 'O'
p = 'p' | 'P'
r = 'r' | 'R'
t = 't' | 'T'
v = 'v' | 'V'
w = 'w' | 'W'
l_curly_bracket = '{'
r_curly_bracket = '}'
ascii_char = [ 32 .. 127 ]
letter = [ [ 'a' .. 'z' ] + [ 'A' .. 'Z' ] ]
digit = [ '0' .. '9' ]
tab = 9
cr = 13
lf = 10
blank = ' '

Tokens

end = e n d
div = d i v
var = v a r
begin = b e g i n
program = p r o g r a m
writeln = w r i t e l n
integer = i n t e g e r
plus = '+'
minus = '-'
mult = '*'
assignop = ':='
comma = ','
colon = ':'
semicolon = ';'
dot = '.'
l_paren = '('
r_paren = ')'
identifier = letter ( letter | digit ) *
number = digit +
comment = l_curly_bracket [ ascii_char - [ l_curly_bracket + r_curly_bracket ] ] * r_curly_bracket
blanks = blank | cr lf | cr | lf | tab

Ignored Tokens

Productions

program =
program_heading declarations body dot
program_heading =
T . program identifier semicolon
declarations =
variables_declaration ?
variables_declaration =
var variables_definition_list
variables_definition_list =
{single} variables_definition
| {multiple} variables_definition_list variables_definition
variables_definition =
identifier_list colon type semicolon
identifier_list =
{single} identifier
| {multiple} identifier_list comma identifier
type =
integer
body =
begin statement_sequence end
statement_sequence =
{single} statement
| {multiple} statement_sequence semicolon statement
statement =
{writeln} writeln l_paren expression r_paren
| {assignment} identifier assignop expression
| {empty}
expression =
{term} term
| {plus} expression plus term
| {minus} expression minus term
term =
{factor} factor
| {mult} term mult factor
| {div} term div factor
factor =
{identifier} identifier
| {number} number
| {expression} l_paren expression r_paren
This site has been last updated by the web master on 2007/6/24.