From 5225c4e292e201a46b3535cf177830a35555c259 Mon Sep 17 00:00:00 2001 From: tcurtis Date: Mon, 19 Jul 2010 18:30:38 -0500 Subject: [PATCH] Update explicit mention of expression in Ep 3 to EXPR. --- doc/tutorial_episode_3.pod | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/doc/tutorial_episode_3.pod b/doc/tutorial_episode_3.pod index 869d9d2..23bff8a 100644 --- a/doc/tutorial_episode_3.pod +++ b/doc/tutorial_episode_3.pod @@ -183,7 +183,7 @@ Add these rules: } rule assignment { - '=' + '=' } rule primary { @@ -194,18 +194,13 @@ Add these rules: } - rule expression { - | - | - } - token keyword { ['and'|'catch'|'do' |'else' |'end' |'for' |'if' |'not'|'or' |'sub' |'throw'|'try' |'var'|'while']>> } -Rename the token C > as C, and C > as -C (to better match our language specification). +Rename the token C > as C >, and C > as +C > (to better match our language specification). Finally, remove the rules C, C >, and >. @@ -312,20 +307,16 @@ representation of the match object ($/). For now, you can set the scope to =item 4. -Write the action method for expression. If the integer_constant subrule matched, retrieve its result object; otherwise, retrieve the string_constant subrule's result object. - -=item 5. - Write the action method for assignment. Retrieve the result objects for "primary" and for "expression", and create a PAST::Op node that binds the expression to the primary. (Check out pdd26 for PAST::Op node types, and find out how you do such a binding). -=item 6. +=item 5. Write the action method for stat_or_def. Simply retrieve the result object from statement and make that the result object. -=item 7. +=item 6. 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". @@ -406,14 +397,6 @@ representation of the match object ($/). For now, you can set the scope to =item 4 -Write the action method for expression. If the integer_constant subrule matched, retrieve its result object; otherwise, retrieve the string_constant subrule's result object. - - method expression($/) { - make $ ?? $.ast !! .ast; - } - -=item 5 - Write the action method for assignment. Retrieve the result objects for "primary" and for "expression", and create a C node that binds the expression to the primary. (Check out pdd26 for C node types, and @@ -428,7 +411,7 @@ find out how you do such a binding). Note that we set the lvalue flag on $lhs. See PDD26 for details on this flag. -=item 6 +=item 5 Write the action method for stat_or_def. Simply retrieve the result object from statement and make that the result object. @@ -436,7 +419,7 @@ Write the action method for stat_or_def. Simply retrieve the result object from make $.ast; } -=item 7 +=item 6 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".