Simple Recursive Descent Parser

This is a parser for a very simple language, having expressions with four operators, assignment, variables and constants. The basic grammer is this:

AsstId:=Expr;
ExprExpr(+|)Term|Term
TermTerm(*|/)Fact|Fact
Factid|lit|(Expr)
But the parsing technique used, recursive descent, cannot tolerate left recursive rules. So we modify the grammer to:
AsstId:=Expr;
ExprTerm{(+|-)Term}
TermFact{(*|/)Fact}
Factid|lit|(Expr)
The idea is to build functions which match each left side symbol by trying to match the right-hand side. This program prints an abstract syntax for its input.