The left hand side

The left hand side of rewriting rules contains a pattern. Normal words are simply matched directly. Metasyntax is introduced using a dollar sign. The metasymbols are:

$* Match zero or more tokens
$+ Match one or more tokens
$- Match exactly one token
$=x Match any phrase in class x
$~x Match any word not in class x
If any of these match, they are assigned to the symbol $ n for replacement on the right hand side, where n is the index in the LHS. For example, if the LHS:
is applied to the input:
the rule will match, and the values passed to the RHS will be:

$2 eric

Additionally, the LHS can include $@ to match zero tokens. This is not bound to a $ n on the RHS, and is normally only used when it stands alone in order to match the null input.

[Contents] [Previous] [Next]

Questions or problems regarding this web site should be directed to Steve Gielda.
Copyright 1999  All rights reserved.
Last modified: Friday April 02, 1999.