/* simpas.fg -- a simple pretzel example */

%token SEMI BINOP IF THEN ELSE BEG END NUM ID

%%

stmt_list : stmt
	| stmt_list SEMI stmt       { $1 $2 force $3 }
;
stmt    : IF exp THEN stmt          { $1 " $" $2 "$ " $3 " " indent $4
                                      outdent }
        | IF exp THEN stmt ELSE stmt
                                    { $1 " $" $2 "$ " $3 indent force
                                      $4 outdent force
                                      $5 indent force $6 outdent force }

        | BEG stmt_list END         { $1 " " $2 " " $3 }
        | exp			    { "$" $1 "$" }
;
exp     : ID
        | NUM
        | exp BINOP exp
;
