PL_BEGIN(calculator example) The following example (located in _TT(parserlib/parserlib/test)) shows three parsers for a calculator grammar. _LN(#CY,_TT(CalcParse.T)) simply checks the grammar, _LN(#CPS,_TT(CalcParseStd.T)) evaluates the expressions, and _LN(#CPT,_TT(CalcParseTree.T)) prints the expressions in prefix form.

#define _HTX(n,x)


_A(n)_H(_TT(x)) #define _HT(n,x,y)
_A(n)_H(_TT(x) (used to generate _TT(y))) #define _HTE(n,x) _HT(n,x.e,x.i3) _HT(CT, Calc.t, CalcTok.i3) _Z_CT _HT(CL, Calc.l, CalcLex.i3) _Z_CL _HT(CY, Calc.y, CalcParse.i3) _Z_CY _HTE(CTS, CalcTokStd) _Z_CTS _HTE(CLS, CalcLexStd) _Z_CLS _HTE(CPS, CalcParseStd) _Z_CPS _HTE(CPT, CalcParseTree) _Z_CPT _HTX(MM, Main.m3) _Z_MM _HTX(MF, m3makefile) _Z_MF PL_END $Id: calc.html,v 1.2 2001-09-19 15:31:35 wagner Exp $ HTML_END