Question: When the description of a problem gets this complicated, it is a good idea to attempt a more formal specification. The following table describes a
When the description of a problem gets this complicated, it is a good idea to attempt a more formal specification. The following table describes a grammar of patterns, using the same grammar rule format described in chapter 2.
pat + var match any one expression constant match just this atom segment-pat match something against a sequence single-pat match something against one expression
( p a t . pat) match the first and the rest single-pat =+ ( ? i s var predicate 1 test predicate on one expression
(?or pat ... 1 match any pattern on one expression
( ?and pat ... > match every pattern on one expression
( ?not pat ... 1 succeed if pattern(s) do not match segment-pat + ( ( ?* var) ... ) match zero or more expressions
((?+var) ...I match one or more expressions
( (?? var) ... 1 match zero or one expression
((?if exp) ...I test if exp (which may contain variables) is true var + ?chars constant -i atom a symbol starting with ?
any nonvariable atom
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
