Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
compile methods to anonymous PIR subs
  • Loading branch information
moritz committed May 13, 2011
1 parent ad31d07 commit bb72006
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/HLL/Grammar.pm
Expand Up @@ -570,7 +570,6 @@ An operator precedence parser.
here.'!cursor_debug'('START', 'EXPR')
debug_1:

.const 'Sub' reduce = 'EXPR_reduce'
.local string termishrx
termishrx = 'termish'

Expand Down Expand Up @@ -679,17 +678,15 @@ An operator precedence parser.
$P0 = $P0['O']
opprec = $P0['prec']
unless opprec > inprec goto reduce_gt_done
capture_lex reduce
self.reduce(termstack, opstack)
self.'EXPR_reduce'(termstack, opstack)
goto reduce_loop
reduce_gt_done:

unless opprec == inprec goto reduce_done
# equal precedence, use associativity to decide
unless inassoc == 'left' goto reduce_done
# left associative, reduce immediately
capture_lex reduce
self.reduce(termstack, opstack)
self.'EXPR_reduce'(termstack, opstack)
reduce_done:

push opstack, infix # The Shift
Expand All @@ -699,8 +696,7 @@ An operator precedence parser.

opstack_loop:
unless opstack goto opstack_done
capture_lex reduce
self.reduce(termstack, opstack)
self.'EXPR_reduce'(termstack, opstack)
goto opstack_loop
opstack_done:

Expand Down
6 changes: 6 additions & 0 deletions src/NQP/Actions.pm
Expand Up @@ -809,6 +809,12 @@ class NQP::Actions is HLL::Actions {
# Install it in the package also if needed.
if $*SCOPE eq 'our' {
$*SC.install_package_routine($*PACKAGE, $name, $past);
} else {
if $past.pirflags() {
$past.pirflags(~$past.pirflags() ~ ":anon");
} else {
$past.pirflags(":anon");
}
}
}

Expand Down

0 comments on commit bb72006

Please sign in to comment.