Skip to content

Commit

Permalink
Implement 'if' and add stubs for other statement_control
Browse files Browse the repository at this point in the history
  • Loading branch information
bacek committed Feb 23, 2011
1 parent ddbfa71 commit 46077d7
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions compilers/opsc/src/Ops/Compiler/Actions.pm
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,31 @@ method term:sym<float_constant_long> ($/) { # longer to work-around lack of LTM
:returns<float>
);
}


method statement_control:sym<if> ($/) {
my $past := PAST::Op.new(
:pasttype<if>,

$<EXPR>.ast,
$<then>.ast,
);

$past.push($<else>.ast) if $<else>;

make $past;
}

method statement_control:sym<while> ($/) {
}

method statement_control:sym<for> ($/) {
}

# Not real "C" switch. Just close enough
method statement_control:sym<switch> ($/) {
}

# Local Variables:
# mode: perl6
# fill-column: 100
Expand Down

0 comments on commit 46077d7

Please sign in to comment.