Idea:

Create a method for each  auxiliary.

The method is responsible for determining whether the next so many characters in the input stream  can be generated from that auxiliary.

 

For the S expression parser, there are two auxiliaries:

S         S expression

A         Atom

S  method

If  the next character in the input stream is

'('

parse multiple S's until next char is ')'

otherwise  try the A method.

If both fail, this method fails.

A  method

If the next character is

'a' or 'b' or 'c'

succeed,

otherwise fail.

[Usually A will be more comprehensive than this.]

 

To Next Slide To Previous Slide To Contents