Skip to content
This repository has been archived by the owner on Jun 9, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Now, works with Parrot r37824 (PGE merge)
COMPATIBILITY BREAK
  • Loading branch information
fperrad committed Mar 31, 2009
1 parent 920c8a2 commit 73ef9d9
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 34 deletions.
26 changes: 13 additions & 13 deletions src/PASTGrammar.tg
Expand Up @@ -201,7 +201,7 @@ transform past (Lua::Grammar::fornum) :language('PIR') {
symbtab = get_hll_global ['Lua';'PAST'], '$symbtab'
symbtab.'push_scope'()
$P0 = node['Name']
$S0 = $P0.'result_object'()
$S0 = $P0.'ast'()
.local pmc name
$S1 = symbtab.'insert'($S0)
$P0 = get_hll_global ['PAST'], 'Var'
Expand Down Expand Up @@ -242,7 +242,7 @@ transform past (Lua::Grammar::forlist) :language('PIR') {
L1:
unless iter goto L2
$P0 = shift iter
$S0 = $P0.'result_object'()
$S0 = $P0.'ast'()
$S1 = symbtab.'insert'($S0)
$P0 = get_hll_global ['PAST'], 'Var'
cpast = $P0.'new'('node'=>node, 'name'=>$S1, 'scope'=>'lexical', 'isdecl'=>1, 'lvalue'=>1)
Expand Down Expand Up @@ -285,7 +285,7 @@ transform past (Lua::Grammar::local_declaration) :language('PIR') {
L3:
unless iter goto L4
$P0 = shift iter
$S0 = $P0.'result_object'()
$S0 = $P0.'ast'()
$S1 = symbtab.'insert'($S0)
$P0 = get_hll_global ['PAST'], 'Var'
cpast = $P0.'new'('node'=>node, 'name'=>$S1, 'scope'=>'lexical', 'isdecl'=>1, 'lvalue'=>1)
Expand All @@ -302,7 +302,7 @@ transform past (Lua::Grammar::local_function) :language('PIR') {
symbtab = get_hll_global ['Lua';'PAST'], '$symbtab'
.local pmc var
$P0 = node['Name']
$S0 = $P0.'result_object'()
$S0 = $P0.'ast'()
$S1 = symbtab.'insert'($S0)
$P1 = get_hll_global ['PAST'], 'Var'
var = $P1.'new'('node'=>$P0, 'name'=>$S1, 'scope'=>'lexical', 'isdecl'=>1, 'lvalue'=>1)
Expand Down Expand Up @@ -420,7 +420,7 @@ transform past (Lua::Grammar::function_stat) :language('PIR') {
.local pmc past, var
$P0 = node['functionname']
var = tree.'get'('past', $P0, 'Lua::Grammar::functionname')
$S0 = $P0.'result_object'()
$S0 = $P0.'ast'()
$I0 = index $S0, ':'
if $I0 < 0 goto L1
$P1 = get_hll_global ['PAST'], 'Var'
Expand Down Expand Up @@ -449,7 +449,7 @@ transform Name (Lua::Grammar::functionname) :language('PIR') {
name = concat '.'
L3:
$P0 = shift iter
$S0 = $P0.'result_object'()
$S0 = $P0.'ast'()
name = concat $S0
goto L2
L1:
Expand All @@ -464,7 +464,7 @@ transform past (Lua::Grammar::functionname) :language('PIR') {
$P0 = node['Name']
new iter, 'Iterator', $P0
$P0 = shift iter
$S0 = $P0.'result_object'()
$S0 = $P0.'ast'()
.local pmc past
$P0 = get_hll_global ['PAST'], 'Var'
($I0, $S1) = symbtab.'lookup'($S0)
Expand All @@ -476,7 +476,7 @@ transform past (Lua::Grammar::functionname) :language('PIR') {
L2:
unless iter goto L3
$P0 = shift iter
$S0 = $P0.'result_object'()
$S0 = $P0.'ast'()
.local pmc key
$P1 = get_hll_global ['PAST'], 'Val'
key = $P1.'new'('node'=>$P0, 'name'=>'key', 'value'=>$S0)
Expand Down Expand Up @@ -512,7 +512,7 @@ transform past (Lua::Grammar::function_body) :language('PIR') {
L4:
unless iter goto L3
$P1 = shift iter
$S0 = $P1.'result_object'()
$S0 = $P1.'ast'()
$S1 = symbtab.'insert'($S0)
$P2 = get_hll_global ['PAST'], 'Var'
var = $P2.'new'('node'=>$P1, 'name'=>$S1, 'scope'=>'parameter')
Expand Down Expand Up @@ -600,7 +600,7 @@ transform record (Lua::Grammar::record_field) :language('PIR') {


transform key (Lua::Grammar::Name) :language('PIR') {
$S0 = node.'result_object'()
$S0 = node.'ast'()
$P0 = get_hll_global ['PAST'], 'Val'
.tailcall $P0.'new'('node'=>node, 'name'=>'key', 'value'=>$S0)
}
Expand Down Expand Up @@ -750,7 +750,7 @@ transform past (Lua::Grammar::Name) :language('PIR') {
.local pmc symbtab
symbtab = get_hll_global ['Lua';'PAST'], '$symbtab'
$P0 = get_hll_global ['PAST'], 'Var'
$S0 = node.'result_object'()
$S0 = node.'ast'()
($I0, $S1) = symbtab.'lookup'($S0)
unless $I0 goto L1
.tailcall $P0.'new'('node'=>node, 'name'=>$S1, 'scope'=>'lexical')
Expand Down Expand Up @@ -789,7 +789,7 @@ transform past (Lua::Grammar::false) :language('PIR') {


transform past (Lua::Grammar::number) :language('PIR') {
$S0 = node.'result_object'()
$S0 = node.'ast'()
$P0 = get_hll_global ['PAST'], 'Val'
.tailcall $P0.'new'('node'=>node, 'name'=>'LuaNumber', 'value'=>$S0)
}
Expand All @@ -798,7 +798,7 @@ transform past (Lua::Grammar::number) :language('PIR') {
transform past (Lua::Grammar::string) :language('PIR') {
$S0 = node.'find_key'()
$P0 = node[$S0]
$S0 = $P0.'result_object'()
$S0 = $P0.'ast'()
$P0 = get_hll_global ['PAST'], 'Val'
.tailcall $P0.'new'('node'=>node, 'name'=>'LuaString', 'value'=>$S0)
}
Expand Down
12 changes: 6 additions & 6 deletions src/dumplex.tg
Expand Up @@ -62,7 +62,7 @@ transform past (Lua::TestLex::token) :language('PIR') {
=cut

transform past (Lua::TestLex::keyword) :language('PIR') {
$S0 = node.'result_object'()
$S0 = node.'ast'()
$S1 = concat "keyword:\t", $S0
$P0 = get_hll_global ['PAST'], 'Val'
.tailcall $P0.'new'('node'=>node, 'value'=>$S1)
Expand All @@ -74,7 +74,7 @@ transform past (Lua::TestLex::keyword) :language('PIR') {
=cut

transform past (Lua::TestLex::punctuator) :language('PIR') {
$S0 = node.'result_object'()
$S0 = node.'ast'()
$S1 = concat "punct:\t", $S0
$P0 = get_hll_global ['PAST'], 'Val'
.tailcall $P0.'new'('node'=>node, 'value'=>$S1)
Expand All @@ -86,7 +86,7 @@ transform past (Lua::TestLex::punctuator) :language('PIR') {
=cut

transform past (Lua::TestLex::Name) :language('PIR') {
$S0 = node.'result_object'()
$S0 = node.'ast'()
$S1 = concat "Name:\t", $S0
$P0 = get_hll_global ['PAST'], 'Val'
.tailcall $P0.'new'('node'=>node, 'value'=>$S1)
Expand All @@ -101,14 +101,14 @@ transform past (Lua::TestLex::String) :language('PIR') {
$I0 = defined node['quoted_literal']
unless $I0 goto L1
$P0 = node['quoted_literal']
$S0 = $P0.'result_object'()
$S0 = $P0.'ast'()
$S1 = concat "String:\t", $S0
goto L9
L1:
$I0 = defined node['long_string']
unless $I0 goto L2
$P0 = node['long_string']
$S0 = $P0.'result_object'()
$S0 = $P0.'ast'()
$S1 = concat "LongString:\t", $S0
goto L9
L2:
Expand All @@ -124,7 +124,7 @@ transform past (Lua::TestLex::String) :language('PIR') {
=cut

transform past (Lua::TestLex::Number) :language('PIR') {
$S0 = node.'result_object'()
$S0 = node.'ast'()
$S1 = concat "Number:\t", $S0
$P0 = get_hll_global ['PAST'], 'Val'
.tailcall $P0.'new'('node'=>node, 'value'=>$S1)
Expand Down
10 changes: 5 additions & 5 deletions src/grammar51.pir
Expand Up @@ -50,7 +50,7 @@ L<http://www.lua.org/manual/5.1/manual.html#2.1>.
$S0 .= $S1
$S0 .= ': '
$S0 .= message
$S1 = mob.'text'()
$S1 = mob.'Str'()
if $S1 == '' goto L1
$S0 .= " near '"
$S0 .= $S1
Expand Down Expand Up @@ -166,7 +166,7 @@ by prefixing them with C<0x>. Examples of valid numerical constants are
.local string target
.local int pos, lastpos

target = mob.'text'()
target = mob.'Str'()
lastpos = length target
L_alt1: # 0 [Xx] <xdigit>+
pos = 0
Expand Down Expand Up @@ -316,7 +316,7 @@ no problem with them.)
L1:
$S0 = substr target, pos, 1
if $S0 != delim goto L2
mob.'result_object'(literal)
mob.'!make'(literal)
mob.'to'(pos)
.return (mob)
L2:
Expand Down Expand Up @@ -453,7 +453,7 @@ and C<'1'> is coded as 49), the five literals below denote the same string:
($I0, $I1) = _skip_sep(target, pos, ']')
if $I1 != sep goto L7
pos = $I0 + 1
mob.'result_object'(literal)
mob.'!make'(literal)
mob.'to'(pos)
goto END
L7:
Expand Down Expand Up @@ -535,7 +535,7 @@ long bracket. Long comments are frequently used to disable code temporarily.
($I0, $I1) = _skip_sep(target, pos, ']')
if $I1 != sep goto L7
pos = $I0 + 1
# mob.'result_object'(literal)
# mob.'!make'(literal)
mob.'to'(pos)
goto END
L7:
Expand Down
8 changes: 4 additions & 4 deletions src/lib/luaregex.pir
Expand Up @@ -379,7 +379,7 @@ Mostly taken from F<compilers/pge/PGE/P5Regex.pir>.
$I0 = pos - litstart
$S0 = substr target, litstart, $I0
$S0 = concat initchar, $S0
mob.'result_object'($S0)
mob.'!make'($S0)
goto end
end:
mob.'to'(pos)
Expand Down Expand Up @@ -476,7 +476,7 @@ Mostly taken from F<compilers/pge/PGE/P5Regex.pir>.
charlist .= '-'
end:
mob.'to'(pos)
mob.'result_object'(charlist)
mob.'!make'(charlist)
.return (mob)
err_close:
Expand Down Expand Up @@ -512,7 +512,7 @@ Mostly taken from F<compilers/pge/PGE/P5Regex.pir>.
mob['isnegated'] = 1
end:
mob.'to'(pos)
mob.'result_object'(charlist)
mob.'!make'(charlist)
.return (mob)
.end
Expand All @@ -528,7 +528,7 @@ Mostly taken from F<compilers/pge/PGE/P5Regex.pir>.
xy = substr target, pos, 2
pos += 2
mob.'to'(pos)
mob.'result_object'(xy)
mob.'!make'(xy)
.return (mob)
err:
Expand Down
12 changes: 6 additions & 6 deletions src/lib/luastring.pir
Expand Up @@ -325,14 +325,14 @@ are also returned, after the two indices.
L2:
unless $I0 < $I1 goto L3
$P0 = capts[$I0]
$I10 = can $P0, 'text'
$I10 = can $P0, 'Str'
if $I10 goto L4
$I10 = $P0
new $P1, 'LuaNumber'
set $P1, $I10
goto L5
L4:
$S0 = $P0.'text'()
$S0 = $P0.'Str'()
$I2 = index $S0, "\0"
if $I2 < 0 goto L6
# sorry, strictly compatible
Expand All @@ -349,7 +349,7 @@ are also returned, after the two indices.
L1:
unless whole == 1 goto L7
set res, 1
$S0 = match.'text'()
$S0 = match.'Str'()
$I2 = index $S0, "\0"
if $I2 < 0 goto L8
# sorry, strictly compatible
Expand Down Expand Up @@ -783,7 +783,7 @@ is replaced.
$I0 = index digits, $S0
if $I0 < 0 goto L3
unless $S0 == '0' goto L4
$S0 = match.'text'()
$S0 = match.'Str'()
goto L3
L4:
dec $I0
Expand All @@ -803,14 +803,14 @@ is replaced.
$I0 = exists $P0[i]
unless $I0 goto L1
$P1 = $P0[i]
$I0 = can $P1, 'text'
$I0 = can $P1, 'Str'
if $I0 goto L2
$I0 = $P1
new $P0, 'LuaNumber'
set $P0, $I0
.return ($P0)
L2:
$S0 = $P1.'text'()
$S0 = $P1.'Str'()
$I0 = index $S0, "\0"
if $I0 < 0 goto L3
# sorry, strictly compatible
Expand Down

0 comments on commit 73ef9d9

Please sign in to comment.