Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Ep3: make primary a term.
  • Loading branch information
tcurtis committed Jul 20, 2010
1 parent b59e109 commit 9a16402
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doc/tutorial_episode_3.pod
Expand Up @@ -188,6 +188,10 @@ Add these rules:
|'not'|'or' |'sub' |'throw'|'try' |'var'|'while']>>
}

token term:sym<primary> {
<primary>
}

Rename the token C<term:sym<integer> > as C<term:sym<integer_constant> >, and C<term:sym<quote> > as
C<term:sym<string_constant> > (to better match our language specification).

Expand All @@ -201,6 +205,9 @@ Add action methods for term:sym<integer_constant> and term:sym<string_constant>:
method term:sym<string_constant>($/) {
make PAST::Val.new(:value($<quote>.ast), :returns<String>);
}
method term:sym<primary>($/) {
make $<primary>.ast;
}

PAST::Val nodes are used the represent constant values.

Expand Down

0 comments on commit 9a16402

Please sign in to comment.