Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:parrot/parrot

  • Loading branch information...
commit 0851b2cd102ab8e7c6c731645cac3fdaa853c6b2 2 parents 285b502 + 3cfeb72
@Whiteknight Whiteknight authored
Showing with 1,132 additions and 44,647 deletions.
  1. +0 −14 .gitignore
  2. +7 −16 DEPRECATED.pod
  3. +0 −55 MANIFEST
  4. +0 −24 MANIFEST.SKIP
  5. +5 −0 NEWS
  6. +2 −0  PBC_COMPAT
  7. +0 −1  RESPONSIBLE_PARTIES
  8. +31 −0 compilers/data_json/data_json.pir
  9. +47 −40 compilers/data_json/data_json/pge2pir.tg
  10. +166 −118 compilers/pge/PGE/Exp.pir
  11. +1 −1  compilers/pge/PGE/Match.pir
  12. +1 −2  compilers/pge/PGE/Perl6Regex.pir
  13. +0 −18 compilers/pirc/Defines.mak
  14. +0 −407 compilers/pirc/README.pod
  15. +0 −244 compilers/pirc/Rules.mak
  16. +0 −38 compilers/pirc/TODO
  17. +0 −60 compilers/pirc/heredoc/heredocmain.c
  18. +0 −32 compilers/pirc/macro/lexer.h
  19. +0 −54 compilers/pirc/macro/macro.h
  20. +0 −718 compilers/pirc/macro/macro.l
  21. +0 −1,111 compilers/pirc/macro/macro.y
  22. +0 −3,605 compilers/pirc/macro/macrolexer.c
  23. +0 −490 compilers/pirc/macro/macrolexer.h
  24. +0 −2,682 compilers/pirc/macro/macroparser.c
  25. +0 −114 compilers/pirc/macro/macroparser.h
  26. +0 −1,339 compilers/pirc/src/bcgen.c
  27. +0 −315 compilers/pirc/src/bcgen.h
  28. +0 −2,958 compilers/pirc/src/hdocprep.c
  29. +0 −544 compilers/pirc/src/hdocprep.l
  30. +0 −404 compilers/pirc/src/main.c
  31. +0 −1,523 compilers/pirc/src/pir.l
  32. +0 −3,501 compilers/pirc/src/pir.y
  33. +0 −295 compilers/pirc/src/pircapi.c
  34. +0 −67 compilers/pirc/src/pircapi.h
  35. +0 −470 compilers/pirc/src/pircompiler.c
  36. +0 −265 compilers/pirc/src/pircompiler.h
  37. +0 −2,810 compilers/pirc/src/pircompunit.c
  38. +0 −1,063 compilers/pirc/src/pircompunit.h
  39. +0 −22 compilers/pirc/src/pirdefines.h
  40. +0 −1,104 compilers/pirc/src/piremit.c
  41. +0 −105 compilers/pirc/src/piremit.h
  42. +0 −102 compilers/pirc/src/pirerr.c
  43. +0 −47 compilers/pirc/src/pirerr.h
  44. +0 −21 compilers/pirc/src/pirheredoc.h
  45. +0 −5,349 compilers/pirc/src/pirlexer.c
  46. +0 −16 compilers/pirc/src/pirlexer.h
  47. +0 −375 compilers/pirc/src/pirmacro.c
  48. +0 −199 compilers/pirc/src/pirmacro.h
  49. +0 −333 compilers/pirc/src/pirop.c
  50. +0 −30 compilers/pirc/src/pirop.h
  51. +0 −6,380 compilers/pirc/src/pirparser.c
  52. +0 −312 compilers/pirc/src/pirparser.h
  53. +0 −984 compilers/pirc/src/pirpcc.c
  54. +0 −55 compilers/pirc/src/pirpcc.h
  55. +0 −694 compilers/pirc/src/pirregalloc.c
  56. +0 −132 compilers/pirc/src/pirregalloc.h
  57. +0 −875 compilers/pirc/src/pirsymbol.c
  58. +0 −238 compilers/pirc/src/pirsymbol.h
  59. +0 −36 compilers/pirc/src/piryy.h
  60. +0 −131 compilers/pirc/t/basic.t
  61. +0 −28 compilers/pirc/t/harness
  62. +0 −23 compilers/pirc/t/heredoc.t
  63. +0 −23 compilers/pirc/t/macro.t
  64. +0 −103 compilers/pirc/t/stmts.t
  65. +0 −23 compilers/pirc/t/subflags.t
  66. +8 −3 compilers/tge/TGE/Compiler.pir
  67. +1 −1  config/auto/ipv6.pm
  68. +7 −1 config/auto/warnings.pm
  69. +10 −14 config/gen/makefiles/root.in
  70. +3 −3 config/gen/platform/win32/pid.c
  71. +2 −2 config/init/defaults.pm
  72. +0 −7 docs/book/draft/appa_glossary.pod
  73. +2 −2 docs/book/draft/appd_build_options.pod
  74. +1 −1  docs/book/draft/ch01_introduction.pod
  75. +1 −1  docs/book/pct/ch01_introduction.pod
  76. +2 −2 docs/embed.pod
  77. +1 −1  docs/faq.pod
  78. +0 −7 docs/glossary.pod
  79. +1 −5 docs/imcc/imcfaq.pod
  80. +2 −5 docs/optable.pod
  81. +0 −2  docs/pdds/draft/pdd06_pasm.pod
  82. +1 −12 docs/pdds/pdd19_pir.pod
  83. +14 −14 examples/pir/sudoku.pir
  84. +10 −9 include/parrot/datatypes.h
  85. +2 −2 include/parrot/oplib/core_ops.h
  86. +137 −137 include/parrot/oplib/ops.h
  87. +137 −137 include/parrot/opsenum.h
  88. +1 −0  include/parrot/pointer_array.h
  89. +0 −22 lib/Parrot/Distribution.pm
  90. +0 −1  lib/Parrot/Docs/Section/Compilers.pm
  91. +3 −3 lib/Parrot/Harness/Smoke.pm
  92. +2 −2 lib/Parrot/Pmc2c/Emitter.pm
  93. +2 −2 lib/Parrot/Pmc2c/Method.pm
  94. +1 −1  lib/Parrot/Pmc2c/Pmc2cMain.pm
  95. +0 −9 lib/Parrot/Test.pm
  96. +31 −25 runtime/parrot/library/PGE/Perl6Grammar.pir
  97. +82 −2 runtime/parrot/library/PGE/Util.pir
  98. +1 −0  runtime/parrot/library/SDL.pir
  99. +10 −9 src/datatypes.c
  100. +0 −1  src/gc/fixed_allocator.c
  101. +4 −9 src/gc/gc_ms.c
  102. +2 −2 src/multidispatch.c
  103. +330 −330 src/ops/core_ops.c
  104. +0 −29 src/ops/experimental.ops
  105. +29 −0 src/ops/string.ops
  106. +5 −9 src/packdump.c
  107. +7 −4 src/packfile.c
  108. +1 −1  src/pmc.c
  109. +2 −2 src/pmc/boolean.pmc
  110. +0 −397 src/pmc/codestring.pmc
  111. +1 −0  src/pointer_array.c
  112. +0 −15 t/codingstd/linelength.t
  113. +6 −6 t/harness.pir
  114. +1 −1  t/op/cc_state.t
  115. +2 −2 t/op/gc-active-buffers.t
  116. +2 −2 t/perl/Parrot_Test.t
  117. +0 −232 t/pmc/codestring.t
  118. +1 −1  t/pmc/sub.t
  119. +1 −1  t/steps/auto/ipv6-01.t
  120. +1 −1  t/steps/auto/warnings-01.t
  121. +1 −1  t/tools/pbc_dump.t
  122. +1 −19 tools/install/smoke.pl
View
14 .gitignore
@@ -79,7 +79,6 @@
/pbc_to_exe
/pbc_to_exe.*
/perl6
-/pirc
/tags
/temp.file
/test
@@ -126,19 +125,6 @@
/compilers/pge/PGE.pbc
# generated from svn:ignore of 'compilers/pge/PGE/'
/compilers/pge/PGE/builtins_gen.pir
-# generated from svn:ignore of 'compilers/pirc/'
-/compilers/pirc/*.o
-/compilers/pirc/*.obj
-/compilers/pirc/*.pbd
-/compilers/pirc/pirc
-/compilers/pirc/pirc.exe
-# generated from svn:ignore of 'compilers/pirc/t/'
-/compilers/pirc/t/basic_?.pir
-/compilers/pirc/t/basic_??.pir
-/compilers/pirc/t/heredoc_?.pir
-/compilers/pirc/t/macro_?.pir
-/compilers/pirc/t/stmts_?.pir
-/compilers/pirc/t/subflags_?.pir
# generated from svn:ignore of 'compilers/tge/'
/compilers/tge/tgc.pbc
# generated from svn:ignore of 'compilers/tge/TGE/'
View
23 DEPRECATED.pod
@@ -49,10 +49,6 @@ L<https://trac.parrot.org/parrot/ticket/1580>
L<https://trac.parrot.org/parrot/ticket/1599>
-=item CodeString [eligible in 2.7]
-
-L<http://trac.parrot.org/parrot/ticket/1633>
-
=item multiple dispatch within core PMCs [eligible in 1.1]
L<https://trac.parrot.org/parrot/ticket/452>
@@ -204,12 +200,6 @@ These will be changed to allow more flexibility in types.
L<https://trac.parrot.org/parrot/ticket/1565>
-=item find_lex [eligible in 2.4]
-
-find_lex will not throw exception for non-existing lexicals.
-
-L<https://trac.parrot.org/parrot/ticket/1207>
-
=item inplace string updates. [eligible in 2.4]
All "inplace" string update ops are deprecated. E.g. "chopn_s", etc.
@@ -217,12 +207,6 @@ Part of COW removal.
L<https://trac.parrot.org/parrot/ticket/1540>
-=item find_codepoint [experimental]
-
-Intended to replace the CodeString charname_to_ord method.
-
-L<https://trac.parrot.org/parrot/ticket/1629>
-
=item finalize [experimental]
Finalize exception handler, unrolling inner runloops if needed.
@@ -357,6 +341,13 @@ L<https://trac.parrot.org/parrot/ticket/1564>
Load a .pbc file into the interpreter. Experimental.
+=item GC timely destruction [eligible in 3.1]
+
+All PIR ops and internal semantics related to timely destruction of PMCs
+is deprecated.
+
+L<http://trac.parrot.org/parrot/ticket/1800>
+
=back
=head1 Compiler tools
View
55 MANIFEST
@@ -107,59 +107,6 @@ compilers/pge/PGE/builtins.pg [pge]
compilers/pge/README.pod []doc
compilers/pge/Rules.mak [pge]
compilers/pge/STATUS [pge]
-compilers/pirc/Defines.mak [pirc]
-compilers/pirc/README.pod []doc
-compilers/pirc/Rules.mak [pirc]
-compilers/pirc/TODO [pirc]
-compilers/pirc/heredoc/heredocmain.c [pirc]
-compilers/pirc/macro/lexer.h [pirc]
-compilers/pirc/macro/macro.h [pirc]
-compilers/pirc/macro/macro.l [pirc]
-compilers/pirc/macro/macro.y [pirc]
-compilers/pirc/macro/macrolexer.c [pirc]
-compilers/pirc/macro/macrolexer.h [pirc]
-compilers/pirc/macro/macroparser.c [pirc]
-compilers/pirc/macro/macroparser.h [pirc]
-compilers/pirc/src/bcgen.c [pirc]
-compilers/pirc/src/bcgen.h [pirc]
-compilers/pirc/src/hdocprep.c [pirc]
-compilers/pirc/src/hdocprep.l [pirc]
-compilers/pirc/src/main.c [pirc]
-compilers/pirc/src/pir.l [pirc]
-compilers/pirc/src/pir.y [pirc]
-compilers/pirc/src/pircapi.c [pirc]
-compilers/pirc/src/pircapi.h [pirc]
-compilers/pirc/src/pircompiler.c [pirc]
-compilers/pirc/src/pircompiler.h [pirc]
-compilers/pirc/src/pircompunit.c [pirc]
-compilers/pirc/src/pircompunit.h [pirc]
-compilers/pirc/src/pirdefines.h [pirc]
-compilers/pirc/src/piremit.c [pirc]
-compilers/pirc/src/piremit.h [pirc]
-compilers/pirc/src/pirerr.c [pirc]
-compilers/pirc/src/pirerr.h [pirc]
-compilers/pirc/src/pirheredoc.h [pirc]
-compilers/pirc/src/pirlexer.c [pirc]
-compilers/pirc/src/pirlexer.h [pirc]
-compilers/pirc/src/pirmacro.c [pirc]
-compilers/pirc/src/pirmacro.h [pirc]
-compilers/pirc/src/pirop.c [pirc]
-compilers/pirc/src/pirop.h [pirc]
-compilers/pirc/src/pirparser.c [pirc]
-compilers/pirc/src/pirparser.h [pirc]
-compilers/pirc/src/pirpcc.c [pirc]
-compilers/pirc/src/pirpcc.h [pirc]
-compilers/pirc/src/pirregalloc.c [pirc]
-compilers/pirc/src/pirregalloc.h [pirc]
-compilers/pirc/src/pirsymbol.c [pirc]
-compilers/pirc/src/pirsymbol.h [pirc]
-compilers/pirc/src/piryy.h [pirc]
-compilers/pirc/t/basic.t [test]
-compilers/pirc/t/harness [test]
-compilers/pirc/t/heredoc.t [test]
-compilers/pirc/t/macro.t [test]
-compilers/pirc/t/stmts.t [test]
-compilers/pirc/t/subflags.t [test]
compilers/tge/Defines.mak [tge]
compilers/tge/README []doc
compilers/tge/Rules.mak [tge]
@@ -1384,7 +1331,6 @@ src/pmc/bytebuffer.pmc []
src/pmc/callcontext.pmc []
src/pmc/capture.pmc []
src/pmc/class.pmc []
-src/pmc/codestring.pmc []
src/pmc/complex.pmc []
src/pmc/continuation.pmc []
src/pmc/coroutine.pmc []
@@ -1877,7 +1823,6 @@ t/pmc/bytebuffer.t [test]
t/pmc/callcontext.t [test]
t/pmc/capture.t [test]
t/pmc/class.t [test]
-t/pmc/codestring.t [test]
t/pmc/complex.t [test]
t/pmc/config.t [test]
t/pmc/context.t [test]
View
24 MANIFEST.SKIP
@@ -116,28 +116,6 @@
^/compilers/pge/PGE/builtins_gen\.pir/
^/compilers/pge/PGE\.pbc$
^/compilers/pge/PGE\.pbc/
-^/compilers/pirc/.*\.o$
-^/compilers/pirc/.*\.o/
-^/compilers/pirc/.*\.obj$
-^/compilers/pirc/.*\.obj/
-^/compilers/pirc/.*\.pbd$
-^/compilers/pirc/.*\.pbd/
-^/compilers/pirc/pirc$
-^/compilers/pirc/pirc/
-^/compilers/pirc/pirc\.exe$
-^/compilers/pirc/pirc\.exe/
-^/compilers/pirc/t/basic_??\.pir$
-^/compilers/pirc/t/basic_??\.pir/
-^/compilers/pirc/t/basic_?\.pir$
-^/compilers/pirc/t/basic_?\.pir/
-^/compilers/pirc/t/heredoc_?\.pir$
-^/compilers/pirc/t/heredoc_?\.pir/
-^/compilers/pirc/t/macro_?\.pir$
-^/compilers/pirc/t/macro_?\.pir/
-^/compilers/pirc/t/stmts_?\.pir$
-^/compilers/pirc/t/stmts_?\.pir/
-^/compilers/pirc/t/subflags_?\.pir$
-^/compilers/pirc/t/subflags_?\.pir/
^/compilers/tge/TGE/Parser\.pir$
^/compilers/tge/TGE/Parser\.pir/
^/compilers/tge/tgc\.pbc$
@@ -446,8 +424,6 @@
^/pbc_to_exe\..*/
^/perl6$
^/perl6/
-^/pirc$
-^/pirc/
^/ports$
^/ports/
^/runtime/parrot/dynext/.*\.bundle$
View
5 NEWS
@@ -1,6 +1,11 @@
New in 2.11.0
- Core
+ Just In Time native call frame generation using LibFFI
+ + PIR op find_codepoint is no longer experimental, it is now supported
+ + All public functions in src/datatypes.c have been renamed to Parrot_dt_*
+- Languages
+ + PIRC
+ - left the nest and is currently at https://github.com/parrot/pirc/
New in 2.10.0
- Core
View
2  PBC_COMPAT
@@ -28,6 +28,8 @@
# please insert tab separated entries at the top of the list
+9.3 2010.11.24 NotFound move op find_codepoint out of experimental TT #1629
+9.2 2010.11.21 plobsing remove CodeString PMC
9.1 2010.10.27 nwellnhof remove charset ops
9.0 2010.10.19 gerd released 2.9.0
8.0 2010.07.20 coke released 2.6.0
View
1  RESPONSIBLE_PARTIES
@@ -56,7 +56,6 @@ Core Developer Jonathan Worthington
Compiler Developer Patrick Michaud (PGE, PCT)
Allison Randal (TGE)
- Klaas-Jan Stol (PIRC)
Platform Porter Allison Randal (Debian, Ubuntu)
Francois Perrad (MinGW32)
View
31 compilers/data_json/data_json.pir
@@ -52,6 +52,7 @@ the documentation at L<http://www.json.org/>.
.sub 'compile' :method
.param string json_string
+ .param pmc opts :slurpy :named
.local pmc parse, match
parse = get_root_global ['parrot'; 'JSON'], 'value'
@@ -67,6 +68,14 @@ the documentation at L<http://www.json.org/>.
pirbuilder = pirgrammar.'apply'(match)
pir = pirbuilder.'get'('result')
+ $I0 = exists opts['target']
+ unless $I0 goto no_targ
+ $S0 = opts['target']
+ unless $S0 == 'pir' goto not_pir
+ .return (pir)
+ not_pir:
+ no_targ:
+
.local pmc pirc, result
pirc = compreg 'PIR'
result = pirc(pir)
@@ -81,6 +90,28 @@ the documentation at L<http://www.json.org/>.
.HLL 'parrot'
+.sub unique_pmc_reg
+ $P0 = get_root_global ['parrot';'PGE';'Util'], 'unique'
+ $I0 = $P0()
+ $S0 = $I0
+ $S0 = concat "$P", $S0
+ .return ($S0)
+.end
+
+.sub appendln
+ .param pmc sb
+ .param string line
+ push sb, line
+ push sb, "\n"
+.end
+
+.sub 'sprintf'
+ .param string fmt
+ .param pmc args :slurpy
+ $S0 = sprintf fmt, args
+ .return ($S0)
+.end
+
.include 'compilers/data_json/data_json/grammar.pir'
.include 'compilers/data_json/data_json/pge2pir.pir'
View
87 compilers/data_json/data_json/pge2pir.tg
@@ -6,12 +6,13 @@ transform result (ROOT) {
$S0 = tree.'get'('pir', node, 'value')
- pir = new 'CodeString'
- pir.'emit'('.sub anon :anon')
- pir.'emit'($S0)
+ pir = new 'StringBuilder'
+ appendln(pir, '.sub anon :anon')
+ appendln(pir, $S0)
result = node['ret']
- pir.'emit'(' .return (%0)',result)
- pir.'emit'('.end')
+ $S0 = 'sprintf'(' .return (%Ss)', result)
+ appendln(pir, $S0)
+ appendln(pir, '.end')
.return(pir)
}
@@ -52,38 +53,37 @@ transform pir (value) {
.return (pir)
got_true:
- pir = new 'CodeString'
- result = pir.'unique'('$P')
- $S0 = node
- pir.'emit'(" %0 = new 'Boolean'", result)
- pir.'emit'(' %0 = 1', result, $S0)
+ pir = new 'StringBuilder'
+ result = unique_pmc_reg()
+ $S0 = 'sprintf'(" %Ss = new 'Boolean', 1", result)
+ appendln(pir, $S0)
node['ret'] = result
.return(pir)
got_false:
- pir = new 'CodeString'
- result = pir.'unique'('$P')
- $S0 = node
- pir.'emit'(" %0 = new 'Boolean'", result)
- pir.'emit'(' %0 = 0', result, $S0)
+ pir = new 'StringBuilder'
+ result = unique_pmc_reg()
+ $S0 = 'sprintf'(" %Ss = new 'Boolean', 0", result)
+ appendln(pir, $S0)
node['ret'] = result
.return(pir)
got_null:
- pir = new 'CodeString'
- result = pir.'unique'('$P')
- $S0 = node
- pir.'emit'(' null %0', result)
+ pir = new 'StringBuilder'
+ result = unique_pmc_reg()
+ $S0 = 'sprintf'(' null %Ss', result)
+ appendln(pir, $S0)
node['ret'] = result
.return(pir)
}
transform pir (object) {
.local pmc pir
- pir = new 'CodeString'
+ pir = new 'StringBuilder'
.local string result, child_result, key_result
- result = pir.'unique'('$P')
- pir.'emit'(" %0 = new 'Hash'", result)
+ result = unique_pmc_reg()
+ $S0 = 'sprintf'(" %Ss = new 'Hash'", result)
+ appendln(pir, $S0)
.local pmc items
@@ -106,16 +106,17 @@ loop:
child = shift it
$P0 = tree.'get'('pir', child, 'value')
$S0 = $P0
- pir .= $S0
+ push pir, $S0
child_result = child['ret']
key = shift key_iter
$P0 = tree.'get'('pir', key, 'string')
$S0 = $P0
- pir .= $S0
+ push pir, $S0
key_result = key['ret']
- pir.'emit'(' %0[%1] = %2', result, key_result, child_result)
+ $S0 = 'sprintf'(' %Ss[%Ss] = %Ss', result, key_result, child_result)
+ appendln(pir, $S0)
goto loop
@@ -127,10 +128,11 @@ end:
transform pir (array) {
.local pmc pir
- pir = new 'CodeString'
+ pir = new 'StringBuilder'
.local string result, child_result
- result = pir.'unique'('$P')
- pir.'emit'(" %0 = new 'ResizablePMCArray'", result)
+ result = unique_pmc_reg()
+ $S0 = 'sprintf'(" %Ss = new 'ResizablePMCArray'", result)
+ appendln(pir, $S0)
.local pmc items
@@ -147,10 +149,11 @@ loop:
child = shift it
$P0 = tree.'get'('pir', child, 'value')
$S0 = $P0
- pir .= $S0
+ push pir, $S0
child_result = child['ret']
- pir.'emit'(' push %0, %1', result, child_result)
+ $S0 = 'sprintf'(' push %Ss, %Ss', result, child_result)
+ appendln(pir, $S0)
goto loop
end:
node['ret'] = result
@@ -162,7 +165,7 @@ transform pir (string) {
.local pmc pir, result, children, it, child
.local string tmp
tmp = ''
- pir = new 'CodeString'
+ pir = new 'StringBuilder'
children = node['char']
if null children goto loop_end
it = iter children
@@ -190,21 +193,25 @@ transform pir (string) {
goto loop
loop_end:
- result = pir.'unique'('$P')
- $S1 = pir.'escape'(tmp)
- pir.'emit'(" %0 = new 'String'", result)
- pir.'emit'(' %0 = %1', result, $S1)
+ result = unique_pmc_reg()
+ $S0 = 'sprintf'(" %Ss = new 'String'", result)
+ appendln(pir, $S0)
+ $P0 = get_root_global ['parrot';'PGE';'Util'], 'pir_str_escape'
+ tmp = $P0(tmp)
+ $S0 = 'sprintf'(' %Ss = %Ss', result, tmp)
+ appendln(pir, $S0)
node['ret'] = result
.return(pir)
}
transform pir (number) {
.local pmc pir, result
- pir = new 'CodeString'
- result = pir.'unique'('$P')
- $S0 = node
- pir.'emit'(" %0 = new 'Integer'", result)
- pir.'emit'(' %0 = %1', result, $S0)
+ pir = new 'StringBuilder'
+ result = unique_pmc_reg()
+ $S0 = 'sprintf'(" %Ss = new 'Integer'", result)
+ appendln(pir, $S0)
+ $S0 = 'sprintf'(' %Ss = %Ss', result, node)
+ appendln(pir, $S0)
node['ret'] = result
.return(pir)
}
View
284 compilers/pge/PGE/Exp.pir
@@ -43,6 +43,8 @@ PGE::Exp - base class for expressions
p6meta.'new_class'('PGE::Exp::Modifier', 'parent'=>expproto)
p6meta.'new_class'('PGE::Exp::Closure', 'parent'=>expproto)
p6meta.'new_class'('PGE::Exp::Action', 'parent'=>expproto)
+
+ load_bytecode 'PGE/Util.pbc'
.end
@@ -65,7 +67,7 @@ C<target> adverbs.
if target == 'pge::exp' goto return_exp
.local pmc code
- code = new 'CodeString'
+ code = new 'StringBuilder'
.local pmc ns
ns = adverbs['namespace']
@@ -75,8 +77,9 @@ C<target> adverbs.
grammar = adverbs['grammar']
ns = split '::', grammar
ns_emit:
- $P0 = code.'key'(ns)
- code.'emit'('.namespace %0', $P0)
+ $P1 = get_root_global ['parrot';'PGE';'Util'], 'pir_key_escape'
+ $P0 = $P1(ns :flat)
+ code.'append_format'(".namespace %0\n", $P0)
ns_done:
$P0 = self.'root_pir'(adverbs :flat :named)
@@ -104,7 +107,7 @@ C<target> adverbs.
=item C<root_pir(PMC adverbs)>
-Return a CodeString object containing the entire expression
+Return a StringBuilder object containing the entire expression
tree as a PIR code object that can be compiled.
=cut
@@ -113,17 +116,20 @@ tree as a PIR code object that can be compiled.
.param pmc adverbs :slurpy :named
.local pmc code
- code = new 'CodeString'
+ code = new 'StringBuilder'
.local string name, namecorou
name = adverbs['name']
namecorou = concat name, '_corou'
if name > '' goto have_name
- name = code.'unique'('_regex')
+ $P0 = get_root_global ['parrot';'PGE';'Util'], 'unique'
+ name = $P0('_regex')
namecorou = concat name, '_corou'
have_name:
- name = code.'escape'(name)
- namecorou = code.'escape'(namecorou)
+ .local pmc escape
+ escape = get_root_global ['parrot';'PGE';'Util'], 'pir_str_escape'
+ name = escape(name)
+ namecorou = escape(namecorou)
.local string pirflags
pirflags = adverbs['pirflags']
@@ -132,7 +138,7 @@ tree as a PIR code object that can be compiled.
if $I0 >= 0 goto have_subid
$P0 = adverbs['subid']
if null $P0 goto have_subid
- $S0 = code.'escape'($P0)
+ $S0 = escape($P0)
pirflags = concat pirflags, ' :subid('
concat pirflags, $S0
concat pirflags, ')'
@@ -153,7 +159,7 @@ tree as a PIR code object that can be compiled.
## generate the PIR for the expression tree.
.local pmc expcode
- expcode = new 'CodeString'
+ expcode = new 'StringBuilder'
explabel = 'R'
exp.'pir'(expcode, explabel, 'succeed')
@@ -161,7 +167,7 @@ tree as a PIR code object that can be compiled.
## Generate the initial PIR code for a backtracking (uncut) rule.
.local string returnop
returnop = '.yield'
- code.'emit'(<<" CODE", name, pirflags, namecorou, .INTERPINFO_CURRENT_SUB)
+ code.'append_format'(<<" CODE", name, pirflags, namecorou, .INTERPINFO_CURRENT_SUB)
.sub %0 :method :nsentry %1
.param pmc adverbs :slurpy :named
.local pmc mob
@@ -190,7 +196,7 @@ tree as a PIR code object that can be compiled.
code_cutrule:
## Initial code for a rule that cannot be backtracked into.
returnop = '.return'
- code.'emit'(<<" CODE", name, pirflags)
+ code.'append_format'(<<" CODE", name, pirflags)
.sub %0 :method :nsentry %1
.param pmc adverbs :slurpy :named
.local pmc mob
@@ -208,27 +214,27 @@ tree as a PIR code object that can be compiled.
## generate the ustack only if we need it
.local string expstr
expstr = expcode
- code.'emit'(" .local pmc cstack")
- code.'emit'(" cstack = root_new ['parrot';'ResizableIntegerArray']")
+ code.'append_format'(" .local pmc cstack\n")
+ code.'append_format'(" cstack = root_new ['parrot';'ResizableIntegerArray']\n")
$I0 = index expstr, 'ustack'
if $I0 < 0 goto code_body_1
- code.'emit'(" .local pmc ustack")
- code.'emit'(" ustack = root_new ['parrot';'ResizablePMCArray']")
+ code.'append_format'(" .local pmc ustack\n")
+ code.'append_format'(" ustack = root_new ['parrot';'ResizablePMCArray']\n")
code_body_1:
## generate the gpad only if we need it
$I0 = index expstr, 'gpad'
if $I0 < 0 goto code_body_2
- code.'emit'(" .local pmc gpad")
- code.'emit'(" gpad = root_new ['parrot';'ResizablePMCArray']")
+ code.'append_format'(" .local pmc gpad\n")
+ code.'append_format'(" gpad = root_new ['parrot';'ResizablePMCArray']\n")
code_body_2:
## set the captscope if we need it
$I0 = index expstr, 'captscope'
if $I0 < 0 goto code_body_3
- code.'emit'(" .local pmc captscope, captob")
- code.'emit'(" captscope = mob")
+ code.'append_format'(" .local pmc captscope, captob\n")
+ code.'append_format'(" captscope = mob\n")
code_body_3:
- code.'emit'(<<" CODE", PGE_CUT_RULE, returnop)
+ code.'append_format'(<<" CODE", PGE_CUT_RULE, returnop)
.local int pos, rep, cutmark
try_match:
if cpos > lastpos goto fail_rule
@@ -255,7 +261,7 @@ tree as a PIR code object that can be compiled.
## add the "fail_match" target if we need it
$I0 = index expstr, 'fail_match'
if $I0 < 0 goto add_expcode
- code.'emit'(<<" CODE", PGE_CUT_MATCH)
+ code.'append_format'(<<" CODE", PGE_CUT_MATCH)
fail_match:
cutmark = %0
goto fail_cut
@@ -264,7 +270,7 @@ tree as a PIR code object that can be compiled.
add_expcode:
## add the expression code, then close off the sub
code .= expcode
- code.'emit'(" .end")
+ code.'append_format'(" .end\n")
.return (code)
.end
@@ -312,28 +318,47 @@ tree as a PIR code object that can be compiled.
.local int iscapture, isarray
cname = self['cname']
iscapture = self['iscapture']
- isarray = self['isarray']
- captgen = new 'CodeString'
- captsave = new 'CodeString'
- captback = new 'CodeString'
+ isarray = self['isarray']
+ captgen = new 'StringBuilder'
+ captsave = new 'StringBuilder'
+ captback = new 'StringBuilder'
if iscapture == 0 goto end
if isarray != 0 goto capt_array
- captsave.'emit'("captscope[%0] = captob", cname)
- captback.'emit'("delete captscope[%0]", cname)
+ push captsave, 'captscope['
+ push captsave, cname
+ push captsave, "] = captob\n"
+ push captback, 'delete captscope['
+ push captback, cname
+ push captback, "]\n"
goto end
capt_array:
- captsave.'emit'("$P2 = captscope[%0]\n push $P2, captob", cname)
- captback.'emit'("$P2 = captscope[%0]\n $P2 = pop $P2", cname)
- captgen.'emit'(<<" CODE", cname, label)
- $I0 = defined captscope[%0]
- if $I0 goto %1_cgen
- $P0 = root_new ['parrot';'ResizablePMCArray']
- captscope[%0] = $P0
- local_branch cstack, %1_cgen
- delete captscope[%0]
- goto fail
- %1_cgen:
- CODE
+ push captsave, '$P2 = captscope['
+ push captsave, cname
+ push captsave, "]\n"
+ push captsave, 'push $P2, captob'
+ push captback, '$P2 = captscope['
+ push captback, cname
+ push captback, "]\n"
+ push captback, '$P2 = pop $P2'
+ push captgen, '$I0 = defined captscope['
+ push captgen, cname
+ push captgen, "]\n"
+ push captgen, 'if $I0 goto '
+ push captgen, label
+ push captgen, "_cgen\n"
+ push captgen, "$P0 = root_new ['parrot';'ResizablePMCArray']\n"
+ push captgen, 'captscope['
+ push captgen, cname
+ push captgen, "] = $P0\n"
+ push captgen, 'local_branch cstack, '
+ push captgen, label
+ push captgen, "_cgen\n"
+ push captgen, 'delete captscope['
+ push captgen, cname
+ push captgen, "]\n"
+ push captgen, "goto fail\n"
+ push captgen, label
+ push captgen, "_cgen:\n"
end:
.return (captgen, captsave, captback)
.end
@@ -365,9 +390,10 @@ tree as a PIR code object that can be compiled.
literal = downcase literal
ignorecase_end:
- literal = code.'escape'(literal)
+ $P0 = get_root_global ['parrot';'PGE';'Util'], 'pir_str_escape'
+ literal = $P0(literal)
- code.'emit'(<<" CODE", litlen, literal, args :named :flat)
+ code.'append_format'(<<" CODE", litlen, literal, args :named :flat)
%L: # literal
$I0 = pos + %0
if $I0 > lastpos goto fail
@@ -441,17 +467,19 @@ tree as a PIR code object that can be compiled.
.param pmc code
.param string label
.param string next
+ .local pmc unique
+ unique = get_root_global ['parrot';'PGE';'Util'], 'unique'
.local pmc it, exp
- code.'emit'(' %0: # concat', label)
+ code.'append_format'(" %0: # concat\n", label)
$P0 = self.'list'()
it = iter $P0
exp = shift it
- $S0 = code.'unique'('R')
+ $S0 = unique('R')
iter_loop:
unless it goto iter_end
$P1 = shift it
- $S1 = code.'unique'('R')
+ $S1 = unique('R')
exp.'pir'(code, $S0, $S1)
exp = $P1
$S0 = $S1
@@ -502,6 +530,9 @@ tree as a PIR code object that can be compiled.
.param string label
.param string next
+ .local pmc unique
+ unique = get_root_global ['parrot';'PGE';'Util'], 'unique'
+
.local pmc exp, sep
.local string explabel, seplabel, replabel, nextlabel
exp = self[0]
@@ -521,11 +552,11 @@ tree as a PIR code object that can be compiled.
.local int backtrack
backtrack = self['backtrack']
- explabel = code.'unique'('R')
+ explabel = unique('R')
nextlabel = explabel
replabel = concat label, '_repeat'
if null sep goto outer_quant_1
- seplabel = code.'unique'('R')
+ seplabel = unique('R')
nextlabel = concat label, '_sep'
outer_quant_1:
@@ -540,7 +571,7 @@ tree as a PIR code object that can be compiled.
if $I0 != 0 goto bt_greedy_none
$I0 = self['max']
if $I0 != PGE_INF goto bt_greedy_none
- code.'emit'(<<" CODE", replabel, nextlabel, args :flat :named)
+ code.'append_format'(<<" CODE", replabel, nextlabel, args :flat :named)
%L: # quant 0..Inf greedy
%0:
push ustack, pos
@@ -552,7 +583,7 @@ tree as a PIR code object that can be compiled.
goto end
bt_none:
- $S0 = code.'unique'()
+ $S0 = unique()
args['c'] = $S0
args['C'] = ''
## handle 0..Inf as a special case
@@ -560,7 +591,7 @@ tree as a PIR code object that can be compiled.
if $I0 != 0 goto bt_greedy_none
$I0 = self['max']
if $I0 != PGE_INF goto bt_greedy_none
- code.'emit'(<<" CODE", replabel, nextlabel, args :flat :named)
+ code.'append_format'(<<" CODE", replabel, nextlabel, args :flat :named)
%L: # quant 0..Inf none
local_branch cstack, %0
if cutmark != %c goto fail
@@ -580,7 +611,7 @@ tree as a PIR code object that can be compiled.
bt_greedy_none:
## handle greedy or none
- code.'emit'(<<" CODE", replabel, nextlabel, args :flat :named)
+ code.'append_format'(<<" CODE", replabel, nextlabel, args :flat :named)
%L: # quant %Q greedy/none
push gpad, 0
local_branch cstack, %0
@@ -615,7 +646,7 @@ tree as a PIR code object that can be compiled.
bt_eager:
## handle eager backtracking
- code.'emit'(<<" CODE", replabel, nextlabel, args :flat :named)
+ code.'append_format'(<<" CODE", replabel, nextlabel, args :flat :named)
%L: # quant %Q eager
push gpad, 0
local_branch cstack, %0
@@ -640,7 +671,7 @@ tree as a PIR code object that can be compiled.
end:
if null sep goto sep_done
- code.'emit'(<<" CODE", nextlabel, explabel, seplabel)
+ code.'append_format'(<<" CODE", nextlabel, explabel, seplabel)
%0:
if rep == 1 goto %1
goto %2
@@ -703,8 +734,9 @@ tree as a PIR code object that can be compiled.
has_cutmark:
.local string exp0label
- exp0label = code.'unique'('R')
- code.'emit'(<<" CODE", label, exp0label, cutmark)
+ $P0 = get_root_global ['parrot';'PGE';'Util'], 'unique'
+ exp0label = $P0('R')
+ code.'append_format'(<<" CODE", label, exp0label, cutmark)
%0: # group %2
local_branch cstack, %1
if cutmark != %2 goto fail
@@ -723,7 +755,8 @@ tree as a PIR code object that can be compiled.
.param string next
.local string explabel, expnext
- explabel = code.'unique'('R')
+ $P0 = get_root_global ['parrot';'PGE';'Util'], 'unique'
+ explabel = $P0('R')
expnext = concat label, '_close'
.local pmc args
@@ -747,7 +780,7 @@ tree as a PIR code object that can be compiled.
args['X'] = '### '
isscope_end:
- code.'emit'(<<" CODE", captgen, captsave, captback, 'E'=>explabel, args :flat :named)
+ code.'append_format'(<<" CODE", captgen, captsave, captback, 'E'=>explabel, args :flat :named)
%L: # capture
%0
captob = captscope.'new'(captscope, 'pos'=>pos)
@@ -798,19 +831,22 @@ tree as a PIR code object that can be compiled.
.local pmc args
args = self.'getargs'(label, next)
+ .local pmc escape
+ escape = get_root_global ['parrot';'PGE';'Util'], 'pir_str_escape'
+
.local string subarg
subarg = ''
$I0 = exists self['arg']
if $I0 == 0 goto subarg_dba
subarg = self['arg']
- subarg = code.'escape'(subarg)
+ subarg = escape(subarg)
subarg = concat ', ', subarg
args['A'] = $S0
subarg_dba:
$I0 = exists self['dba']
if $I0 == 0 goto subarg_end
$S0 = self['dba']
- $S0 = code.'escape'($S0)
+ $S0 = escape($S0)
subarg .= ", 'dba'=>"
subarg .= $S0
subarg_end:
@@ -836,8 +872,9 @@ tree as a PIR code object that can be compiled.
$I0 -= 2
grammar = substr subname, 0, $I0
$P0 = split '::', grammar
- $P0 = code.'key'($P0)
- code.'emit'(<<" CODE", grammar, rname, $P0, args :flat :named)
+ $P1 = get_root_global ['parrot';'PGE';'Util'], 'pir_key_escape'
+ $P0 = $P1($P0 :flat)
+ code.'append_format'(<<" CODE", grammar, rname, $P0, args :flat :named)
%L: # grammar subrule %0::%1
captob = captscope.'new'(captscope, 'grammar'=>'%0')
captob.'to'(pos)
@@ -849,7 +886,7 @@ tree as a PIR code object that can be compiled.
## The subrule is of the form <rule>, which means we first look
## for a method on the current match object, otherwise we do a
## normal name lookup.
- code.'emit'(<<" CODE", subname, args :flat :named)
+ code.'append_format'(<<" CODE", subname, args :flat :named)
%L: # subrule %0
captob = captscope
$P0 = getattribute captob, '$.pos'
@@ -877,7 +914,7 @@ tree as a PIR code object that can be compiled.
## We either branch directly to the next node (PGE_BACKTRACK_NONE)
## or to a small subroutine below that will keep backtracking into
## the subrule until it no longer produces a match.
- code.'emit'(<<" CODE", PGE_CUT_MATCH, $S0, captgen, captsave, captback, subarg)
+ code.'append_format'(<<" CODE", PGE_CUT_MATCH, $S0, captgen, captsave, captback, subarg)
$P2 = adverbs['action']
captob = $P0(captob%5, 'action'=>$P2)
$P1 = getattribute captob, '$.pos'
@@ -892,7 +929,7 @@ tree as a PIR code object that can be compiled.
CODE
if $I0 == PGE_BACKTRACK_NONE goto end
## Repeatedly backtrack into the subrule until there are no matches.
- code.'emit'(<<" CODE", PGE_CUT_MATCH, $S0, next)
+ code.'append_format'(<<" CODE", PGE_CUT_MATCH, $S0, next)
%1:
pos = $P1
$P1 = getattribute captob, '&!corou'
@@ -919,7 +956,7 @@ tree as a PIR code object that can be compiled.
unless $I0 goto have_test
test = 'unless'
have_test:
- code.'emit'(<<" CODE", PGE_CUT_MATCH, test, next, subarg)
+ code.'append_format'(<<" CODE", PGE_CUT_MATCH, test, next, subarg)
captob = $P0(captob%3)
$P1 = getattribute captob, '$.pos'
if $P1 <= %0 goto fail_match
@@ -955,9 +992,10 @@ tree as a PIR code object that can be compiled.
.param string next
.local pmc exp0, exp1
.local string exp0label, exp1label
- exp0label = code.'unique'('R')
- exp1label = code.'unique'('R')
- code.'emit'(<<" CODE", label, exp0label, exp1label)
+ $P0 = get_root_global ['parrot';'PGE';'Util'], 'unique'
+ exp0label = $P0('R')
+ exp1label = $P0('R')
+ code.'append_format'(<<" CODE", label, exp0label, exp1label)
%0: # alt %1, %2
push ustack, pos
local_branch cstack, %1
@@ -1002,29 +1040,29 @@ tree as a PIR code object that can be compiled.
if token == '\B' goto anchor_word
anchor_fail:
- code.'emit'(" %0: # anchor fail %1", label, token)
- code.'emit'(" goto fail")
+ code.'append_format'(" %0: # anchor fail %1\n", label, token)
+ code.'append_format'(" goto fail\n")
.return ()
anchor_null:
- code.'emit'(" %0: # anchor null %1", label, token)
- code.'emit'(" goto %0", next)
+ code.'append_format'(" %0: # anchor null %1\n", label, token)
+ code.'append_format'(" goto %0\n", next)
.return ()
anchor_bos:
- code.'emit'(" %0: # anchor bos", label)
- code.'emit'(" if pos == 0 goto %0", next)
- code.'emit'(" goto fail")
+ code.'append_format'(" %0: # anchor bos\n", label)
+ code.'append_format'(" if pos == 0 goto %0\n", next)
+ code.'append_format'(" goto fail\n")
.return ()
anchor_eos:
- code.'emit'(" %0: # anchor eos", label)
- code.'emit'(" if pos == lastpos goto %0", next)
- code.'emit'(" goto fail")
+ code.'append_format'(" %0: # anchor eos\n", label)
+ code.'append_format'(" if pos == lastpos goto %0\n", next)
+ code.'append_format'(" goto fail\n")
.return ()
anchor_bol:
- code.'emit'(<<" CODE", label, next, .CCLASS_NEWLINE)
+ code.'append_format'(<<" CODE", label, next, .CCLASS_NEWLINE)
%0: # anchor bol
if pos == 0 goto %1
if pos == lastpos goto fail
@@ -1036,7 +1074,7 @@ tree as a PIR code object that can be compiled.
.return ()
anchor_eol:
- code.'emit'(<<" CODE", label, next, .CCLASS_NEWLINE)
+ code.'append_format'(<<" CODE", label, next, .CCLASS_NEWLINE)
%0: # anchor eol
$I1 = is_cclass %2, target, pos
if $I1 goto %1
@@ -1050,7 +1088,7 @@ tree as a PIR code object that can be compiled.
.return ()
anchor_word:
- code.'emit'(<<" CODE", label, next, .CCLASS_WORD, test)
+ code.'append_format'(<<" CODE", label, next, .CCLASS_WORD, test)
%0: # anchor word
$I0 = 0
if pos == 0 goto %0_1
@@ -1067,7 +1105,7 @@ tree as a PIR code object that can be compiled.
.return ()
anchor_word_left:
- code.'emit'(<<" CODE", label, next, .CCLASS_WORD)
+ code.'append_format'(<<" CODE", label, next, .CCLASS_WORD)
%0: # left word boundary
if pos >= lastpos goto fail
$I0 = is_cclass %2, target, pos
@@ -1081,7 +1119,7 @@ tree as a PIR code object that can be compiled.
.return ()
anchor_word_right:
- code.'emit'(<<" CODE", label, next, .CCLASS_WORD)
+ code.'append_format'(<<" CODE", label, next, .CCLASS_WORD)
%0: # right word boundary
if pos == 0 goto fail
$I0 = pos - 1
@@ -1139,16 +1177,16 @@ tree as a PIR code object that can be compiled.
.local int cclass, negate
$S0 = self.'ast'()
- code.'emit'(" %0: # cclass %1", label, $S0)
- code.'emit'(" if pos >= lastpos goto fail")
+ code.'append_format'(" %0: # cclass %1\n", label, $S0)
+ code.'append_format'(" if pos >= lastpos goto fail\n")
cclass = self['cclass']
negate = self['negate']
if cclass == .CCLASS_ANY goto end
- code.'emit'(" $I0 = is_cclass %0, target, pos", cclass)
- code.'emit'(" if $I0 == %0 goto fail", negate)
+ code.'append_format'(" $I0 = is_cclass %0, target, pos\n", cclass)
+ code.'append_format'(" if $I0 == %0 goto fail\n", negate)
end:
- code.'emit'(" inc pos")
- code.'emit'(" goto %0", next)
+ code.'append_format'(" inc pos\n")
+ code.'append_format'(" goto %0\n", next)
.return ()
.end
@@ -1167,7 +1205,7 @@ tree as a PIR code object that can be compiled.
backtrack = quant['backtrack']
## output initial label
- code.'emit'(" %L: # cclass %0 %Q", self, args :flat :named)
+ code.'append_format'(" %L: # cclass %0 %Q\n", self, args :flat :named)
.local int cclass, negate
cclass = self['cclass']
@@ -1178,16 +1216,16 @@ tree as a PIR code object that can be compiled.
if negate == 0 goto emit_find
negstr = ''
emit_find:
- code.'emit'(<<" CODE", negstr, cclass)
+ code.'append_format'(<<" CODE", negstr, cclass)
$I0 = find%0_cclass %1, target, pos, lastpos
rep = $I0 - pos
CODE
goto emit_pir
emit_dot:
- code.'emit'(" rep = lastpos - pos")
+ code.'append_format'(" rep = lastpos - pos\n")
emit_pir:
- code.'emit'(<<" CODE", args :flat :named)
+ code.'append_format'(<<" CODE", args :flat :named)
%Mif rep < %m goto fail
%Nif rep <= %n goto %L_1
%Nrep = %n
@@ -1198,7 +1236,7 @@ tree as a PIR code object that can be compiled.
if backtrack == PGE_BACKTRACK_EAGER goto bt_eager
bt_greedy:
- code.'emit'(<<" CODE", args :flat :named)
+ code.'append_format'(<<" CODE", args :flat :named)
pos += rep
%L_2:
if rep <= %m goto %S
@@ -1215,11 +1253,11 @@ tree as a PIR code object that can be compiled.
.return (1)
bt_none:
- code.'emit'(" pos += rep\n goto %0\n", next)
+ code.'append_format'(" pos += rep\n goto %0\n", next)
.return (1)
bt_eager:
- code.'emit'(<<" CODE", args :flat :named)
+ code.'append_format'(<<" CODE", args :flat :named)
%Mpos += %m
%Mrep -= %m
%L_2:
@@ -1252,8 +1290,8 @@ tree as a PIR code object that can be compiled.
group = get_hll_global ['PGE';'Exp'], '$!group'
cutmark = group['cutmark']
if cutmark > 0 goto has_cutmark
- $P1 = new 'CodeString'
- cutmark = $P1.'unique'()
+ $P1 = get_root_global ['parrot';'PGE';'Util'], 'unique'
+ cutmark = $P1()
group['cutmark'] = cutmark
has_cutmark:
self['cutmark'] = cutmark
@@ -1270,7 +1308,7 @@ tree as a PIR code object that can be compiled.
cutmark = self['cutmark']
if cutmark > 0 goto group_cutmark
- code.'emit'(<<" CODE", label, next, cutmark)
+ code.'append_format'(<<" CODE", label, next, cutmark)
%0: # cut rule or match
local_branch cstack, %1
cutmark = %2
@@ -1279,7 +1317,7 @@ tree as a PIR code object that can be compiled.
.return ()
group_cutmark:
- code.'emit'(<<" CODE", label, next, cutmark)
+ code.'append_format'(<<" CODE", label, next, cutmark)
%0: # cut %2
local_branch cstack, %1
cutmark = %2
@@ -1303,7 +1341,7 @@ tree as a PIR code object that can be compiled.
.local string cname
cname = self['cname']
- code.'emit'(<<" CODE", label, next, cname)
+ code.'append_format'(<<" CODE", label, next, cname)
%0: # scalar %2
$P0 = mob[%2]
$I0 = does $P0, 'array'
@@ -1335,9 +1373,12 @@ tree as a PIR code object that can be compiled.
.param string label
.param string next
+ .local pmc escape
+ escape = get_root_global ['parrot';'PGE';'Util'], 'pir_str_escape'
+
.local string charlist
$S0 = self.'ast'()
- charlist = code.'escape'($S0)
+ charlist = escape($S0)
.local string test
test = '<'
@@ -1352,7 +1393,7 @@ tree as a PIR code object that can be compiled.
incpos = '### zero width'
zerowidth_end:
- code.'emit'(<<" CODE", label, charlist, test, incpos, next)
+ code.'append_format'(<<" CODE", label, charlist, test, incpos, next)
%0: # enumcharlist %1
if pos >= lastpos goto fail
$S0 = substr target, pos, 1
@@ -1376,7 +1417,7 @@ tree as a PIR code object that can be compiled.
.param pmc code
.param string label
.param string next
- code.'emit'(<<" CODE", label, next, .CCLASS_NEWLINE)
+ code.'append_format'(<<" CODE", label, next, .CCLASS_NEWLINE)
%0: # newline
$I0 = is_cclass %2, target, pos
if $I0 == 0 goto fail
@@ -1410,11 +1451,12 @@ tree as a PIR code object that can be compiled.
.param string next
.local string exp0label, exp1label, chk0label, chk1label
- exp0label = code.'unique'('R')
- exp1label = code.'unique'('R')
+ $P0 = get_root_global ['parrot';'PGE';'Util'], 'unique'
+ exp0label = $P0('R')
+ exp1label = $P0('R')
chk0label = concat label, '_chk0'
chk1label = concat label, '_chk1'
- code.'emit'(<<" CODE", label, next, exp0label, chk0label, exp1label, chk1label)
+ code.'append_format'(<<" CODE", label, next, exp0label, chk0label, exp1label, chk1label)
%0: # conj %2, %4
push gpad, pos
push gpad, pos
@@ -1459,18 +1501,22 @@ tree as a PIR code object that can be compiled.
.param pmc code
.param string label
.param string next
+
+ .local pmc escape
+ escape = get_root_global ['parrot';'PGE';'Util'], 'pir_str_escape'
+
.local string value, lang
value = self.'ast'()
- lang = self['lang']
- value = code.'escape'(value)
- lang = code.'escape'(lang)
+ lang = self['lang']
+ value = escape(value)
+ lang = escape(lang)
## to prevent recompiling every execution, this code makes use of
## a global %!cache, keyed on the inline closure source. There
## could be a (unlikely) problem if the same source is sent to
## two different compilers. Also, if the sources can be lengthy
## we might be well served to use a hashed representation of
## the source.
- code.'emit'(<<" CODE", label, lang, value)
+ code.'append_format'(<<" CODE", label, lang, value)
%0: # closure
$S1 = %2
$P0 = get_hll_global ['PGE';'Match'], '%!cache'
@@ -1483,7 +1529,7 @@ tree as a PIR code object that can be compiled.
CODE
$I0 = self['iszerowidth']
if $I0 goto closure_zerowidth
- code.'emit'(<<" CODE", next)
+ code.'append_format'(<<" CODE", next)
mpos = pos
($P0 :optional, $I0 :opt_flag) = $P1(mob)
if $I0 == 0 goto %0
@@ -1504,7 +1550,7 @@ tree as a PIR code object that can be compiled.
unless $I0 goto have_test
test = 'unless'
have_test:
- code.'emit'(<<" CODE", test, next)
+ code.'append_format'(<<" CODE", test, next)
mpos = pos
$P0 = $P1(mob)
%0 $P0 goto %1
@@ -1524,17 +1570,19 @@ tree as a PIR code object that can be compiled.
.param pmc code
.param string label
.param string next
+ .local pmc escape
+ escape = get_root_global ['parrot';'PGE';'Util'], 'pir_str_escape'
.local string actionname, actionkey
- code.'emit'(" %0: # action", label)
+ code.'append_format'(" %0: # action\n", label)
actionname = self['actionname']
if actionname == '' goto end
- actionname = code.'escape'(actionname)
+ actionname = escape(actionname)
actionkey = self['actionkey']
if actionkey == '' goto have_actionkey
- actionkey = code.'escape'(actionkey)
+ actionkey = escape(actionkey)
actionkey = concat ', ', actionkey
have_actionkey:
- code.'emit'(<<" CODE", label, next, actionname, actionkey)
+ code.'append_format'(<<" CODE", label, next, actionname, actionkey)
$P1 = adverbs['action']
if null $P1 goto %1
$I1 = can $P1, %2
View
2  compilers/pge/PGE/Match.pir
@@ -63,7 +63,7 @@ is set or implied.
.local pmc target, grammar_class
issrcmatch = isa src, ['PGE';'Match']
if issrcmatch goto target_from_src
- target = new 'CodeString'
+ target = new 'String'
assign target, src
pos = 0
iscont = 1
View
3  compilers/pge/PGE/Perl6Regex.pir
@@ -242,8 +242,7 @@ and someday may be refactored to a different location.
$I0 = namepos - pos
$S0 = substr target, pos, $I0
$S0 = 'trim'($S0)
- $P0 = new 'CodeString'
- decnum = $P0.'charname_to_ord'($S0)
+ decnum = find_codepoint $S0
if decnum < 0 goto err_unicode_name
pos = namepos
goto scan_xco_char_end
View
18 compilers/pirc/Defines.mak
@@ -1,18 +0,0 @@
-PIRC_O_FILES = \
- compilers/pirc/src/main$(O) \
- compilers/pirc/src/pirparser$(O) \
- compilers/pirc/src/pirlexer$(O) \
- compilers/pirc/src/pircompunit$(O) \
- compilers/pirc/src/pircompiler$(O) \
- compilers/pirc/src/pirsymbol$(O) \
- compilers/pirc/src/piremit$(O) \
- compilers/pirc/src/hdocprep$(O) \
- compilers/pirc/src/pirmacro$(O) \
- compilers/pirc/src/pirregalloc$(O) \
- compilers/pirc/src/bcgen$(O) \
- compilers/pirc/src/pirpcc$(O) \
- compilers/pirc/src/pirerr$(O) \
- compilers/pirc/src/pircapi$(O) \
- compilers/pirc/src/pirop$(O)
-
-PIRC_CLEANUPS = $(PIRC_O_FILES) "compilers/pirc/t/*.pir" ./pirc$(EXE)
View
407 compilers/pirc/README.pod
@@ -1,407 +0,0 @@
-# Copyright (C) 2001-2009, Parrot Foundation.
-
-=head1 NAME
-
-README.txt - Readme file for PIRC compiler.
-
-=head1 DESCRIPTION
-
-PIRC is a fresh implementation of the PIR language using Bison and Flex.
-Its main features are:
-
-=over 4
-
-=item * thread-safety, so it is reentrant.
-
-=item * strength reduction, implemented in the parser.
-
-=item * constant folding, implemented in the parser.
-
-=item * checks for proper use of op arguments in PIR syntax (disallowing, e.g.: $S0 = print)
-
-=item * allow multiple heredocs in subroutine invocations (like: foo(<<'A', <<'B', <<'C') )
-
-=item * register usage optimization
-
-=back
-
-=head2 Compiling and Running
-
-=head3 Windows using Microsoft Visual Studio
-
-To compile PIRC on windows using MSVC:
-
- nmake
-
-When running PIRC, it needs the shared library C<libparrot>; an easy way to do
-this is copy C<libparrot.dll> in the Parrot root directory to C<compilers/pirc/src>.
-
-Running PIRC is as easy as:
-
- pirc test.pir
-
-See 'pirc -h' for help.
-
-=head3 Linux using GCC
-
-The Makefile should work fine on Linux:
-
- cd compilers/pirc && make
-
-When running PIRC, it needs the shared library C<libparrot>; in order to let
-PIRC find it, set the path as follows:
-
- export LD_LIBRARY_PATH=../../../blib/lib
-
-Running is as easy as:
-
- ./pirc test.pir
-
-=head2 Overview
-
-The new Bison/Flex based implementation of the PIR compiler is designed
-as a two-stage compiler:
-
-=over 4
-
-=item 1. Heredoc preprocessor
-
-=item 2. PIR compiler
-
-=back
-
-=head2 Heredoc preprocessing
-
-The heredoc preprocessor takes the input as written by the PIR programmer,
-and flattens out all heredoc strings. An example is shown below to illustrate
-this concept:
-
-The following input:
-
- .sub main
- $S0 = <<'EOS'
- This is a heredoc string
- divided
- over
- five
- lines.
- EOS
- .end
-
-is transformed into:
-
- .sub
- $S0 = "This is a heredoc string\n divided\n over\n five\n lines.\n"
- .end
-
-In order to allow C<.include>d file to have heredoc strings, the heredoc preprocessor
-also handles the C<.include> directive, even though logically this is a macro function.
-See the discussion below for how the C<.include> directive works.
-
-=head2 PIR compilers
-
-The PIR compiler parses the output of the heredoc preprocessor. PIRC's lexer also
-handles macros.
-
-The macro layer basically implements text replacements. The following directives are handled:
-
-=over 4
-
-=item C<.macro>
-
-=item C<.macro_const>
-
-=item C<.macro_local>
-
-=item C<.macro_label>
-
-=back
-
-=head3 C<.include>
-
-The C<.include> directive takes a string argument, which is the name of a file. The
-contents of this file are inserted at the point where the C<.include> directive
-is written. To illustrate this, consider the following example:
-
- main.pir:
- ========================
- .sub main
- print "hi\n"
- foo()
- .end
-
- .include "lib.pir"
- ========================
-
- lib.pir:
- ========================
- .sub foo
- print "foo\n"
- .end
- ========================
-
-This will result in the following output:
-
- .sub main
- print "hi\n"
- foo()
- .end
-
- .sub foo
- print "foo\n"
- .end
-
-
-=head3 C<.macro>
-
-The macro directive starts a macro definition. The macro preprocessor
-implements the expansion of macros. For instance, given the following input:
-
- .macro say(msg)
- print .msg
- print "\n"
- .endm
-
- .sub main
- .say("hi there!")
- .end
-
-will result in this output:
-
- .sub main
- print "hi there!"
- print "\n"
- .end
-
-=head3 C<.macro_const>
-
-The C<.macro_const> directive is similar to the C<.macro> directive, except
-that a C<.macro_const> is just a simplified C<.macro>; it merely gives a name
-to some constant:
-
- .macro_const PI 3.14
-
- .sub main
- print "PI is approximately: "
- print .PI
- print "\n"
- .end
-
-This will result in the output:
-
- .sub main
- print "PI is approximately: "
- print 3.14
- print "\n"
- .end
-
-
-=head3 PIR compiler
-
-As Parrot instructions are polymorphic, the PIR compiler is responsible for
-selecting the right variant of the instruction. The selection is based on the
-types of the operands. For instance:
-
- set $I0, 42
-
-will select the C<set_i_ic> instruction: this is the C<set> instruction, taking
-an integer (i) result operand and an integer constant (ic) operand. Other examples
-are:
-
- $P0[1] = 42 --> set_p_kic_ic # kic = key integer constant
- $I0 = $P0["hi"] --> set_i_p_kc # kc = key constant from constant table
- $P1 = new "Hash" --> new_p_sc # sc = string constant
-
-=head3 Constant folding
-
-Expressions that can be evaluated at compile-time are pre-evaluated, saving
-calculations during runtime. Some constant-folding is required, as Parrot
-depends on this. For instance:
-
- add $I0, 1, 2
-
-is not a valid Parrot instruction; there is no C<add_i_ic_ic> instruction.
-Instead, this will be translated to:
-
- set $I0, 3
-
-which, as was explained earlier, will select the C<set_i_ic> instruction.
-
-The conditional branch instructions are also pre-evaluated, if possible. For
-instance, consider the following statement:
-
- if 1 < 2 goto L1
-
-It is clear during compile time, that 1 is smaller than 2; so instead of
-evaluating this during runtime, we know for sure that the branch to label
-C<L1> will be made, effectively replacing the above statement by:
-
- goto L1
-
-Likewise, if it's clear that certain instructions don't have any effect,
-they can be removed altogether:
-
- if 1 > 2 goto L1 --> nop # nop is no opcode.
- $I0 = $I0 + 0 --> nop
-
-Another type of optimization is the selection of (slightly) more efficient
-variants of instructions. For instance, consider the following instruction:
-
- $I0 = $I0 + $I1
-
-which is actually syntactic sugar for:
-
- add $I0, $I0, $I1
-
-In C one would write (ignoring the fact that $I0 and $I0 are not a valid C
-identifiers):
-
- $I0 += $I1
-
-which is in fact valid PIR as well. When the PIR parser sees an instruction
-of this form, it will automatically select the variant with 2 operands
-instead of the 3-operand variant. So:
-
- add $I0, $I0, $1 # $I0 is an out operand
-
-will be optimized, as if you had written:
-
- add $I0, $I1 # $I0 is an in/out operand
-
-The PIR parser can do even more improvements, if it sees opportunity to do so.
-Consider the following statement:
-
- $I0 = $I0 + 1
-
-or, in Parrot assembly syntax:
-
- add $I0, $I0, 1
-
-Again, in C one would write (again ignoring the valid identifier issue): C<$I0++>,
-or in other words, C<incrementing> the given identifier. Parrot has C<inc> and C<dec>
-instructions built-in as well, so that the above statement C<$I0 = $I0 + 1> can be
-optimized to:
-
- inc $I0
-
-=head3 Vanilla Register Allocator
-
-The PIR compiler implements a vanilla register allocator. This means that each
-declared C<.local> or C<.param> symbol, and each PIR register ($Px, $Sx, $Ix, $Nx)
-is assigned a unique PASM register, that is associated with the original symbol
-or PIR register throughout the subroutine.
-
-PIRC has a register optimizer, which can optimize the register usage. Run PIRC
-with the C<-r> option to activate this. The register optimizer is implemented
-using a Linear Scan Register allocator.
-
-The implementation of the vanilla register allocator is done in the PIR symbol
-management module (C<pirsymbol.c>).
-
-=head2 Register optimizer
-
-PIRC has a register optimizer, which uses a Linear Scan Register algorithm.
-For each symbolic register, a live-interval object is created, which has
-an I<start> and I<end> point, indicating the first and last usage of that
-symbolic register in the sub. The register optimizer figures out when
-symbolic registers don't overlap, in which case they can use the same
-register (assuming they're of the same type).
-
-=head2 Status
-
-Bytecode generation is done, but there is the occasional bug. These
-are reported in trac.parrot.org.
-
-
-=head1 IMPLEMENTATION
-
-The directory compilers/pirc has a number of subdirectories:
-
-=over 4
-
-=item doc - contains documentation.
-
-=item heredoc - contains the implementation of the heredoc preprocessor. This is now
-integrated with pirc/src. It now only has a driver program to build a stand-alone
-heredoc preprocessor.
-
-=item src - contains the Bison/Flex implementation of PIRC
-
-=item t - for tests. Tests input is fed into Parrot after compilation,
-which will run the code.
-
-=item macro - contains the old implementation of the macro preprocessor. This is now
-integrated with pirc/src. These files are kept as a reference until the macro
-preprocessor in pirc/src is completed.
-
-=back
-
-=head1 MAKING CHANGES
-
-If you want to make changes to the lexer of parser files, you will need the Flex
-and/or Bison programs. There are ports available for Windows, but I don't know
-whether they're any good. I use Cygwin's tools.
-
-=head2 Updating the lexer
-
-The heredoc preprocessor is implemented in C<hdocprep.l>, and can be regenerated
-using:
-
- cd compilers/pirc/src
- flex hdocprep.l
-
-PIRC's normal lexer is implemented in C<pir.l>, and can be regenerated using:
-
- cd compilers/pirc/src
- flex pir.l
-
-=head2 Updating the parser
-
-The parser is implemented in C<pir.y>, and can be regenerated using:
-
- cd compilers/pirc/src
- bison pir.y
-
-=head1 NOTES
-
-
-=head2 Cygwin processable lexer spec.
-
-The file C<pir.l> from which the lexer is generated is I<not> processable by Cygwin's
-default version of Flex. In order to make a reentrant lexer, a newer version is needed,
-which can be downloaded from the link below.
-
-L<http://sourceforge.net/project/downloading.php?groupname=flex&filename=flex-2.5.33.tar.gz&use_mirror=belnet>
-
-Just do:
-
- $ ./configure
- $ make
-
-Then make sure to overwrite the supplied flex binary.
-
-=head1 BUGS
-
-Having a look at this implementation would be greatly appreciated, and any resulting
-feedback even more :-). Please post bug reports in trac.parrot.org.
-
-
-=head1 SEE ALSO
-
-See also:
-
-=over 4
-
-=item * C<languages/PIR> for a PGE based implementation.
-
-=item * C<compilers/imcc>, the current I<standard> PIR implementation.
-
-=item * C<docs/imcc/syntax.pod> for a description of PIR syntax.
-
-=item * C<docs/imcc/> for more documentation about the PIR language.
-
-=item * C<docs/pdds/pdd19_pir.pod> for the PIR design document.
-
-=back
-
-=cut
View
244 compilers/pirc/Rules.mak
@@ -1,244 +0,0 @@
-compilers/pirc/src/piremit$(O) : $(PARROT_H_HEADERS) \
- compilers/pirc/src/piremit.c \
- compilers/pirc/src/piremit.h \
- compilers/pirc/src/pircompunit.h \
- compilers/pirc/src/pircompiler.h \
- compilers/pirc/src/pirerr.h \
- compilers/pirc/src/bcgen.h \
- compilers/pirc/src/pirdefines.h \
- compilers/pirc/src/pirmacro.h \
- compilers/pirc/src/pirregalloc.h \
- compilers/pirc/src/pirsymbol.h \
- compilers/pirc/src/piryy.h \
- $(INC_DIR)/embed.h \
- $(INC_DIR)/oplib/ops.h
-
-compilers/pirc/src/pirparser$(O) : $(PARROT_H_HEADERS) \
- compilers/pirc/src/pirparser.c \
- compilers/pirc/src/pircompiler.h \
- compilers/pirc/src/pircompunit.h \
- compilers/pirc/src/pirdefines.h \
- compilers/pirc/src/pirparser.h \
- compilers/pirc/src/piryy.h \
- compilers/pirc/src/pirlexer.h \
- compilers/pirc/src/pirerr.h \
- compilers/pirc/src/pirop.h \
- compilers/pirc/src/pirpcc.h \
- compilers/pirc/src/pirmacro.h \
- compilers/pirc/src/pirregalloc.h \
- compilers/pirc/src/pirsymbol.h \
- compilers/pirc/src/bcgen.h \
- $(INC_DIR)/oplib/ops.h \
- $(INC_DIR)/embed.h
-
-compilers/pirc/src/pirerr$(O) : $(PARROT_H_HEADERS) \
- compilers/pirc/src/pirerr.c \
- compilers/pirc/src/pircompiler.h \
- compilers/pirc/src/pircompunit.h \
- compilers/pirc/src/pirdefines.h \
- compilers/pirc/src/pirparser.h \
- compilers/pirc/src/piryy.h \
- compilers/pirc/src/pirlexer.h \
- compilers/pirc/src/pirerr.h \
- compilers/pirc/src/pirmacro.h \
- compilers/pirc/src/pirregalloc.h \
- compilers/pirc/src/pirsymbol.h \
- compilers/pirc/src/bcgen.h \
- $(INC_DIR)/embed.h
-
-compilers/pirc/src/bcgen$(O) : \
- compilers/pirc/src/bcgen.c \
- compilers/pirc/src/pirsymbol.h \
- compilers/pirc/src/pircompiler.h \
- compilers/pirc/src/pirregalloc.h \
- compilers/pirc/src/pircompunit.h \
- compilers/pirc/src/pirdefines.h \
- compilers/pirc/src/pirmacro.h \
- compilers/pirc/src/bcgen.h \
- $(PARROT_H_HEADERS) \
- $(INC_DIR)/embed.h \
- include/pmc/pmc_sub.h \
- include/pmc/pmc_namespace.h
-
-compilers/pirc/src/pirregalloc$(O) : $(PARROT_H_HEADERS) \
- compilers/pirc/src/pirregalloc.c \
- compilers/pirc/src/pircompiler.h \
- compilers/pirc/src/pircompunit.h \
- compilers/pirc/src/pirdefines.h \
- compilers/pirc/src/pirmacro.h \
- compilers/pirc/src/pirregalloc.h \
- compilers/pirc/src/pirsymbol.h \
- compilers/pirc/src/bcgen.h \
- $(INC_DIR)/embed.h
-
-compilers/pirc/heredoc/heredocmain$(O) : $(PARROT_H_HEADERS) \
- compilers/pirc/heredoc/heredocmain.c \
-
-compilers/pirc/macro/macrolexer$(O) : $(PARROT_H_HEADERS) \
- compilers/pirc/macro/macrolexer.c \
- compilers/pirc/macro/macro.h \
- compilers/pirc/macro/lexer.h \
- compilers/pirc/macro/macroparser.h
-
-compilers/pirc/macro/macroparser$(O) : $(PARROT_H_HEADERS) \
- compilers/pirc/macro/macroparser.c \
- compilers/pirc/macro/macro.h \
- compilers/pirc/macro/lexer.h \
- compilers/pirc/macro/macroparser.h \
- compilers/pirc/macro/macrolexer.h
-
-compilers/pirc/src/hdocprep$(O) : $(PARROT_H_HEADERS) \
- $(INC_DIR)/embed.h compilers/pirc/src/pirheredoc.h \
- compilers/pirc/src/hdocprep.c
-
-compilers/pirc/src/main$(O) : \
- $(PARROT_H_HEADERS) \
- $(INC_DIR)/embed.h \
- compilers/pirc/src/main.c \
- compilers/pirc/src/bcgen.h \
- compilers/pirc/src/pirparser.h \
- compilers/pirc/src/pircompiler.h \
- compilers/pirc/src/pircompunit.h \
- compilers/pirc/src/pirmacro.h \
- compilers/pirc/src/pirdefines.h \
- compilers/pirc/src/piremit.h \
- compilers/pirc/src/piryy.h \
- compilers/pirc/src/pirlexer.h \
- compilers/pirc/src/pirheredoc.h \
- compilers/pirc/src/pirsymbol.h \
- compilers/pirc/src/pirregalloc.h \
- compilers/pirc/src/pircapi.h
-
-compilers/pirc/src/pircapi$(O) : \
- $(PARROT_H_HEADERS) \
- compilers/pirc/src/pircapi.c \
- compilers/pirc/src/bcgen.h \
- compilers/pirc/src/pircompiler.h \
- compilers/pirc/src/pirparser.h \
- compilers/pirc/src/pircompunit.h \
- compilers/pirc/src/pirsymbol.h \
- compilers/pirc/src/pirregalloc.h \
- compilers/pirc/src/pirmacro.h \
- compilers/pirc/src/pirdefines.h \
- compilers/pirc/src/piremit.h \
- compilers/pirc/src/piryy.h \
- compilers/pirc/src/pirlexer.h \
- compilers/pirc/src/pircapi.h \
- $(INC_DIR)/embed.h
-
-compilers/pirc/src/pircompiler$(O) : \
- compilers/pirc/src/pircompiler.c \
- compilers/pirc/src/pircompiler.h \
- $(PARROT_H_HEADERS) \
- compilers/pirc/src/piryy.h \
- compilers/pirc/src/pirmacro.h \
- compilers/pirc/src/pirregalloc.h \
- compilers/pirc/src/pirerr.h \
- compilers/pirc/src/bcgen.h \
- compilers/pirc/src/pircompunit.h \
- compilers/pirc/src/pirsymbol.h \
- compilers/pirc/src/pirdefines.h \
- $(INC_DIR)/embed.h
-
-compilers/pirc/src/pircompunit$(O) : $(PARROT_H_HEADERS) \
- compilers/pirc/src/pircompunit.c \
- compilers/pirc/src/pircompunit.h \
- compilers/pirc/src/pircompiler.h \
- compilers/pirc/src/pirsymbol.h \
- compilers/pirc/src/piryy.h \
- compilers/pirc/src/pirdefines.h \
- compilers/pirc/src/pirregalloc.h \
- compilers/pirc/src/pirpcc.h \
- compilers/pirc/src/pirerr.h \
- compilers/pirc/src/pirmacro.h \
- compilers/pirc/src/pirop.h \
- compilers/pirc/src/bcgen.h \
- $(INC_DIR)/oplib/ops.h \
- $(INC_DIR)/dynext.h \
- $(INC_DIR)/embed.h
-
-compilers/pirc/src/pirlexer$(O) : $(PARROT_H_HEADERS) \
- compilers/pirc/src/pirlexer.c \
- compilers/pirc/src/pirparser.h \
- compilers/pirc/src/pirmacro.h \
- compilers/pirc/src/pirerr.h \
- compilers/pirc/src/pircompunit.h \
- compilers/pirc/src/pircompiler.h \
- compilers/pirc/src/pirsymbol.h \
- compilers/pirc/src/piryy.h \
- compilers/pirc/src/pirdefines.h \
- compilers/pirc/src/pirregalloc.h \
- compilers/pirc/src/bcgen.h \
- $(INC_DIR)/embed.h
-
-compilers/pirc/src/pirmacro$(O) : $(PARROT_H_HEADERS) \
- compilers/pirc/src/pirmacro.c \
- compilers/pirc/src/pirmacro.h \
- compilers/pirc/src/pircompunit.h \
- compilers/pirc/src/pircompiler.h \
- compilers/pirc/src/pirsymbol.h \
- compilers/pirc/src/pirdefines.h \
- compilers/pirc/src/pirregalloc.h \
- compilers/pirc/src/bcgen.h \
- $(INC_DIR)/embed.h
-
-compilers/pirc/src/pirop$(O) : $(PARROT_H_HEADERS) \
- compilers/pirc/src/pirop.c \
- compilers/pirc/src/pircompiler.h \
- compilers/pirc/src/pircompunit.h \
- compilers/pirc/src/pirop.h \
- compilers/pirc/src/pirerr.h \
- compilers/pirc/src/pirsymbol.h \
- compilers/pirc/src/piryy.h \
- compilers/pirc/src/pirdefines.h \
- compilers/pirc/src/pirregalloc.h \
- compilers/pirc/src/pirmacro.h \
- compilers/pirc/src/bcgen.h \
- $(INC_DIR)/embed.h
-
-compilers/pirc/src/pirpcc$(O) : $(PARROT_H_HEADERS) \
- compilers/pirc/src/pirpcc.c \
- compilers/pirc/src/pirpcc.h \
- compilers/pirc/src/pircompiler.h \
- compilers/pirc/src/pirerr.h \
- compilers/pirc/src/pircompunit.h \
- compilers/pirc/src/pirsymbol.h \
- compilers/pirc/src/piryy.h \
- compilers/pirc/src/pirdefines.h \
- compilers/pirc/src/pirregalloc.h \
- compilers/pirc/src/pirmacro.h \
- compilers/pirc/src/bcgen.h \
- $(INC_DIR)/oplib/ops.h \
- $(INC_DIR)/embed.h
-
-compilers/pirc/src/pirsymbol$(O) : $(PARROT_H_HEADERS) \
- compilers/pirc/src/pirsymbol.c \
- compilers/pirc/src/pircompiler.h \
- compilers/pirc/src/pirsymbol.h \
- compilers/pirc/src/piryy.h \
- compilers/pirc/src/pirerr.h \
- compilers/pirc/src/pircompunit.h \
- compilers/pirc/src/pirdefines.h \
- compilers/pirc/src/pirregalloc.h \
- compilers/pirc/src/pirmacro.h \
- compilers/pirc/src/bcgen.h \
- $(INC_DIR)/embed.h
-
-# the all here is too broad, but the separate pirc.exe is going away soonish.
-pirc$(EXE): $(PIRC_O_FILES) all
- $(LINK) $(LD_OUT) $@ \
- $(PIRC_O_FILES) \
- $(RPATH_BLIB) $(ALL_PARROT_LIBS) $(C_LIBS) $(LINKFLAGS) $(LINK_DYNAMIC)
-#IF(win32): if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;1
-
-compilers/pirc/src/pir.y.flag compilers/pirc/src/pirparser.c compilers/pirc/src/pirparser.h : compilers/pirc/src/pir.y
- $(YACC) compilers/pirc/src/pir.y -d -o compilers/pirc/src/pirparser.c
- $(TOUCH) compilers/pirc/src/pir.y.flag compilers/pirc/src/pirparser.c compilers/pirc/src/pirparser.h
-
-compilers/pirc/src/pir.l.flag compilers/pirc/src/pirlexer.c : compilers/pirc/src/pir.l
- $(LEX) -o compilers/pirc/src/pirlexer.c compilers/pirc/src/pir.l
- $(TOUCH) compilers/pirc/src/pir.l.flag compilers/pirc/src/pirlexer.c
-
-# XXX This should eventually be combined with the standard parrot test suite.
-pirc-test: all
- $(PERL) compilers/pirc/t/harness
View
38 compilers/pirc/TODO
@@ -1,38 +0,0 @@
-TASKS LIST FOR PIRC COMPLETION
-
-This is an overview of tasks in order to complete PIRC.
-By "complete", or "completion", it is meant to be able
-to use PIRC as a PIR compiler, without needing the current
-PIR compiler, IMCC.
-
-Fairly randomly sorted, the tasks are:
-
-[DONE] 1. Emit the actual bytecodes into a PackFile/codesegment.
-
-[DONE] 2.a Create a PMC constant for strings, numbers and
- subroutines.
-[DONE] 2.b Create a PMC constant for keys
-
-[TODO] 3. Complete PASM output, so it can actually be parsed and run.
-
-[DONE] 4. Handle :multi flag properly.
-
-[TODO] 5. Handle nested macro expansions.
-
-[TODO] 6. Fix all memory leaks. this should be trivial, given PIR's built-in
- allocated-memory-pointer-registering infrastructure. In some
- places this is not used yet, and in others, it's not necessary
- to use it (but in those mem_sys_free() must be called explicitly).
-
-[DONE] 7. Figure out how :named argument passing works in bytecode.
-
-[DONE] 8. Finish the parrot calling conventions ops in the back-end
- (var.args must be fixed).
-
-[DONE] 9.a Handle :slurpy
-
-[DONE] 9.b Handle :flat
-
-[DONE] 10. Handle indexed assignments in bytecode.
-
-More tasks will be added as I think of them. --kjs
View
60 compilers/pirc/heredoc/heredocmain.c
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2008-2009, Parrot Foundation.
- */
-
-#include <stdio.h>
-#include "parrot/parrot.h"
-
-/*
-
-=head1 Functions
-
-=over 4
-
-=item C<int
-main(int argc, char *argv[])>
-
-Entry point of the heredoc pre-processor.
-
-=back
-
-=cut
-
-*/
-int
-main(int argc, char *argv[]) {
- FILE *outfile;
- char *outputfile = "heredoc.out";
-
- /* check for proper usage */
- if (argc < 2) {
- fprintf(stderr, "Usage: %s <file>\n", argv[0]);
- exit(EXIT_FAILURE);
- }
-
- outfile = fopen(outputfile, "w");
-
- if (outfile == NULL) {
- fprintf(stderr, "Failed to open file '%s' for output. Aborting.\n", outputfile);
- exit(EXIT_FAILURE);
- }
-
- fprintf(outfile, "# output generated by %s\n", argv[0]);
-
- process_heredocs(argv[1], outfile);
-
- fclose(outfile);
-
- fprintf(stderr, "heredoc pre-processed successfully.\n");
-
- return 0;
-}
-
-
-
-/*
- * Local variables:
- * c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */
View
32 compilers/pirc/macro/lexer.h
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2007-2009, Parrot Foundation.
- */