Skip to content

Loading…

Fixed PCT tutorial episode-3 #124

Closed
wants to merge 2 commits into from

2 participants

@HashNuke

Added instructions to remove 2 methods and removed an invalid exercise and it's solution.

HashNuke added some commits
@HashNuke HashNuke Removed exercise-1 in PCT Tutorial episode-3. Methods are already bei…
…ng added by the user

Signed-off-by: Akash Manohar J <akash@akash.im>
8e2e874
@HashNuke HashNuke added instructions in PCT episode-3 to remove methods for term:sym<in…
…teger> and term:sym<quote>

Signed-off-by: Akash Manohar J <akash@akash.im>
d559335
@leto
Parrot Virtual Machine member

Merged.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 16, 2011
  1. @HashNuke

    Removed exercise-1 in PCT Tutorial episode-3. Methods are already bei…

    HashNuke committed
    …ng added by the user
    
    Signed-off-by: Akash Manohar J <akash@akash.im>
  2. @HashNuke

    added instructions in PCT episode-3 to remove methods for term:sym<in…

    HashNuke committed
    …teger> and term:sym<quote>
    
    Signed-off-by: Akash Manohar J <akash@akash.im>
Showing with 10 additions and 22 deletions.
  1. +10 −22 examples/languages/squaak/doc/tutorial_episode_3.pod
View
32 examples/languages/squaak/doc/tutorial_episode_3.pod
@@ -196,8 +196,8 @@ Rename the token C<< term:sym<integer> >> to C<< term:sym<integer_constant> >> a
C<< term:sym<quote> >> to C<< term:sym<string_constant> >> (to better match our
language specification).
-Add action methods for term:sym<integer_constant> and term:sym<string_constant>
-to F<src/Squaak/Actions.pm>:
+In F<src/Squaak/Actions.pm> remove action methods for term:sym<integer> and term:sym<quote>
+in and add action methods for term:sym<integer_constant> and term:sym<string_constant>:
method term:sym<integer_constant>($/) {
make PAST::Val.new(:value($<integer>.ast), :returns<Integer>);
@@ -305,36 +305,31 @@ Squaak.
=item 1.
-Rename the names of the action methods according to the name changes we made on
-the grammar rules. So, "integer" becomes "integer_constant", and so on.
-
-=item 2.
-
Look at the grammar rule for statement. A statement currently consists of an
assignment. Implement the action method "statement" to retrieve the result
object of this assignment and set it as statement's result object using the
special make function. Do the same for rule primary.
-=item 3.
+=item 2.
Write the action method for the rule identifier. As a result object of this
"match", a new PAST::Var node should be set, taking as name a string
representation of the match object ($/). For now, you can set the scope to
'package'. See "pdd26: ast" for details on PAST::Var nodes.
-=item 4.
+=item 3.
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 5.
+=item 4.
Write the action method for stat_or_def. Simply retrieve the result object from statement and make
that the result object.
-=item 6.
+=item 5.
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".
@@ -384,13 +379,6 @@ the end of Episode 2, and the latter didn't have any coding assignments).
=item 1
-Rename the names of the action methods according to the name changes we made
-on the grammar rules. So, "integer" becomes "integer_constant", and so on.
-
-I assume you don't need any help with this.
-
-=item 2
-
Look at the grammar rule for statement. A statement currently consists of an
assignment. Implement the action method "statement" to retrieve the result
object of this assignment and set it as statement's result object using the
@@ -404,7 +392,7 @@ special make function. Do the same for rule primary.
make $<identifier>.ast;
}
-=item 3
+=item 2
Write the action method for the rule identifier. As a result object of this
"match", a new C<PAST::Var> node should be set, taking as name a string
@@ -415,7 +403,7 @@ representation of the match object ($/). For now, you can set the scope to
make PAST::Var.new( :name(~$/), :scope('package'), :node($/) );
}
-=item 4
+=item 3
Write the action method for assignment. Retrieve the result objects for
"primary" and for "expression", and create a C<PAST::Op> node that binds the
@@ -431,7 +419,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 5
+=item 4
Write the action method for stat_or_def. Simply retrieve the result object from statement and make
that the result object.
@@ -440,7 +428,7 @@ that the result object.
make $<statement>.ast;
}
-=item 6
+=item 5
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".
Something went wrong with that request. Please try again.