Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge hllmagic branch into trunk.

Mostly looks okay.
If anyone runs into problems fixing the last few issues with their languages, address issues to Tene or pmichaud.


git-svn-id: https://svn.parrot.org/parrot/trunk@31862 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
commit 1ebf2db784f4a178694065a0776c80edce8acd3a 1 parent 628a39a
Stephen Weeks tene authored
Showing with 1,152 additions and 859 deletions.
  1. +1 −1  compilers/nqp/bootstrap/actions.pm
  2. +3 −3 compilers/nqp/bootstrap/nqp.pir
  3. +3 −3 compilers/nqp/nqp.pir
  4. +6 −6 compilers/nqp/src/Grammar.pg
  5. +5 −4 compilers/nqp/src/Grammar/Actions.pir
  6. +35 −35 compilers/pct/src/PAST/Compiler.pir
  7. +6 −6 compilers/pct/src/PAST/Node.pir
  8. +4 −3 compilers/pct/src/PCT/Grammar.pir
  9. +22 −8 compilers/pct/src/PCT/HLLCompiler.pir
  10. +3 −3 compilers/pct/src/PCT/Node.pir
  11. +6 −6 compilers/pct/src/POST/Compiler.pir
  12. +7 −7 compilers/pct/src/POST/Node.pir
  13. +37 −32 compilers/pge/PGE/Exp.pir
  14. +16 −7 compilers/pge/PGE/Match.pir
  15. +3 −3 compilers/pge/PGE/OPTable.pir
  16. +10 −10 compilers/pge/PGE/P5Regex.pir
  17. +31 −31 compilers/pge/PGE/Perl6Regex.pir
  18. +1 −1  compilers/pge/PGE/Regex.pir
  19. +3 −3 compilers/tge/TGE.pir
  20. +1 −1  compilers/tge/TGE/Compiler.pir
  21. +13 −13 examples/past/01-sub.pir
  22. +3 −3 examples/past/blocktype_immediate.pir
  23. +15 −15 examples/past/four_plus_one.pir
  24. +1 −1  examples/pge/simple.pir
  25. +1 −1  languages/APL/APL.pir
  26. +1 −0  languages/WMLScript/pmc/wmlsstring.pmc
  27. +2 −2 languages/c99/c99.pir
  28. +38 −42 languages/c99/src/CPP_PASTNodes.pir
  29. +3 −3 languages/c99/src/CPP_PGE2AST.pir
  30. +4 −4 languages/c99/src/c99_PGE.pir
  31. +2 −2 languages/c99/src/cpp/cpp.pir
  32. +2 −1  languages/c99/src/parser/grammar.pg
  33. +1 −1  languages/cardinal/cardinal.pir
  34. +6 −6 languages/eclectus/compiler.scm
  35. +1 −1  languages/eclectus/driver_nqp.pir
  36. +2 −2 languages/ecmascript/js.pir
  37. +1 −1  languages/hq9plus/hq9plus.pir
  38. +1 −1  languages/json/json.pir
  39. +2 −2 languages/lolcode/lolcode.pir
  40. +1 −1  languages/lolcode/src/parser/yarn_literal.pir
  41. +33 −33 languages/lua/src/PASTGrammar.tg
  42. +1 −1  languages/lua/src/build/translator.pl
  43. +3 −3 languages/lua/src/grammar51.pir
  44. +8 −11 languages/lua/src/lib/lpeg.pir
  45. +28 −50 languages/lua/src/lib/luabytecode.pir
  46. +27 −25 languages/lua/src/lib/luaregex.pir
  47. +14 −13 languages/lua/src/lua51.pir
  48. +22 −22 languages/lua/test_lex.pir
  49. +2 −2 languages/markdown/markdown.pir
  50. +18 −17 languages/markdown/src/Compiler.pir
  51. +2 −2 languages/markdown/src/Node.pir
  52. +1 −1  languages/markdown/src/builtins/length.pir
  53. +3 −3 languages/perl6/perl6.pir
  54. +1 −1  languages/perl6/src/parser/actions.pm
  55. +3 −3 languages/perl6/src/parser/expression.pir
  56. +2 −2 languages/perl6/src/parser/quote_expression.pir
  57. +2 −2 languages/perl6/src/utils/perl6doc.pir
  58. +5 −7 languages/pheme/lib/PhemeCompiler.pir
  59. +1 −1  languages/pheme/lib/PhemeGrammar.pir
  60. +17 −17 languages/pheme/lib/pge2past.tg
  61. +7 −4 languages/pheme/pheme.pir
  62. +5 −5 languages/pipp/src/common/pipp.pir
  63. +1 −1  languages/pipp/src/pct/actions.pm
  64. +1 −1  languages/pipp/src/pct/quote_expression.pir
  65. +1 −1  languages/punie/punie.pir
  66. +1 −1  languages/pynie/src/parser/indent.pir
  67. +1 −1  languages/squaak/squaak.pir
  68. +8 −8 languages/squaak/src/parser/grammar.pg
  69. +78 −4 runtime/parrot/library/P6object.pir
  70. +17 −17 runtime/parrot/library/PGE/Dumper.pir
  71. +11 −10 runtime/parrot/library/PGE/Glob.pir
  72. +6 −6 runtime/parrot/library/PGE/Hs.pir
  73. +23 −13 runtime/parrot/library/PGE/Perl6Grammar.pir
  74. +4 −3 runtime/parrot/library/PGE/Text.pir
  75. +6 −5 runtime/parrot/library/PGE/Util.pir
  76. +12 −11 t/compilers/pct/past.t
  77. +8 −7 t/compilers/pct/pct_hllcompiler.t
  78. +8 −7 t/compilers/pct/post.t
  79. +1 −1  t/compilers/pge/02-match.t
  80. +3 −2 t/compilers/pge/03-optable.t
  81. +2 −2 t/compilers/pge/04-compile.t
  82. +2 −1  t/compilers/pge/06-grammar.t
  83. +3 −3 t/compilers/pge/perl6regex/context.t
  84. +2 −2 t/compilers/pge/pge-hs.t
  85. +1 −1  t/compilers/pge/pge_examples.t
  86. +1 −1  t/compilers/pge/pge_text.t
  87. +7 −7 t/compilers/pge/pge_util.t
  88. +2 −2 t/compilers/tge/parser.t
  89. +431 −238 t/library/p6object.t
  90. +2 −2 t/pmc/sub.t
  91. +1 −1  tools/dev/mk_language_shell.pl
2  compilers/nqp/bootstrap/actions.pm
View
@@ -747,7 +747,7 @@ method package_declarator($/, $key) {
#if ($<sym> eq 'class') { ...code to make class... }
make $past;
- # PIR q< $P0 = get_hll_global ['NQP::Grammar::Actions'], 'package_declarator_helper' >;
+ # PIR q< $P0 = get_hll_global ['NQP';'Grammar';'Actions'], 'package_declarator_helper' >;
# PIR q< $P1 = find_lex '$/' >;
# PIR q< $P2 = find_lex '$key' >;
# PIR q< $P0($P1, $P2) >;
6 compilers/nqp/bootstrap/nqp.pir
View
@@ -21,7 +21,7 @@ object.
=cut
-.namespace [ 'NQP::Compiler' ]
+.namespace [ 'NQP';'Compiler' ]
.loadlib 'nqp_group'
@@ -81,7 +81,7 @@ to the nqp compiler.
.end
-#.namespace [ 'NQP::Grammar::Actions' ]
+#.namespace [ 'NQP';'Grammar';'Actions' ]
#
#.sub 'package_declarator_helper'
# .param pmc match
@@ -123,7 +123,7 @@ to the nqp compiler.
## initialize optable with inline PIR
.local pmc optable
- optable = get_hll_global [ 'NQP::Grammar' ], '$optable'
+ optable = get_hll_global [ 'NQP';'Grammar' ], '$optable'
optable['prefix:~'; 'inline'] = <<" END"
## inline prefix:~
$S0 = %0
6 compilers/nqp/nqp.pir
View
@@ -1,19 +1,19 @@
# Copyright (C) 2007-2008, The Perl Foundation.
# $Id$
-.namespace [ 'NQP::Compiler' ]
+.namespace [ 'NQP';'Compiler' ]
.sub '__onload' :load :init
load_bytecode 'PGE.pbc'
load_bytecode 'PCT.pbc'
- $P0 = new [ 'PCT::HLLCompiler' ]
+ $P0 = new [ 'PCT';'HLLCompiler' ]
$P0.'language'('NQP')
$P0.'parsegrammar'('NQP::Grammar')
$P0.'parseactions'('NQP::Grammar::Actions')
$P0 = new 'Integer'
- set_hll_global ['NQP::Grammar'], '$!endstmt', $P0
+ set_hll_global ['NQP';'Grammar'], '$!endstmt', $P0
.end
.sub 'main' :main
12 compilers/nqp/src/Grammar.pg
View
@@ -31,13 +31,13 @@ token TOP {
## yet handle all valid forms of Perl 6 whitespace.
token ws {
{{ $P0 = match.'to'()
- $P1 = get_hll_global [ 'NQP::Grammar' ], '$!ws'
+ $P1 = get_hll_global [ 'NQP';'Grammar' ], '$!ws'
if null $P1 goto set_new_ws
$P2 = $P1.'to'()
if $P0 != $P2 goto set_new_ws
.return (1)
set_new_ws:
- set_hll_global [ 'NQP::Grammar' ], '$!ws', match
+ set_hll_global [ 'NQP';'Grammar' ], '$!ws', match
}}
[ \s+
| ^^ [ \# \N*
@@ -51,7 +51,7 @@ token ws {
token afterws {
## <?{ $¢ == $!ws_to != $!ws_from }>
{{ $P0 = match.'to'()
- $P1 = get_hll_global [ 'NQP::Grammar' ], '$!ws'
+ $P1 = get_hll_global [ 'NQP';'Grammar' ], '$!ws'
$P2 = $P1.'to'()
if $P0 != $P2 goto end
$P2 = $P1.'from'()
@@ -121,8 +121,8 @@ token terminator { <[ } \] ) ]> | $ }
token statement_end {
|| ';'
|| <?before <terminator>>
- || {{ $P0 = get_hll_global ['NQP::Grammar'], '$!endstmt'
- $P1 = get_hll_global ['NQP::Grammar'], '$!ws'
+ || {{ $P0 = get_hll_global ['NQP';'Grammar'], '$!endstmt'
+ $P1 = get_hll_global ['NQP';'Grammar'], '$!ws'
$P2 = $P1.'from'()
if $P0 != $P2 goto end
.return (1)
@@ -133,7 +133,7 @@ token statement_end {
token MARK_STATEMENT_END {
{{ $P0 = match.'to'()
$P0 = clone $P0
- set_hll_global ['NQP::Grammar'], '$!endstmt', $P0
+ set_hll_global ['NQP';'Grammar'], '$!endstmt', $P0
}}
<.ws>
}
9 compilers/nqp/src/Grammar/Actions.pir
View
@@ -2,15 +2,16 @@
# $Id$
.sub '__onload' :init :load
- $P0 = newclass 'NQP::Grammar::Actions'
+ $P0 = get_hll_global 'P6metaclass'
+ $P0 = $P0.'new_class'('NQP::Grammar::Actions')
## create the stack for nested lexical blocks
$P0 = new 'ResizablePMCArray'
- set_hll_global ['NQP::Grammar::Actions'], '@?BLOCK', $P0
+ set_hll_global ['NQP';'Grammar';'Actions'], '@?BLOCK', $P0
## initialize optable with inline PIR
.local pmc optable
- optable = get_hll_global [ 'NQP::Grammar' ], '$optable'
+ optable = get_hll_global [ 'NQP';'Grammar' ], '$optable'
optable['postfix:++'; 'inline'] = <<" END"
## inline postfix:++
@@ -27,7 +28,7 @@
.return ()
.end
-.namespace [ 'NQP::Grammar::Actions' ]
+.namespace [ 'NQP';'Grammar';'Actions' ]
## method TOP($/, $key) {
70 compilers/pct/src/PAST/Compiler.pir
View
@@ -40,7 +40,7 @@ any value type.
.include "except_types.pasm"
.include "interpinfo.pasm"
-.namespace [ 'PAST::Compiler' ]
+.namespace [ 'PAST';'Compiler' ]
.sub 'onload' :anon :load :init
load_bytecode 'PCT/HLLCompiler.pbc'
@@ -481,7 +481,7 @@ nodes of type C<PAST::Stmts>.
=cut
-.sub 'as_post' :method :multi(_, PAST::Node)
+.sub 'as_post' :method :multi(_, ['PAST';'Node'])
.param pmc node
.param pmc options :slurpy :named
@@ -510,7 +510,7 @@ Return the POST representation of a C<PAST::Block>.
=cut
-.sub 'as_post' :method :multi(_, ['PAST::Block'])
+.sub 'as_post' :method :multi(_, ['PAST';'Block'])
.param pmc node
.param pmc options :slurpy :named
@@ -618,7 +618,7 @@ Return the POST representation of a C<PAST::Block>.
bpost.'push'(ctrllabel)
bpost.'push_pirop'('.local pmc exception')
bpost.'push_pirop'('.get_results (exception)')
- $I0 = isa ctrlpast, 'PAST::Node'
+ $I0 = isa ctrlpast, ['PAST';'Node']
if $I0 goto control_past
if ctrlpast == 'return_pir' goto control_return
self.panic("Unrecognized control handler '", ctrlpast, "'")
@@ -724,7 +724,7 @@ the node's "pasttype" attribute.
=cut
-.sub 'as_post' :method :multi(_, ['PAST::Op'])
+.sub 'as_post' :method :multi(_, ['PAST';'Op'])
.param pmc node
.param pmc options :slurpy :named
@@ -766,7 +766,7 @@ a 'pasttype' of 'pirop'.
=cut
-.sub 'pirop' :method :multi(_, ['PAST::Op'])
+.sub 'pirop' :method :multi(_, ['PAST';'Op'])
.param pmc node
.param pmc options :slurpy :named
@@ -813,7 +813,7 @@ for calling a sub.
=cut
-.sub 'call' :method :multi(_, ['PAST::Op'])
+.sub 'call' :method :multi(_, ['PAST';'Op'])
.param pmc node
.param pmc options :slurpy :named
.local string pasttype
@@ -838,7 +838,7 @@ for calling a sub.
goto children_done
call_by_name:
(ops, posargs, namedargs) = self.'post_children'(node, 'signature'=>signature)
- $I0 = isa name, 'PAST::Node'
+ $I0 = isa name, ['PAST';'Node']
if $I0 goto call_by_name_past
$S0 = self.'escape'(name)
unshift posargs, $S0
@@ -868,7 +868,7 @@ to invoke a method on a PMC.
=cut
-.sub 'callmethod' :method :multi(_, ['PAST::Op'])
+.sub 'callmethod' :method :multi(_, ['PAST';'Op'])
.param pmc node
.param pmc options :slurpy :named
.return self.'call'(node, options :flat :named)
@@ -884,7 +884,7 @@ a 'pasttype' of if/unless.
=cut
-.sub 'if' :method :multi(_,['PAST::Op'])
+.sub 'if' :method :multi(_,['PAST';'Op'])
.param pmc node
.param pmc options :slurpy :named
@@ -978,7 +978,7 @@ a 'pasttype' of if/unless.
ret
.end
-.sub 'unless' :method :multi(_, ['PAST::Op'])
+.sub 'unless' :method :multi(_, ['PAST';'Op'])
.param pmc node
.param pmc options :slurpy :named
.return self.'if'(node, options :flat :named)
@@ -993,7 +993,7 @@ Return the POST representation of a C<while> or C<until> loop.
=cut
-.sub 'while' :method :multi(_, ['PAST::Op'])
+.sub 'while' :method :multi(_, ['PAST';'Op'])
.param pmc node
.param pmc options :slurpy :named
@@ -1044,7 +1044,7 @@ Return the POST representation of a C<while> or C<until> loop.
.return (ops)
.end
-.sub 'until' :method :multi(_, ['PAST::Op'])
+.sub 'until' :method :multi(_, ['PAST';'Op'])
.param pmc node
.param pmc options :slurpy :named
.return self.'while'(node, options :flat :named)
@@ -1058,7 +1058,7 @@ Return the POST representation of a C<repeat_while> or C<repeat_until> loop.
=cut
-.sub 'repeat_while' :method :multi(_, ['PAST::Op'])
+.sub 'repeat_while' :method :multi(_, ['PAST';'Op'])
.param pmc node
.param pmc options :slurpy :named
@@ -1104,7 +1104,7 @@ Return the POST representation of a C<repeat_while> or C<repeat_until> loop.
.return (ops)
.end
-.sub 'repeat_until' :method :multi(_, ['PAST::Op'])
+.sub 'repeat_until' :method :multi(_, ['PAST';'Op'])
.param pmc node
.param pmc options :slurpy :named
.return self.'repeat_while'(node, options :flat :named)
@@ -1118,7 +1118,7 @@ by C<node>.
=cut
-.sub 'for' :method :multi(_, ['PAST::Op'])
+.sub 'for' :method :multi(_, ['PAST';'Op'])
.param pmc node
.param pmc options :slurpy :named
@@ -1213,7 +1213,7 @@ to C<ResizablePMCArray> if not set.
=cut
-.sub 'list' :method :multi(_, ['PAST::Op'])
+.sub 'list' :method :multi(_, ['PAST';'Op'])
.param pmc node
.param pmc options :slurpy :named
@@ -1249,7 +1249,7 @@ a return value.
=cut
-.sub 'return' :method :multi(_, ['PAST::Op'])
+.sub 'return' :method :multi(_, ['PAST';'Op'])
.param pmc node
.param pmc options :slurpy :named
@@ -1286,7 +1286,7 @@ handler.
=cut
-.sub 'try' :method :multi(_, ['PAST::Op'])
+.sub 'try' :method :multi(_, ['PAST';'Op'])
.param pmc node
.param pmc options :slurpy :named
@@ -1341,7 +1341,7 @@ $x < $y and $y < $z, but $y only gets evaluated once.
=cut
-.sub 'chain' :method :multi(_, ['PAST::Op'])
+.sub 'chain' :method :multi(_, ['PAST';'Op'])
.param pmc node
.param pmc options :slurpy :named
.local pmc clist, cpast
@@ -1350,7 +1350,7 @@ $x < $y and $y < $z, but $y only gets evaluated once.
clist = new 'ResizablePMCArray'
cpast = node
chain_loop:
- $I0 = isa cpast, 'PAST::Op'
+ $I0 = isa cpast, ['PAST';'Op']
if $I0 == 0 goto chain_end
.local string pasttype
pasttype = cpast.'pasttype'()
@@ -1403,7 +1403,7 @@ being refactored out using thunks of some sort.)
=cut
-.sub 'def_or' :method :multi(_, ['PAST::Op'])
+.sub 'def_or' :method :multi(_, ['PAST';'Op'])
.param pmc node
.param pmc options :slurpy :named
@@ -1445,7 +1445,7 @@ a second child is found that evaluates as true.
=cut
-.sub 'xor' :method :multi(_,['PAST::Op'])
+.sub 'xor' :method :multi(_,['PAST';'Op'])
.param pmc node
.param pmc options :slurpy :named
@@ -1504,7 +1504,7 @@ node with a 'pasttype' of bind.
=cut
-.sub 'bind' :method :multi(_, ['PAST::Op'])
+.sub 'bind' :method :multi(_, ['PAST';'Op'])
.param pmc node
.param pmc options :slurpy :named
@@ -1533,7 +1533,7 @@ opcode -- see RT#47828).
=cut
-.sub 'copy' :method :multi(_, ['PAST::Op'])
+.sub 'copy' :method :multi(_, ['PAST';'Op'])
.param pmc node
.param pmc options :slurpy :named
.local pmc rpast, rpost, lpast, lpost
@@ -1556,7 +1556,7 @@ node with a 'pasttype' of inline.
=cut
-.sub 'inline' :method :multi(_, ['PAST::Op'])
+.sub 'inline' :method :multi(_, ['PAST';'Op'])
.param pmc node
.param pmc options :slurpy :named
@@ -1611,7 +1611,7 @@ attribute.
=cut
-.sub 'as_post' :method :multi(_, ['PAST::Var'])
+.sub 'as_post' :method :multi(_, ['PAST';'Var'])
.param pmc node
.param pmc options :slurpy :named
@@ -1681,7 +1681,7 @@ attribute.
.end
-.sub 'parameter' :method :multi(_, ['PAST::Var'])
+.sub 'parameter' :method :multi(_, ['PAST';'Var'])
.param pmc node
.param pmc bindpost
@@ -1727,7 +1727,7 @@ attribute.
.end
-.sub 'package' :method :multi(_, ['PAST::Var'])
+.sub 'package' :method :multi(_, ['PAST';'Var'])
.param pmc node
.param pmc bindpost
@@ -1772,7 +1772,7 @@ attribute.
.end
-.sub 'lexical' :method :multi(_, ['PAST::Var'])
+.sub 'lexical' :method :multi(_, ['PAST';'Var'])
.param pmc node
.param pmc bindpost
@@ -1814,7 +1814,7 @@ attribute.
.end
-.sub 'keyed' :method :multi(_, ['PAST::Var'])
+.sub 'keyed' :method :multi(_, ['PAST';'Var'])
.param pmc node
.param pmc bindpost
.param string keyrtype :optional
@@ -1875,14 +1875,14 @@ attribute.
.end
-.sub 'keyed_int' :method :multi(_, ['PAST::Var'])
+.sub 'keyed_int' :method :multi(_, ['PAST';'Var'])
.param pmc node
.param pmc bindpost
.return self.'keyed'(node, bindpost, 'i')
.end
-.sub 'attribute' :method :multi(_, ['PAST::Var'])
+.sub 'attribute' :method :multi(_, ['PAST';'Var'])
.param pmc node
.param pmc bindpost
@@ -1928,7 +1928,7 @@ attribute.
.end
-.sub 'register' :method :multi(_, ['PAST::Var'])
+.sub 'register' :method :multi(_, ['PAST';'Var'])
.param pmc node
.param pmc bindpost
@@ -1978,7 +1978,7 @@ to have a PMC generated containing the constant value.
=cut
-.sub 'as_post' :method :multi(_, ['PAST::Val'])
+.sub 'as_post' :method :multi(_, ['PAST';'Val'])
.param pmc node
.param pmc options :slurpy :named
12 compilers/pct/src/PAST/Node.pir
View
@@ -9,7 +9,7 @@ for compiling programs in Parrot.
=cut
-.namespace [ 'PAST::Node' ]
+.namespace [ 'PAST';'Node' ]
.sub 'onload' :anon :load :init
## create the PAST::Node base class
@@ -118,7 +118,7 @@ Get/set the constant value for this node.
=cut
-.namespace [ 'PAST::Val' ]
+.namespace [ 'PAST';'Val' ]
.sub 'value' :method
.param pmc value :optional
@@ -146,7 +146,7 @@ members and (optionally named) Parrot registers respectively.
=cut
-.namespace [ 'PAST::Var' ]
+.namespace [ 'PAST';'Var' ]
.sub 'scope' :method
.param pmc value :optional
@@ -320,7 +320,7 @@ assumes "call".
=cut
-.namespace [ 'PAST::Op' ]
+.namespace [ 'PAST';'Op' ]
.sub 'pasttype' :method
.param pmc value :optional
@@ -448,7 +448,7 @@ blocks in Perl6 C<if>, C<while>, and other similar statements).
=cut
-.namespace [ 'PAST::Block' ]
+.namespace [ 'PAST';'Block' ]
.sub 'blocktype' :method
.param pmc value :optional
@@ -639,7 +639,7 @@ Get/set any pirflags for this block.
.end
-.namespace [ 'PAST::VarList' ]
+.namespace [ 'PAST';'VarList' ]
.sub 'bindvalue' :method
.param pmc value :optional
7 compilers/pct/src/PCT/Grammar.pir
View
@@ -35,7 +35,7 @@ also included.
=cut
-.namespace [ 'PCT::Grammar' ]
+.namespace [ 'PCT';'Grammar' ]
.sub 'onload' :anon :init :load
load_bytecode 'PGE.pbc'
@@ -43,8 +43,9 @@ also included.
.local pmc p6meta
p6meta = new 'P6metaclass'
p6meta.'new_class'('PCT::Grammar', 'parent'=>'PGE::Grammar')
- $P0 = get_class 'PCT::Grammar'
- $P1 = get_hll_global ['PGE::Util'], 'die'
+ $P0 = split '::', 'PCT::Grammar'
+ $P0 = get_class $P0
+ $P1 = get_hll_global ['PGE';'Util'], 'die'
$P0.'add_method'('panic', $P1)
.return ()
.end
30 compilers/pct/src/PCT/HLLCompiler.pir
View
@@ -19,7 +19,7 @@ running compilers from a command line.
$P0.'new_class'('PCT::HLLCompiler', 'attr'=>$S0)
.end
-.namespace [ 'PCT::HLLCompiler' ]
+.namespace [ 'PCT';'HLLCompiler' ]
.include 'cclass.pasm'
@@ -319,7 +319,7 @@ to any options and return the resulting parse tree.
.sub 'parse' :method
.param pmc source
.param pmc adverbs :slurpy :named
- .local pmc parsegrammar_name, top
+ .local pmc parsegrammar, top
.local string tcode
tcode = adverbs['transcode']
@@ -336,11 +336,25 @@ to any options and return the resulting parse tree.
target = adverbs['target']
target = downcase target
- parsegrammar_name = self.'parsegrammar'()
- unless parsegrammar_name goto err_no_parsegrammar
- top = get_hll_global parsegrammar_name, 'TOP'
+ parsegrammar = self.'parsegrammar'()
+ $I0 = can parsegrammar, 'TOP'
+ unless $I0 goto parsegrammar_string
+ top = find_method parsegrammar, 'TOP'
+ goto have_top
+ parsegrammar_string:
+ $P0 = self.'parse_name'(parsegrammar)
+ $S0 = pop $P0
+ $P1 = get_hll_global $P0, $S0
+ $I0 = can $P1, 'TOP'
+ unless $I0 goto parsegrammar_ns
+ top = find_method $P1, 'TOP'
+ goto have_top
+ parsegrammar_ns:
+ $P0 = self.'parse_name'(parsegrammar)
+ top = get_hll_global $P0, 'TOP'
unless null top goto have_top
- self.'panic'('Cannot find TOP regex in ', parsegrammar_name)
+ err_notop:
+ self.'panic'('Cannot find TOP regex in ', parsegrammar)
have_top:
.local pmc parseactions, action
null action
@@ -367,7 +381,7 @@ to any options and return the resulting parse tree.
action = new parseactions
have_action:
.local pmc match
- match = top(source, 'grammar' => parsegrammar_name, 'action' => action)
+ match = top(source, 'grammar' => parsegrammar, 'action' => action)
unless match goto err_failedparse
.return (match)
@@ -406,7 +420,7 @@ resulting ast.
.local pmc ast
ast = source.'item'()
pop_eh
- $I0 = isa ast, 'PAST::Node'
+ $I0 = isa ast, ['PAST';'Node']
unless $I0 goto err_past
.return (ast)
6 compilers/pct/src/PCT/Node.pir
View
@@ -9,7 +9,7 @@ and opcode syntax tree (POST) nodes in the Parrot Compiler Toolkit.
=cut
-.namespace [ 'PCT::Node' ]
+.namespace [ 'PCT';'Node' ]
.sub 'onload' :anon :load :init
## create the PCT::Node base class
@@ -24,7 +24,7 @@ and opcode syntax tree (POST) nodes in the Parrot Compiler Toolkit.
$P0 = new 'Integer'
$P0 = 10
- set_hll_global ['PCT::Node'], '$!serno', $P0
+ set_hll_global ['PCT';'Node'], '$!serno', $P0
.return ()
.end
@@ -221,7 +221,7 @@ a C<Match> object and obtains source/position information from that.
.sub 'node' :method
.param pmc node
- $I0 = isa node, 'PAST::Node'
+ $I0 = isa node, ['PAST';'Node']
if $I0 goto clone_past
clone_pge:
$S0 = node
12 compilers/pct/src/POST/Compiler.pir
View
@@ -13,7 +13,7 @@ PIR or an Eval PMC (bytecode).
=cut
-.namespace [ 'POST::Compiler' ]
+.namespace [ 'POST';'Compiler' ]
.sub '__onload' :load :init
.local pmc p6meta, cproto
@@ -37,7 +37,7 @@ PIR or an Eval PMC (bytecode).
.param pmc adverbs :slurpy :named
.local pmc newself
- newself = new 'POST::Compiler'
+ newself = new ['POST';'Compiler']
## start with empty code
.local pmc subcode, code
@@ -46,7 +46,7 @@ PIR or an Eval PMC (bytecode).
push subcode, code
## if the root node isn't a Sub, wrap it
- $I0 = isa post, 'POST::Sub'
+ $I0 = isa post, ['POST';'Sub']
if $I0 goto have_sub
$P0 = get_hll_global ['POST'], 'Sub'
post = $P0.'new'(post, 'name'=>'anon')
@@ -103,7 +103,7 @@ Return pir for an operation node.
=cut
-.sub 'pir' :method :multi(_,['POST::Op'])
+.sub 'pir' :method :multi(_,['POST';'Op'])
.param pmc node
## determine the type of operation
@@ -173,7 +173,7 @@ Generate a label.
=cut
-.sub 'pir' :method :multi(_, ['POST::Label'])
+.sub 'pir' :method :multi(_, ['POST';'Label'])
.param pmc node
.local string code, value
value = node.'result'()
@@ -192,7 +192,7 @@ the sub.
=cut
-.sub 'pir' :method :multi(_, ['POST::Sub'])
+.sub 'pir' :method :multi(_, ['POST';'Sub'])
.param pmc node
.local pmc subcode
14 compilers/pct/src/POST/Node.pir
View
@@ -29,7 +29,7 @@ for compiling programs in Parrot.
$P0[4] = " .param pmc %0 :named(%1)"
$P0[5] = " .param pmc %0 :optional :named(%1)\n .param int has_%0 :opt_flag"
$P0[6] = " .param pmc %0 :slurpy :named"
- set_hll_global ['POST::Sub'], '%!paramfmt', $P0
+ set_hll_global ['POST';'Sub'], '%!paramfmt', $P0
.return ()
.end
@@ -49,7 +49,7 @@ Get/set
=cut
-.namespace [ 'POST::Node' ]
+.namespace [ 'POST';'Node' ]
=item result([value])
@@ -66,7 +66,7 @@ as the result of the current node.
if has_value == 1 goto set_value
value = self['result']
if null value goto result_null
- $I0 = isa value, 'POST::Node'
+ $I0 = isa value, ['POST';'Node']
if $I0 goto result_node
.return (value)
result_node:
@@ -138,7 +138,7 @@ Get/set the opcode type for this node.
=cut
-.namespace [ 'POST::Op' ]
+.namespace [ 'POST';'Op' ]
.sub 'pirop' :method
.param pmc value :optional
@@ -153,7 +153,7 @@ Get/set the opcode type for this node.
.end
-.namespace [ 'POST::Label' ]
+.namespace [ 'POST';'Label' ]
.sub 'result' :method
.param pmc value :optional
@@ -171,7 +171,7 @@ Get/set the opcode type for this node.
.end
-.namespace [ 'POST::Sub' ]
+.namespace [ 'POST';'Sub' ]
.sub 'blocktype' :method
.param pmc value :optional
@@ -256,7 +256,7 @@ Get/set the opcode type for this node.
have_code:
.local pmc paramfmt
- paramfmt = get_hll_global ['POST::Sub'], '%!paramfmt'
+ paramfmt = get_hll_global ['POST';'Sub'], '%!paramfmt'
$S0 = paramfmt[paramseq]
named = code.'escape'(named)
code.'emit'($S0, pname, named)
69 compilers/pge/PGE/Exp.pir
View
@@ -4,7 +4,7 @@ PGE::Exp - base class for expressions
=cut
-.namespace [ "PGE::Exp" ]
+.namespace [ 'PGE';'Exp' ]
.include "interpinfo.pasm"
.include "cclass.pasm"
@@ -22,7 +22,7 @@ PGE::Exp - base class for expressions
.local pmc term
.local pmc p6meta, expproto
- p6meta = new 'P6metaclass'
+ p6meta = get_hll_global 'P6metaclass'
expproto = p6meta.'new_class'('PGE::Exp', 'parent'=>'PGE::Match')
p6meta.'new_class'('PGE::Exp::Literal', 'parent'=>expproto)
p6meta.'new_class'('PGE::Exp::Scalar', 'parent'=>expproto)
@@ -76,7 +76,9 @@ C<target> adverbs.
.local string grammar
grammar = adverbs['grammar']
if grammar == '' goto ns_root
- code.'emit'(".namespace [ '%0' ]", grammar)
+ $P0 = split '::', grammar
+ $P0 = code.'key'($P0 :flat)
+ code.'emit'(".namespace %0", $P0)
goto ns_done
ns_root:
code.'emit'('.namespace')
@@ -91,8 +93,9 @@ C<target> adverbs.
$P0 = compreg 'PIR'
$P1 = $P0(code)
make_grammar:
+ if grammar == '' goto end
push_eh end
- $P0 = new 'P6metaclass'
+ $P0 = get_hll_global 'P6metaclass'
$P0.'new_class'(grammar, 'parent'=>'PGE::Grammar')
pop_eh
end:
@@ -131,7 +134,7 @@ tree as a PIR code object that can be compiled.
.local pmc exp
.local string explabel
exp = self
- set_hll_global ['PGE::Exp'], '$!group', exp
+ set_hll_global ['PGE';'Exp'], '$!group', exp
exp = exp.reduce(self)
## we don't need a coroutine if :ratchet is set
@@ -327,7 +330,7 @@ tree as a PIR code object that can be compiled.
.end
-.namespace [ 'PGE::Exp::Literal' ]
+.namespace [ 'PGE';'Exp';'Literal' ]
.sub 'reduce' :method
.param pmc next
@@ -369,7 +372,7 @@ tree as a PIR code object that can be compiled.
.end
-.namespace [ 'PGE::Exp::Concat' ]
+.namespace [ 'PGE';'Exp';'Concat' ]
.sub 'reduce' :method
.param pmc next
@@ -396,10 +399,10 @@ tree as a PIR code object that can be compiled.
inc i
if i >= n goto concat_lit_end
exp1 = children[i]
- $I1 = isa exp1, 'PGE::Exp::Literal'
+ $I1 = isa exp1, ['PGE';'Exp';'Literal']
if $I1 == 0 goto concat_lit_shift
exp0 = children[j]
- $I0 = isa exp0, 'PGE::Exp::Literal'
+ $I0 = isa exp0, ['PGE';'Exp';'Literal']
if $I0 == 0 goto concat_lit_shift
$I0 = exp0['ignorecase']
$I1 = exp1['ignorecase']
@@ -450,7 +453,7 @@ tree as a PIR code object that can be compiled.
.end
-.namespace [ 'PGE::Exp::Quant' ]
+.namespace [ 'PGE';'Exp';'Quant' ]
.sub 'reduce' :method
.param pmc next
@@ -620,7 +623,7 @@ tree as a PIR code object that can be compiled.
.end
-.namespace [ 'PGE::Exp::Group' ]
+.namespace [ 'PGE';'Exp';'Group' ]
.sub 'reduce' :method
.param pmc next
@@ -631,9 +634,9 @@ tree as a PIR code object that can be compiled.
## This group is non-backtracking, so concatenate a "cut group"
## node (PGE::Exp::Cut) to its child.
exp = self[0]
- $P0 = new 'PGE::Exp::Concat'
+ $P0 = new ['PGE';'Exp';'Concat']
$P0[0] = exp
- $P1 = new 'PGE::Exp::Cut'
+ $P1 = new ['PGE';'Exp';'Cut']
$P0[1] = $P1
self[0] = $P0
@@ -641,11 +644,11 @@ tree as a PIR code object that can be compiled.
.local pmc group
## Temporarily store this group as the current group. Any
## cut nodes we encounter will set a cutmark into this group.
- group = get_hll_global ['PGE::Exp'], '$!group'
- set_hll_global ['PGE::Exp'], '$!group', self
+ group = get_hll_global ['PGE';'Exp'], '$!group'
+ set_hll_global ['PGE';'Exp'], '$!group', self
exp = self[0]
exp = exp.reduce(next)
- set_hll_global ['PGE::Exp'], '$!group', group
+ set_hll_global ['PGE';'Exp'], '$!group', group
$I0 = self['cutmark']
if $I0 > 0 goto keep_group
$I0 = self['iscapture']
@@ -683,7 +686,7 @@ tree as a PIR code object that can be compiled.
.end
-.namespace [ 'PGE::Exp::CGroup' ]
+.namespace [ 'PGE';'Exp';'CGroup' ]
.sub 'pir' :method
.param pmc code
@@ -751,7 +754,7 @@ tree as a PIR code object that can be compiled.
.end
-.namespace [ 'PGE::Exp::Subrule' ]
+.namespace [ 'PGE';'Exp';'Subrule' ]
.sub 'reduce' :method
.param pmc next
@@ -796,11 +799,13 @@ tree as a PIR code object that can be compiled.
rname = substr subname, $I0
$I0 -= 2
grammar = substr subname, 0, $I0
- code.emit(<<" CODE", grammar, rname, args :flat :named)
+ $P0 = split '::', grammar
+ $P0 = code.'key'($P0)
+ code.emit(<<" CODE", grammar, rname, $P0, args :flat :named)
%L: # grammar subrule %0::%1
captob = captscope.'new'(captscope, 'grammar'=>'%0')
captob.'to'(pos)
- $P0 = get_hll_global ['%0'], '%1'
+ $P0 = get_hll_global %2, '%1'
CODE
goto subrule_match
@@ -893,7 +898,7 @@ tree as a PIR code object that can be compiled.
.end
-.namespace [ 'PGE::Exp::Alt' ]
+.namespace [ 'PGE';'Exp';'Alt' ]
.sub 'reduce' :method
.param pmc next
@@ -932,7 +937,7 @@ tree as a PIR code object that can be compiled.
.end
-.namespace [ 'PGE::Exp::Anchor' ]
+.namespace [ 'PGE';'Exp';'Anchor' ]
.sub 'reduce' :method
.param pmc next
@@ -1046,7 +1051,7 @@ tree as a PIR code object that can be compiled.
.end
-.namespace [ 'PGE::Exp::CCShortcut' ]
+.namespace [ 'PGE';'Exp';'CCShortcut' ]
.sub 'reduce' :method
.param pmc next
@@ -1186,7 +1191,7 @@ tree as a PIR code object that can be compiled.
.end
-.namespace [ 'PGE::Exp::Cut' ]
+.namespace [ 'PGE';'Exp';'Cut' ]
.sub 'reduce' :method
.param pmc next
@@ -1198,7 +1203,7 @@ tree as a PIR code object that can be compiled.
## This node is cutting a group. We need to
## get the current group's cutmark, or set
## one if it doesn't already have one.
- group = get_hll_global ['PGE::Exp'], '$!group'
+ group = get_hll_global ['PGE';'Exp'], '$!group'
cutmark = group['cutmark']
if cutmark > 0 goto has_cutmark
$P1 = new 'CodeString'
@@ -1238,7 +1243,7 @@ tree as a PIR code object that can be compiled.
.end
-.namespace [ 'PGE::Exp::Scalar' ]
+.namespace [ 'PGE';'Exp';'Scalar' ]
.sub 'reduce' :method
.param pmc next
@@ -1272,7 +1277,7 @@ tree as a PIR code object that can be compiled.
.end
-.namespace [ 'PGE::Exp::EnumCharList' ]
+.namespace [ 'PGE';'Exp';'EnumCharList' ]
.sub 'reduce' :method
.param pmc next
@@ -1314,7 +1319,7 @@ tree as a PIR code object that can be compiled.
.end
-.namespace [ 'PGE::Exp::Newline' ]
+.namespace [ 'PGE';'Exp';'Newline' ]
.sub 'reduce' :method
.param pmc next
@@ -1339,7 +1344,7 @@ tree as a PIR code object that can be compiled.
.end
-.namespace [ 'PGE::Exp::Conj' ]
+.namespace [ 'PGE';'Exp';'Conj' ]
.sub 'reduce' :method
.param pmc next
@@ -1397,7 +1402,7 @@ tree as a PIR code object that can be compiled.
.return ()
.end
-.namespace [ "PGE::Exp::Closure" ]
+.namespace [ 'PGE';'Exp';'Closure' ]
.sub 'reduce' :method
.param pmc next
@@ -1422,7 +1427,7 @@ tree as a PIR code object that can be compiled.
code.emit(<<" CODE", label, next, lang, value)
%0: # closure
$S1 = %3
- $P0 = get_hll_global ['PGE::Match'], '%!cache'
+ $P0 = get_hll_global ['PGE';'Match'], '%!cache'
$P1 = $P0[$S1]
unless null $P1 goto %0_1
$P1 = compreg %2
@@ -1443,7 +1448,7 @@ tree as a PIR code object that can be compiled.
.return ()
.end
-.namespace [ "PGE::Exp::Action" ]
+.namespace [ 'PGE';'Exp';'Action' ]
.sub 'reduce' :method
.param pmc next
23 compilers/pge/PGE/Match.pir
View
@@ -8,7 +8,7 @@ This file implements match objects returned by the Parrot Grammar Engine.
=cut
-.namespace [ 'PGE::Match' ]
+.namespace [ 'PGE';'Match' ]
.sub '__onload' :load
load_bytecode 'P6object.pbc'
@@ -57,23 +57,24 @@ is set or implied.
## set values based on src param
.local int issrcmatch, pos, iscont
- .local string grammar
- .local pmc target
- issrcmatch = isa src, 'PGE::Match'
+ .local pmc grammar
+ .local pmc target, grammar_class
+ issrcmatch = isa src, ['PGE';'Match']
if issrcmatch goto target_from_src
.local pmc target
target = new 'String'
target = src
pos = 0
iscont = 1
- grammar = typeof self
+ $P0 = self.'HOW'()
+ grammar_class = getattribute $P0, 'parrotclass'
goto adverb_pos
target_from_src:
target = getattribute src, '$.target'
$P0 = getattribute src, '$.pos'
pos = $P0
iscont = 0
- grammar = typeof src
+ grammar_class = typeof src
if pos >= 0 goto adverb_pos
pos = 0
@@ -108,12 +109,20 @@ is set or implied.
$I0 = exists adverbs['grammar']
unless $I0 goto with_grammar
grammar = adverbs['grammar']
+ $S0 = typeof grammar
+ eq $S0, 'NameSpace', grammar_namespace
+ $S0 = grammar
+ $P0 = split '::', $S0
+ grammar_class = get_class $P0
+ goto with_grammar
+ grammar_namespace:
+ grammar_class = grammar
with_grammar:
with_adverbs:
## create the new match object
.local pmc mob, mfrom, mpos
- mob = new grammar
+ mob = new grammar_class
setattribute mob, '$.target', target
mfrom = new 'Integer'
mfrom = pos
6 compilers/pge/PGE/OPTable.pir
View
@@ -10,7 +10,7 @@ PGE::OPTable - PGE operator precedence table and parser
=cut
-.namespace [ "PGE::OPTable" ]
+.namespace [ 'PGE';'OPTable' ]
.const int PGE_OPTABLE_EXPECT_TERM = 0x01
.const int PGE_OPTABLE_EXPECT_OPER = 0x02
@@ -91,7 +91,7 @@ Adds (or replaces) a syntactic category's defaults.
key = substr name, $I0
.local pmc sctable, token
- sctable = get_hll_global ["PGE::OPTable"], "%!sctable"
+ sctable = get_hll_global ['PGE';'OPTable'], '%!sctable'
$I0 = exists sctable[syncat]
if $I0 == 0 goto token_hash
token = sctable[syncat]
@@ -590,7 +590,7 @@ Adds (or replaces) a syntactic category's defaults.
end_1b:
$P0 = $P0[-1]
if null $P0 goto end_2
- $I0 = isa $P0, 'PGE::Match'
+ $I0 = isa $P0, ['PGE';'Match']
if $I0 goto end_1a
end_2:
unless rulename goto end_all
20 compilers/pge/PGE/P5Regex.pir
View
@@ -1,6 +1,6 @@
-.namespace [ "PGE::P5Regex" ]
+.namespace [ "PGE";"P5Regex" ]
.sub "compile_p5regex"
.param pmc source
@@ -43,7 +43,7 @@
.sub "p5regex"
.param pmc mob
.local pmc optable
- optable = get_hll_global ["PGE::P5Regex"], "$optable"
+ optable = get_hll_global ["PGE";"P5Regex"], "$optable"
$P0 = optable."parse"(mob)
.return ($P0)
.end
@@ -56,10 +56,10 @@
.sub "__onload" :load
.local pmc optable
- optable = new 'PGE::OPTable'
- set_hll_global ["PGE::P5Regex"], "$optable", optable
+ optable = new ['PGE';'OPTable']
+ set_hll_global ["PGE";"P5Regex"], "$optable", optable
- $P0 = get_hll_global ["PGE::P5Regex"], "parse_lit"
+ $P0 = get_hll_global ["PGE";"P5Regex"], "parse_lit"
optable.newtok('term:', 'precedence'=>'=', 'nows'=>1, 'parsed'=>$P0)
optable.newtok('term:\b', 'equiv'=>'term:', 'nows'=>1, 'match'=>'PGE::Exp::Anchor')
@@ -77,11 +77,11 @@
optable.newtok('circumfix:( )', 'equiv'=>'term:', 'nows'=>1, 'nullterm'=>1, 'match'=>'PGE::Exp::CGroup')
optable.newtok('circumfix:(?: )', 'equiv'=>'term:', 'nows'=>1, 'nullterm'=>1, 'match'=>'PGE::Exp::Group')
- $P0 = get_hll_global ['PGE::P5Regex'], 'parse_enumclass'
+ $P0 = get_hll_global ['PGE';'P5Regex'], 'parse_enumclass'
optable.newtok('term:[', 'precedence'=>'=', 'nows'=>1, 'parsed'=>$P0)
optable.newtok('term:.', 'precedence'=>'=', 'nows'=>1, 'parsed'=>$P0)
- $P0 = get_hll_global ['PGE::P5Regex'], 'parse_quant'
+ $P0 = get_hll_global ['PGE';'P5Regex'], 'parse_quant'
optable.newtok('postfix:*', 'looser'=>'term:', 'left'=>1, 'nows'=>1, 'parsed'=>$P0)
optable.newtok('postfix:+', 'equiv'=>'postfix:*', 'left'=>1, 'nows'=>1, 'parsed'=>$P0)
optable.newtok('postfix:?', 'equiv'=>'postfix:*', 'left'=>1, 'nows'=>1, 'parsed'=>$P0)
@@ -92,7 +92,7 @@
optable.newtok('close:}', 'looser'=>'infix:|', 'nows'=>1) # XXX: hack
- $P0 = get_hll_global ["PGE::P5Regex"], "compile_p5regex"
+ $P0 = get_hll_global ["PGE";"P5Regex"], "compile_p5regex"
compreg "PGE::P5Regex", $P0
.end
@@ -326,7 +326,7 @@
.end
-.namespace [ "PGE::Exp" ]
+.namespace [ "PGE";"Exp" ]
.sub "p5analyze" :method
.param pmc pad
@@ -344,7 +344,7 @@
.return (self)
.end
-.namespace [ "PGE::Exp::CGroup" ]
+.namespace [ "PGE";"Exp";"CGroup" ]
.sub "p5analyze" :method
.param pmc pad
62 compilers/pge/PGE/Perl6Regex.pir
View
@@ -18,7 +18,7 @@ or the resulting PIR code (target='PIR').
=cut
-.namespace [ 'PGE::Perl6Regex' ]
+.namespace [ 'PGE';'Perl6Regex' ]
.sub 'compile_perl6regex'
.param pmc source
@@ -77,11 +77,11 @@ or the resulting PIR code (target='PIR').
## If we're passed the results of a previous parse, use it.
.local pmc match, exp
- $I0 = isa source, 'PGE::Match'
+ $I0 = isa source, ['PGE';'Match']
if $I0 == 0 goto parse
$P0 = source['expr']
if null $P0 goto parse
- $I0 = isa $P0, 'PGE::Exp'
+ $I0 = isa $P0, ['PGE';'Exp']
if $I0 == 0 goto parse
match = source
goto analyze
@@ -153,7 +153,7 @@ needed for compiling regexes.
.include 'cclass.pasm'
-.namespace [ 'PGE::Perl6Regex' ]
+.namespace [ 'PGE';'Perl6Regex' ]
.sub '__onload' :load
.local pmc p6meta
@@ -162,7 +162,7 @@ needed for compiling regexes.
p6meta.'new_class'('PGE::Exp::Alias', 'parent'=>'PGE::Exp')
.local pmc optable
- optable = new 'PGE::OPTable'
+ optable = new ['PGE';'OPTable']
set_global '$optable', optable
$P0 = get_global 'parse_term'
@@ -267,13 +267,13 @@ needed for compiling regexes.
# Create and store closure preprocessors in %closure_pp
$P0 = new 'Hash'
- set_hll_global ['PGE::Perl6Regex'], '%closure_pp', $P0
- $P1 = get_hll_global ['PGE::Perl6Regex'], 'PIR_closure'
+ set_hll_global ['PGE';'Perl6Regex'], '%closure_pp', $P0
+ $P1 = get_hll_global ['PGE';'Perl6Regex'], 'PIR_closure'
$P0["PIR"] = $P1
# Create an array for holding stop tokens
$P0 = new 'ResizablePMCArray'
- set_hll_global ['PGE::Perl6Regex'], '@!stopstack', $P0
+ set_hll_global ['PGE';'Perl6Regex'], '@!stopstack', $P0
$P0 = get_global 'compile_perl6regex'
compreg 'PGE::Perl6Regex', $P0
@@ -301,7 +301,7 @@ Return a failed match if the stoptoken is found.
lastpos = length target
.local string stop
- $P0 = get_hll_global ['PGE::Perl6Regex'], '@!stopstack'
+ $P0 = get_hll_global ['PGE';'Perl6Regex'], '@!stopstack'
stop = $P0[-1]
$I0 = is_cclass .CCLASS_WHITESPACE, target, pos
@@ -1146,7 +1146,7 @@ Parse a modifier.
-.namespace [ 'PGE::Exp' ]
+.namespace [ 'PGE';'Exp' ]
.sub 'perl6exp' :method
.param pmc pad
@@ -1154,7 +1154,7 @@ Parse a modifier.
.end
-.namespace [ 'PGE::Exp::Literal' ]
+.namespace [ 'PGE';'Exp';'Literal' ]
.sub 'perl6exp' :method
.param pmc pad
@@ -1164,7 +1164,7 @@ Parse a modifier.
.end
-.namespace [ 'PGE::Exp::Concat' ]
+.namespace [ 'PGE';'Exp';'Concat' ]
.sub 'perl6exp' :method
.param pmc pad
@@ -1194,7 +1194,7 @@ Parse a modifier.
.end
-.namespace [ 'PGE::Exp::Quant' ]
+.namespace [ 'PGE';'Exp';'Quant' ]
.sub 'perl6exp' :method
.param pmc pad
@@ -1220,7 +1220,7 @@ Parse a modifier.
.end
-.namespace [ 'PGE::Exp::Group' ]
+.namespace [ 'PGE';'Exp';'Group' ]
.sub 'perl6exp' :method
.param pmc pad
@@ -1242,7 +1242,7 @@ Parse a modifier.
.end
-.namespace [ 'PGE::Exp::CGroup' ]
+.namespace [ 'PGE';'Exp';'CGroup' ]
.sub 'perl6exp' :method
.param pmc pad
@@ -1321,7 +1321,7 @@ Parse a modifier.
.end
-.namespace [ 'PGE::Exp::Subrule' ]
+.namespace [ 'PGE';'Exp';'Subrule' ]
.sub 'perl6exp' :method
.param pmc pad
@@ -1362,7 +1362,7 @@ Parse a modifier.
.end
-.namespace [ 'PGE::Exp::WS' ]
+.namespace [ 'PGE';'Exp';'WS' ]
.sub 'perl6exp' :method
.param pmc pad
@@ -1382,7 +1382,7 @@ Parse a modifier.
.end
-.namespace [ 'PGE::Exp::Alt' ]
+.namespace [ 'PGE';'Exp';'Alt' ]
.sub 'perl6exp' :method
.param pmc pad
@@ -1400,7 +1400,7 @@ Parse a modifier.
## if lhs is whitespace, then this is a prefix-alt and
## we ignore it (by simply returning its rhs)
- $I0 = isa exp0, 'PGE::Exp::WS'
+ $I0 = isa exp0, ['PGE';'Exp';'WS']
if $I0 == 0 goto with_lhs
.return exp1.'perl6exp'(pad)
with_lhs:
@@ -1433,7 +1433,7 @@ Parse a modifier.
.end
-.namespace [ 'PGE::Exp::Alias' ]
+.namespace [ 'PGE';'Exp';'Alias' ]
.sub 'perl6exp' :method
.param pmc pad
@@ -1449,14 +1449,14 @@ Parse a modifier.
## Otherwise, we need to create a capture group for this
## alias and return that.
- $I0 = isa exp1, 'PGE::Exp::CGroup'
+ $I0 = isa exp1, ['PGE';'Exp';'CGroup']
if $I0 == 1 goto make_alias
- $I0 = isa exp1, 'PGE::Exp::Subrule'
+ $I0 = isa exp1, ['PGE';'Exp';'Subrule']
if $I0 == 1 goto make_alias
- $I0 = isa exp1, 'PGE::Exp::Quant'
+ $I0 = isa exp1, ['PGE';'Exp';'Quant']
if $I0 == 0 goto add_cgroup
$P0 = exp1[0]
- $I0 = isa $P0, 'PGE::Exp::CGroup'
+ $I0 = isa $P0, ['PGE';'Exp';'CGroup']
if $I0 == 0 goto add_cgroup
$P0['cname'] = cname
goto end
@@ -1484,7 +1484,7 @@ Parse a modifier.
.end
-.namespace [ 'PGE::Exp::Modifier' ]
+.namespace [ 'PGE';'Exp';'Modifier' ]
.sub 'perl6exp' :method
.param pmc pad
@@ -1513,7 +1513,7 @@ Parse a modifier.
.return (exp)
.end
-.namespace [ 'PGE::Exp::Conj' ]
+.namespace [ 'PGE';'Exp';'Conj' ]
.sub 'perl6exp' :method
.param pmc pad
@@ -1527,7 +1527,7 @@ Parse a modifier.
.end
-.namespace [ 'PGE::Exp::Closure' ]
+.namespace [ 'PGE';'Exp';'Closure' ]
.sub 'perl6exp' :method
.param pmc pad
@@ -1537,7 +1537,7 @@ Parse a modifier.
lang = pad['lang']
self['lang'] = lang
# see if we need to do any pre-processing of the closure
- closure_pp = get_hll_global ['PGE::Perl6Regex'], '%closure_pp'
+ closure_pp = get_hll_global ['PGE';'Perl6Regex'], '%closure_pp'
$I0 = defined closure_pp[lang]
if $I0 == 0 goto end
closure_fn = closure_pp[lang]
@@ -1563,7 +1563,7 @@ already present.
=back
=cut
-.namespace [ 'PGE::Perl6Regex' ]
+.namespace [ 'PGE';'Perl6Regex' ]
.sub 'PIR_closure'
.param string code
@@ -1576,7 +1576,7 @@ already present.
.end
-.namespace [ 'PGE::Exp::Action' ]
+.namespace [ 'PGE';'Exp';'Action' ]
.sub 'perl6exp' :method
.param pmc pad
@@ -1586,7 +1586,7 @@ already present.
.end
-.namespace [ 'PGE::Exp::Cut' ]
+.namespace [ 'PGE';'Exp';'Cut' ]
.sub 'perl6exp' :method
.param pmc pad
2  compilers/pge/PGE/Regex.pir
View
@@ -9,7 +9,7 @@ a number of built-in rules.
=cut
-.namespace [ 'PGE::Match' ]
+.namespace [ 'PGE'; 'Match' ]
.include 'cclass.pasm'
.include 'interpinfo.pasm'
6 compilers/tge/TGE.pir
View
@@ -98,10 +98,10 @@ applies to a child of the current node (generally inherited attributes).
load_bytecode 'compilers/tge/TGE/Compiler.pbc'
# import <die> and <line_number> rules from PGE::Util
- $P0 = get_class ['TGE::Parser']
- $P1 = get_hll_global ['PGE::Util'], 'die'
+ $P0 = get_class ['TGE';'Parser']
+ $P1 = get_hll_global ['PGE';'Util'], 'die'
$P0.'add_method'('die', $P1)
- $P1 = get_hll_global ['PGE::Util'], 'line_number'
+ $P1 = get_hll_global ['PGE';'Util'], 'line_number'
$P0.'add_method'('line_number', $P1)
end:
2  compilers/tge/TGE/Compiler.pir
View
@@ -30,7 +30,7 @@ structure.
# Parse the source string and build a match tree
.local pmc match
.local pmc start_rule
- start_rule = find_global "TGE::Parser", "start"
+ start_rule = get_hll_global ['TGE';'Parser'], "start"
match = start_rule(source, 'grammar'=>'TGE::Parser')
# Verify the parse
unless match goto err_parse # if parse fails, stop
26 examples/past/01-sub.pir
View
@@ -31,54 +31,54 @@ roughly represents following Perl 6 code:
.param pmc args
.local pmc block
- block = new 'PAST::Block'
+ block = new ['PAST';'Block']
block.'init'( 'blocktype' => 'declaration', 'name' => 'foo' )
block.'symbol'( '$a', 'scope' => 'lexical' )
block.'symbol'( '$b', 'scope' => 'lexical' )
.local pmc stmts
- stmts = new 'PAST::Stmts'
+ stmts = new ['PAST';'Stmts']
stmts.'init'()
stmts.'attr'( 'source', 'my $a = 4; my $b = $a + 1; say( $b );', 1 )
block.'push'(stmts)
# $a = 4
- $P0 = new 'PAST::Val'
+ $P0 = new ['PAST';'Val']
$P0.'init'( 'value' => '4', 'returns' => 'Integer' )
$P0.'attr'( 'source', '4', 1 )
- $P1 = new 'PAST::Var'
+ $P1 = new ['PAST';'Var']
$P1.'init'( 'name' => '$a', 'viviself' => 'Undef', 'isdecl' => 1 )
$P1.'attr'( 'source', '$a', 1 )
- $P2 = new 'PAST::Op'
+ $P2 = new ['PAST';'Op']
$P2.'init'( $P1, $P0, 'pasttype' => 'copy', 'name' => 'infix:=', 'lvalue' => 1 )
$P2.'attr'( 'source', '=', 1 )
stmts.'push'($P2)
# $b = $a + 1
- $P0 = new 'PAST::Var'
+ $P0 = new ['PAST';'Var']
$P0.'init'( 'name' => '$a', 'viviself' => 'Undef' )
- $P1 = new 'PAST::Val'
+ $P1 = new ['PAST';'Val']
$P1.'init'( 'value' => '1', 'returns' => 'Integer')
- $P2 = new 'PAST::Op'
+ $P2 = new ['PAST';'Op']
$P2.'init'( $P0, $P1, 'name' => 'infix:+', 'pirop' => 'add')
- $P3 = new 'PAST::Var'
+ $P3 = new ['PAST';'Var']
$P3.'init'( 'name' => '$b', 'viviself' => 'Undef', 'isdecl' => 1 )
- $P4 = new 'PAST::Op'
+ $P4 = new ['PAST';'Op']
$P4.'init'( $P3, $P2, 'name' => 'infix:=', 'pasttype' => 'copy')
$P4.'attr'( 'source', '=', 1 )
stmts.'push'($P4)
# say($b)
- $P0 = new 'PAST::Var'
+ $P0 = new ['PAST';'Var']
$P0.'init'( 'name' => '$b' )
- $P1 = new 'PAST::Op'
+ $P1 = new ['PAST';'Op']
$P1.'init'( $P0, 'name' => 'say', 'pasttype' => 'call' )
stmts.'push'($P1)
# set up compiler, preliminary stages are removed because we
# already have a PAST data structure
.local pmc astcompiler
- astcompiler = new [ 'PCT::HLLCompiler' ]
+ astcompiler = new [ 'PCT';'HLLCompiler' ]
astcompiler.'removestage'('parse')
astcompiler.'removestage'('past')
6 examples/past/blocktype_immediate.pir
View
@@ -42,17 +42,17 @@ F<docs/pdds/pdd26_ast.pod>
# content of the block
.local pmc val_x
- val_x = new 'PAST::Val'
+ val_x = new ['PAST';'Val']
val_x.init( 'value' => '-536870912', 'returns' => 'Integer' )
# wrap the content in a block
.local pmc var_block
- var_block = new 'PAST::Block'
+ var_block = new ['PAST';'Block']
var_block.init( val_x, 'blocktype' => 'immediate' )
# set up compiler
.local pmc astcompiler
- astcompiler = new [ 'PCT::HLLCompiler' ]
+ astcompiler = new [ 'PCT';'HLLCompiler' ]
astcompiler.'removestage'('parse')
astcompiler.'removestage'('past')
30 examples/past/four_plus_one.pir
View
@@ -9,33 +9,33 @@
=for example
-"stmts" => PMC 'PAST::Stmts' {
+"stmts" => PMC ['PAST';'Stmts'] {
<source> => "4 + 1\n"
<pos> => 0
- [0] => PMC 'PAST::Op' {
+ [0] => PMC ['PAST';'Op'] {
<name> => "say"
<pasttype> => "call"
- [0] => PMC 'PAST::Op' {
+ [0] => PMC ['PAST';'Op'] {
<pasttype> => "bind"
- [0] => PMC 'PAST::Var' {
+ [0] => PMC ['PAST';'Var'] {
<name> => "last"
<scope> => "package"
<lvalue> => 1
}
- [1] => PMC 'PAST::Op' {
+ [1] => PMC ['PAST';'Op'] {
<name> => "infix:+"
<pasttype> => undef
<pirop> => "add"
<lvalue> => undef
<source> => "+"
<pos> => 2
- [0] => PMC 'PAST::Val' {
+ [0] => PMC ['PAST';'Val'] {
<value> => "4"
<returns> => "Integer"
<source> => "4"
<pos> => 0
}
- [1] => PMC 'PAST::Val' {
+ [1] => PMC ['PAST';'Val'] {
<value> => "1"
<returns> => "Integer"
<source> => "1"
@@ -63,36 +63,36 @@
.sub main :main
.local pmc val_4
- val_4 = new 'PAST::Val'
+ val_4 = new ['PAST';'Val']
val_4.init( 'value' => '4', 'returns' => 'Integer' )
.local pmc val_1
- val_1 = new 'PAST::Val'
+ val_1 = new ['PAST';'Val']
val_1.init( 'value' => '1', 'returns' => 'Integer' )
.local pmc op_add
- op_add = new 'PAST::Op'
+ op_add = new ['PAST';'Op']
op_add.init( val_4, val_1, 'name' => 'infix:+', 'pirop' => 'add' )
.local pmc var_last
- var_last = new 'PAST::Var'
+ var_last = new ['PAST';'Var']
var_last.init( 'name' => 'last', 'scope' => 'package', 'lvalue' => 1 )
.local pmc op_bind
- op_bind = new 'PAST::Op'
+ op_bind = new ['PAST';'Op']
op_bind.init( var_last, op_add, 'pasttype' => 'bind' )
.local pmc op_say
- op_say = new 'PAST::Op'
+ op_say = new ['PAST';'Op']
op_say.init( op_bind, 'name' => 'say', 'pasttype' => 'call' )
.local pmc stmts
- stmts = new 'PAST::Stmts'
+ stmts = new ['PAST';'Stmts']
stmts.'init'( op_say, 'name'=>'stmts' )
# compile to PIR and display
.local pmc astcompiler
- astcompiler = new [ 'PCT::HLLCompiler' ]
+ astcompiler = new [ 'PCT';'HLLCompiler' ]
astcompiler.'removestage'('parse')
astcompiler.'removestage'('past')
2  examples/pge/simple.pir
View
@@ -6,7 +6,7 @@
.local pmc p6rule
.local string op
- optable = new "PGE::OPTable"
+ optable = new ["PGE";"OPTable"]
store_global "Simple", "$optable", optable
p6rule = compreg "PGE::P6Rule"
2  languages/APL/APL.pir
View
@@ -35,7 +35,7 @@ object.
$P1.'parseactions'('APL::Grammar::Actions')
## tell PCT to always generate pmcs for Float constants
- $P0 = get_hll_global ['PAST::Compiler'], '%valflags'
+ $P0 = get_hll_global ['PAST';'Compiler'], '%valflags'
$P0['Float'] = ''
.end
1  languages/WMLScript/pmc/wmlsstring.pmc
View
@@ -432,6 +432,7 @@ Return the integer 2.
else {
SELF.morph(dynpmc_WmlsInvalid);
}
+ return pmc_new(INTERP, dynpmc_WmlsInvalid);
}
MULTI void i_subtract(WmlsInteger value) {
4 languages/c99/c99.pir
View
@@ -24,7 +24,7 @@ object.
=cut
-.namespace [ 'C99::Compiler' ]
+.namespace [ 'C99';'Compiler' ]
.loadlib 'c99_group'
@@ -58,7 +58,7 @@ to the C compiler.
.include 'src/gen_actions.pir'
-.namespace [ 'C99::Grammar' ]
+.namespace [ 'C99';'Grammar' ]
.sub 'debug'
.param pmc match
80 languages/c99/src/CPP_PASTNodes.pir
View
@@ -20,41 +20,37 @@ needed for C99. The currently defined ast nodes:
.include 'languages/c99/src/preamble'
.HLL 'C99', 'c99_group'
-.namespace [ 'C99::CPP::PAST' ]
+.namespace [ 'C99';'CPP';'PAST' ]
.sub '__onload' :load
- .local pmc base
- base = newclass 'C99::CPP::PAST::Node'
- addattribute base, 'children'
- addattribute base, 'source'
- addattribute base, 'pos'
- addattribute base, 'name'
- addattribute base, 'line'
-
- $P0 = subclass base, 'C99::CPP::PAST::IF_SECTION'
- $P0 = subclass base, 'C99::CPP::PAST::IFNDEF'
- $P0 = subclass base, 'C99::CPP::PAST::IFDEF'
- $P0 = subclass base, 'C99::CPP::PAST::IF'
- $P0 = subclass base, 'C99::CPP::PAST::ELIF'
- $P0 = subclass base, 'C99::CPP::PAST::ELSE'
- $P0 = subclass base, 'C99::CPP::PAST::DEFINE'
- $P0 = subclass base, 'C99::CPP::PAST::DEFINE_FUNCTION'
- $P0 = subclass base, 'C99::CPP::PAST::INCLUDE'
- $P0 = subclass base, 'C99::CPP::PAST::ERROR'
- $P0 = subclass base, 'C99::CPP::PAST::LINE'
- $P0 = subclass base, 'C99::CPP::PAST::PRAGMA'
- $P0 = subclass base, 'C99::CPP::PAST::SOURCE_LINE'
- $P0 = subclass base, 'C99::CPP::PAST::WSNWS'
+ .local pmc base, p6meta
+ p6meta = get_hll_global 'P6metaclass'
+ base = p6meta.'new_class'('C99::CPP::PAST::Node','attr'=>'children source pos name line')
+
+ $P0 = p6meta.'new_class'('C99::CPP::PAST::IF_SECTION','parent'=>'C99::CPP::PAST::Node')
+ $P0 = p6meta.'new_class'('C99::CPP::PAST::IFNDEF','parent'=>'C99::CPP::PAST::Node')
+ $P0 = p6meta.'new_class'('C99::CPP::PAST::IFDEF','parent'=>'C99::CPP::PAST::Node')
+ $P0 = p6meta.'new_class'('C99::CPP::PAST::IF','parent'=>'C99::CPP::PAST::Node')
+ $P0 = p6meta.'new_class'('C99::CPP::PAST::ELIF','parent'=>'C99::CPP::PAST::Node')
+ $P0 = p6meta.'new_class'('C99::CPP::PAST::ELSE','parent'=>'C99::CPP::PAST::Node')
+ $P0 = p6meta.'new_class'('C99::CPP::PAST::DEFINE','parent'=>'C99::CPP::PAST::Node')
+ $P0 = p6meta.'new_class'('C99::CPP::PAST::DEFINE_FUNCTION','parent'=>'C99::CPP::PAST::Node')
+ $P0 = p6meta.'new_class'('C99::CPP::PAST::INCLUDE','parent'=>'C99::CPP::PAST::Node')
+ $P0 = p6meta.'new_class'('C99::CPP::PAST::ERROR','parent'=>'C99::CPP::PAST::Node')
+ $P0 = p6meta.'new_class'('C99::CPP::PAST::LINE','parent'=>'C99::CPP::PAST::Node')
+ $P0 = p6meta.'new_class'('C99::CPP::PAST::PRAGMA','parent'=>'C99::CPP::PAST::Node')
+ $P0 = p6meta.'new_class'('C99::CPP::PAST::SOURCE_LINE','parent'=>'C99::CPP::PAST::Node')
+ $P0 = p6meta.'new_class'('C99::CPP::PAST::WSNWS','parent'=>'C99::CPP::PAST::Node')
$P0 = new 'Integer'
$P0 = 10
- set_hll_global ['C99::CPP::PAST'], 'serial_number', $P0
+ set_hll_global ['C99';'CPP';'PAST'], 'serial_number', $P0
.return ()
.end
-.namespace [ 'C99::CPP::PAST::Node' ]
+.namespace [ 'C99';'CPP';'PAST';'Node' ]
.sub 'attr' :method
.param string attrname
@@ -149,7 +145,7 @@ needed for C99. The currently defined ast nodes:
.sub 'node' :method
.param pmc node
- $I0 = isa node, 'C99::CPP::PAST::Node'
+ $I0 = isa node, ['C99';'CPP';'PAST';'Node']
if $I0 goto clone_past
clone_pge:
$S0 = node
@@ -191,7 +187,7 @@ counting at 10 (so that the values 0..9 can be considered "safe").
if has_fmt goto unique_1
fmt = ''
unique_1:
- $P0 = get_hll_global ['C99::CPP::PAST'], 'serial_number'
+ $P0 = get_hll_global ['C99';'CPP';'PAST'], 'serial_number'
$S0 = $P0
$S0 = concat fmt, $S0
inc $P0
@@ -266,35 +262,35 @@ counting at 10 (so that the values 0..9 can be considered "safe").
.end
-.namespace [ 'C99::CPP::PAST::Node' ]
+.namespace [ 'C99';'CPP';'PAST';'Node' ]
.gen_dumplist('children')
-.namespace [ 'C99::CPP::PAST::IF_SECTION' ]
+.namespace [ 'C99';'CPP';'PAST';