Skip to content

Commit

Permalink
Refactor to be more correct to the grammar in Ep 3.
Browse files Browse the repository at this point in the history
  • Loading branch information
tcurtis committed Jul 19, 2010
1 parent abe0ce4 commit cde4870
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions doc/tutorial_episode_3.pod
Expand Up @@ -168,8 +168,20 @@ started. Replace the C<statement> rule with this rule:
<assignment>
}

Replace the statementlist rule with this:

rule statement_list {
<stat_or_def>*
}

When you work on the action methods later, you'll also want to replace $<statement> in the action method with $<stat_or_def>

Add these rules:

rule stat_or_def {
<statement>
}

rule assignment {
<primary> '=' <expression>
}
Expand Down Expand Up @@ -311,6 +323,10 @@ out how you do such a binding).

=item 6.

Write the action method for stat_or_def. Simply retrieve the result object from statement and make that the result object.

=item 7.

Run your compiler on a script or in interactive mode. Use the target option to
see what PIR is being generated on the input "x = 42".

Expand Down Expand Up @@ -414,6 +430,14 @@ Note that we set the lvalue flag on $lhs. See PDD26 for details on this flag.

=item 6

Write the action method for stat_or_def. Simply retrieve the result object from statement and make that the result object.

method stat_or_def {
make $<statement>.ast;
}

=item 7

Run your compiler on a script or in interactive mode. Use the target option to
see what PIR is being generated on the input "x = 42".

Expand Down

0 comments on commit cde4870

Please sign in to comment.