Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use the "Perlito" namespace instead of "MiniPerl6"

  • Loading branch information...
commit 5c6496c37766f602595ebcdf22ff86415b251d64 1 parent 9c34393
@fglock authored
Showing with 1,471 additions and 1,863 deletions.
  1. +3 −1 ChangeLog
  2. +0 −7 lib/MiniPerl6/Grammar/Mapping.pm
  3. +9 −9 lib/{MiniPerl6 → Perlito}/Clojure/Emitter.pm
  4. +5 −5 lib/{MiniPerl6 → Perlito}/Emitter/Token.pm
  5. +2 −2 lib/{MiniPerl6 → Perlito}/Eval.pm
  6. +72 −72 lib/{MiniPerl6 → Perlito}/Expression.pm
  7. +19 −19 lib/{MiniPerl6 → Perlito}/Go/Emitter.pm
  8. +4 −4 lib/{MiniPerl6 → Perlito}/Go/Prelude.pm
  9. +16 −16 {lib5/MiniPerl6 → lib/Perlito}/Go/Runtime.go
  10. +28 −28 lib/{MiniPerl6 → Perlito}/Grammar.pm
  11. +4 −4 lib/{MiniPerl6 → Perlito}/Grammar/Control.pm
  12. +7 −0 lib/Perlito/Grammar/Mapping.pm
  13. +23 −23 lib/{MiniPerl6 → Perlito}/Grammar/Regex.pm
  14. +15 −15 lib/{MiniPerl6 → Perlito}/Javascript/Emitter.pm
  15. +3 −3 lib/{MiniPerl6 → Perlito}/Javascript/Prelude.pm
  16. +22 −22 {lib5/MiniPerl6 → lib/Perlito}/Javascript/Runtime.js
  17. +11 −11 lib/{MiniPerl6 → Perlito}/Lisp/Emitter.pm
  18. +3 −3 lib/{MiniPerl6 → Perlito}/Lisp/Prelude.pm
  19. +26 −26 lib/{MiniPerl6 → Perlito}/Lisp/Runtime.lisp
  20. +2 −2 lib/{MiniPerl6 → Perlito}/Parrot/Emitter.pm
  21. +2 −2 lib/{MiniPerl6 → Perlito}/Parrot/Match.pm
  22. +2 −2 lib/{MiniPerl6 → Perlito}/Perl5/Emitter.pm
  23. +3 −3 lib/{MiniPerl6 → Perlito}/Perl5/Prelude.pm
  24. +9 −9 {lib5/MiniPerl6 → lib/Perlito}/Perl5/Runtime.pm
  25. +7 −7 lib/{MiniPerl6 → Perlito}/Precedence.pm
  26. +31 −31 lib/{MiniPerl6 → Perlito}/Python/Emitter.pm
  27. +2 −2 lib/{MiniPerl6 → Perlito}/Python/Prelude.pm
  28. +17 −17 lib/{MiniPerl6 → Perlito}/Python/Runtime.py
  29. +2 −2 lib/{MiniPerl6 → Perlito}/Rakudo/Emitter.pm
  30. +20 −20 lib/{MiniPerl6 → Perlito}/Ruby/Emitter.pm
  31. +15 −15 lib/{MiniPerl6 → Perlito}/Ruby/Runtime.rb
  32. +19 −19 lib/{ → Perlito}/Test.pm
  33. +0 −43 lib5/MiniPerl6/Expression.pm
  34. +0 −65 lib5/MiniPerl6/Grammar.pm
  35. +0 −29 lib5/MiniPerl6/Grammar/Control.pm
  36. +0 −44 lib5/MiniPerl6/Grammar/Regex.pm
  37. +10 −10 lib5/{MiniPerl6 → Perlito}/Clojure/Emitter.pm
  38. +5 −5 lib5/{MiniPerl6 → Perlito}/Emitter/Token.pm
  39. +3 −3 lib5/{MiniPerl6 → Perlito}/Eval.pm
  40. +43 −0 lib5/Perlito/Expression.pm
  41. +18 −18 lib5/{MiniPerl6 → Perlito}/Go/Emitter.pm
  42. +12 −12 lib5/{MiniPerl6 → Perlito}/Go/Prelude.pm
  43. +16 −16 {lib/MiniPerl6 → lib5/Perlito}/Go/Runtime.go
  44. +65 −0 lib5/Perlito/Grammar.pm
  45. +29 −0 lib5/Perlito/Grammar/Control.pm
  46. +5 −5 lib5/{MiniPerl6 → Perlito}/Grammar/Mapping.pm
  47. +44 −0 lib5/Perlito/Grammar/Regex.pm
  48. +14 −14 lib5/{MiniPerl6 → Perlito}/Javascript/Emitter.pm
  49. +5 −5 lib5/{MiniPerl6/Lisp → Perlito/Javascript}/Prelude.pm
  50. +22 −22 {lib/MiniPerl6 → lib5/Perlito}/Javascript/Runtime.js
  51. +12 −12 lib5/{MiniPerl6 → Perlito}/Lisp/Emitter.pm
  52. +5 −5 lib5/{MiniPerl6/Javascript → Perlito/Lisp}/Prelude.pm
  53. +26 −26 lib5/{MiniPerl6 → Perlito}/Lisp/Runtime.lisp
  54. +3 −3 lib5/{MiniPerl6 → Perlito}/Parrot/Emitter.pm
  55. +5 −5 lib5/{MiniPerl6 → Perlito}/Parrot/Match.pm
  56. +3 −3 lib5/{MiniPerl6 → Perlito}/Perl5/Emitter.pm
  57. +5 −5 lib5/{MiniPerl6 → Perlito}/Perl5/Prelude.pm
  58. +9 −9 {lib/MiniPerl6 → lib5/Perlito}/Perl5/Runtime.pm
  59. +6 −6 lib5/{MiniPerl6 → Perlito}/Precedence.pm
  60. +17 −17 lib5/{MiniPerl6 → Perlito}/Python/Emitter.pm
  61. +17 −17 lib5/{MiniPerl6 → Perlito}/Python/Runtime.py
  62. +3 −3 lib5/{MiniPerl6 → Perlito}/Rakudo/Emitter.pm
  63. +17 −17 lib5/{MiniPerl6 → Perlito}/Ruby/Emitter.pm
  64. +23 −23 lib5/{ → Perlito}/Test.pm
  65. 0  libpy/__init__.py
  66. 0  libpy/miniperl6/__init__.py
  67. 0  libpy/miniperl6/python/__init__.py
  68. +0 −394 libpy/miniperl6/python/runtime.py
  69. +10 −10 misc/MiniPerl5/Grammar.pm
  70. +3 −3 misc/MiniPerl5/Grammar/Control.pm
  71. +2 −2 misc/{MiniPerl6 → Perlito}/PAST/Emitter.pm
  72. +2 −2 misc/{MiniPerl6 → Perlito}/Pugs/Emitter.pm
  73. +9 −9 misc/mp6-clojure.pl
  74. +11 −11 misc/mp6-past.pl
  75. +7 −7 misc/mp6-py.pl
  76. +11 −11 misc/mp6-rakudo.pl
  77. +23 −23 mp6.pl
  78. +4 −4 perlito.html
  79. +375 −375 perlito.js
  80. +4 −4 t-backend-specific/13-emitter-lisp.t
  81. +5 −5 t-backend-specific/14-grammar.t
  82. +5 −5 t-backend-specific/15-grammar-2.t
  83. +3 −3 t/12-match-more.t
  84. +1 −1  t/12-match.t
  85. +13 −13 t/20-eval.t
  86. +3 −3 t/21-test.t
  87. +9 −9 util-js/perlito.pl
  88. +3 −3 util-perl5/make.pl
  89. +16 −16 util-python/build-python.sh
  90. +17 −17 util-ruby/bootstrap-ruby.sh
  91. +17 −17 util-ruby/build-ruby.sh
  92. +30 −30 util/mp6.pl
  93. +2 −0  v6.pm/ChangeLog
  94. +33 −33 v6.pm/MANIFEST
  95. +0 −2  v6.pm/make-v6.sh
  96. +8 −8 v6.pm/perlito.pm
View
4 ChangeLog
@@ -1,7 +1,9 @@
-dev version - 2010-08-23
+dev version - 2010-09-01
- backends pending upgrade to the new AST: Go, Common Lisp, Python 2, and Ruby 1.9
- backends not supported in this version: Parrot, Rakudo, Clojure
+- new distribution "v6.pm" (Perlito in Perl 5)
+ This replaces Pugs::Compiler::Perl5 as the v6.pm compiler in CPAN.
- correct operator precedence
- interpolation of variables in strings
- 'unless'
View
7 lib/MiniPerl6/Grammar/Mapping.pm
@@ -1,7 +0,0 @@
-
-use v6;
-
-grammar MiniPerl6::Grammar {
- 1;
-}
-
View
18 lib/MiniPerl6/Clojure/Emitter.pm → lib/Perlito/Clojure/Emitter.pm
@@ -1,6 +1,6 @@
use v6;
-class MiniPerl6::Clojure::LexicalBlock {
+class Perlito::Clojure::LexicalBlock {
has @.block;
method emit_clojure {
if !(@.block) {
@@ -131,7 +131,7 @@ new-slots))
$str_specific = $str_specific ~ ' &optional' ~ $str_optionals;
# $str_generic = $str_generic ~ ' &optional' ~ $str_optionals;
}
- my $block = MiniPerl6::Clojure::LexicalBlock.new( block => $decl.block );
+ my $block = Perlito::Clojure::LexicalBlock.new( block => $decl.block );
$str = $str ~
';; method ' ~ $decl.name() ~ '
(if (not (ignore-errors (find-method \'' ~ Main::to_lisp_identifier($decl.name) ~ ' () ())))
@@ -491,8 +491,8 @@ class If {
has @.body;
has @.otherwise;
method emit_clojure {
- my $block1 = MiniPerl6::Clojure::LexicalBlock.new( block => @.body );
- my $block2 = MiniPerl6::Clojure::LexicalBlock.new( block => @.otherwise );
+ my $block1 = Perlito::Clojure::LexicalBlock.new( block => @.body );
+ my $block2 = Perlito::Clojure::LexicalBlock.new( block => @.otherwise );
'(if (sv-bool ' ~ $.cond.emit_clojure() ~ ') ' ~ $block1.emit_clojure() ~ ' ' ~ $block2.emit_clojure() ~ ')';
}
}
@@ -503,7 +503,7 @@ class For {
has @.topic;
method emit_clojure {
my $cond = $.cond;
- my $block = MiniPerl6::Clojure::LexicalBlock.new( block => @.body );
+ my $block = Perlito::Clojure::LexicalBlock.new( block => @.body );
if $cond.isa( 'Var' )
&& $cond.sigil eq '@'
{
@@ -555,7 +555,7 @@ class Sub {
method emit_clojure {
my $sig = $.sig;
my $pos = $sig.positional;
- my $block = MiniPerl6::Clojure::LexicalBlock.new( block => @.block );
+ my $block = Perlito::Clojure::LexicalBlock.new( block => @.block );
my $str;
if @$pos {
for @$pos -> $field {
@@ -584,7 +584,7 @@ class Sub {
class Do {
has @.block;
method emit_clojure {
- my $block = MiniPerl6::Clojure::LexicalBlock.new( block => @.block );
+ my $block = Perlito::Clojure::LexicalBlock.new( block => @.block );
return $block.emit_clojure;
}
}
@@ -601,7 +601,7 @@ class Use {
=head1 NAME
-MiniPerl6::Clojure::Emit - Code generator for MiniPerl6-in-Clojure
+Perlito::Clojure::Emit - Code generator for Perlito-in-Clojure
=head1 SYNOPSIS
@@ -609,7 +609,7 @@ MiniPerl6::Clojure::Emit - Code generator for MiniPerl6-in-Clojure
=head1 DESCRIPTION
-This module generates Clojure code for the MiniPerl6 compiler.
+This module generates Clojure code for the Perlito compiler.
=head1 AUTHORS
View
10 lib/MiniPerl6/Emitter/Token.pm → lib/Perlito/Emitter/Token.pm
@@ -266,7 +266,7 @@ class Rul::Before {
method emit {
'(do { ' ~
'my $tmp = $MATCH; ' ~
- '$MATCH = MiniPerl6::Match.new( \'str\' => $str, \'from\' => $tmp.to, \'to\' => $tmp.to, \'bool\' => 1 ); ' ~
+ '$MATCH = Perlito::Match.new( \'str\' => $str, \'from\' => $tmp.to, \'to\' => $tmp.to, \'bool\' => 1 ); ' ~
'$MATCH.bool = ' ~
$.rule_exp.emit() ~
'; ' ~
@@ -283,7 +283,7 @@ class Rul::NotBefore {
method emit {
'(do { ' ~
'my $tmp = $MATCH; ' ~
- '$MATCH = MiniPerl6::Match.new( \'str\' => $str, \'from\' => $tmp.to, \'to\' => $tmp.to, \'bool\' => 1 ); ' ~
+ '$MATCH = Perlito::Match.new( \'str\' => $str, \'from\' => $tmp.to, \'to\' => $tmp.to, \'bool\' => 1 ); ' ~
'$MATCH.bool = ' ~
$.rule_exp.emit() ~
'; ' ~
@@ -339,16 +339,16 @@ class Rul::After {
=head1 NAME
-MiniPerl6::Emitter::Token - Code generator for MiniPerl6 Regex
+Perlito::Emitter::Token - Code generator for Perlito Regex
=head1 SYNOPSIS
my $match = $source.rule;
- ($$match).emit; # generated MiniPerl6 source code
+ ($$match).emit; # generated Perlito source code
=head1 DESCRIPTION
-This module generates MiniPerl6 code for the Regex compiler.
+This module generates Perlito code for the Regex compiler.
=head1 AUTHORS
View
4 lib/MiniPerl6/Eval.pm → lib/Perlito/Eval.pm
@@ -321,7 +321,7 @@ class Use {
=head1 NAME
-MiniPerl6::Eval - AST interpreter for MiniPerl6
+Perlito::Eval - AST interpreter for Perlito
=head1 SYNOPSIS
@@ -329,7 +329,7 @@ MiniPerl6::Eval - AST interpreter for MiniPerl6
=head1 DESCRIPTION
-This module executes MiniPerl6 AST in interpreter mode.
+This module executes Perlito AST in interpreter mode.
=head1 AUTHORS
View
144 lib/MiniPerl6/Expression.pm → lib/Perlito/Expression.pm
@@ -1,8 +1,8 @@
-class MiniPerl6::Expression {
- use MiniPerl6::Precedence;
- use MiniPerl6::Grammar;
- use MiniPerl6::Perl5::Emitter;
+class Perlito::Expression {
+ use Perlito::Precedence;
+ use Perlito::Grammar;
+ use Perlito::Perl5::Emitter;
sub expand_list ($param_list) {
# say "# expand_list: ", $param_list.perl;
@@ -250,7 +250,7 @@ class MiniPerl6::Expression {
elsif $last_op[0] eq 'postfix_or_term' {
$num_stack.push( reduce_postfix( $last_op, pop_term($num_stack) ) );
}
- elsif MiniPerl6::Precedence::is_assoc_type('list', $last_op[1]) {
+ elsif Perlito::Precedence::is_assoc_type('list', $last_op[1]) {
my $arg;
if $num_stack.elems < 2 {
my $v2 = pop_term($num_stack);
@@ -291,7 +291,7 @@ class MiniPerl6::Expression {
arguments => $arg,
);
}
- elsif MiniPerl6::Precedence::is_assoc_type('chain', $last_op[1]) {
+ elsif Perlito::Precedence::is_assoc_type('chain', $last_op[1]) {
if $num_stack.elems < 2 {
die("Missing value after operator " ~ $last_op[1]);
}
@@ -301,7 +301,7 @@ class MiniPerl6::Expression {
# TODO - create a special AST node for assoc chain?
# if ($arg[0]).isa('Apply')
- # && MiniPerl6::Precedence::is_assoc_type('chain', ($arg[1]){op} )
+ # && Perlito::Precedence::is_assoc_type('chain', ($arg[1]){op} )
# {
# push $num_stack,
# Apply.new(
@@ -354,7 +354,7 @@ class MiniPerl6::Expression {
# Var.new( sigil => ~$$<var_sigil>, twigil => '', name => $$<ident> ) ]
token capture_name {
- <MiniPerl6::Grammar.full_ident> [ \. <MiniPerl6::Grammar.ident> ]?
+ <Perlito::Grammar.full_ident> [ \. <Perlito::Grammar.ident> ]?
}
token hyper_op {
@@ -368,7 +368,7 @@ class MiniPerl6::Expression {
| '(' <paren_parse> ')' { make [ 'postfix_or_term', '( )', $$<paren_parse> ] }
| '[' <square_parse> ']' { make [ 'postfix_or_term', '[ ]', $$<square_parse> ] }
- | '->' <.MiniPerl6::Grammar.ws>? <list_parse>
+ | '->' <.Perlito::Grammar.ws>? <list_parse>
{
my $block = ($$<list_parse>){'end_block'};
if $block.sig() {
@@ -376,74 +376,74 @@ class MiniPerl6::Expression {
}
make [ 'postfix_or_term', 'block', $block.stmts, ($$<list_parse>){'exp'} ]
}
- | '{' <.MiniPerl6::Grammar.ws>?
- <MiniPerl6::Grammar.exp_stmts> <.MiniPerl6::Grammar.ws>? '}'
- { make [ 'postfix_or_term', 'block', $$<MiniPerl6::Grammar.exp_stmts> ] }
- | 'method' <.MiniPerl6::Grammar.ws> <MiniPerl6::Grammar.method_def>
- { make [ 'term', $$<MiniPerl6::Grammar.method_def> ] }
- | 'sub' <.MiniPerl6::Grammar.ws> <MiniPerl6::Grammar.sub_def>
- { make [ 'term', $$<MiniPerl6::Grammar.sub_def> ] }
- | 'token' <.MiniPerl6::Grammar.ws> <MiniPerl6::Grammar.token>
- { make [ 'term', $$<MiniPerl6::Grammar.token> ] }
- | 'do' <.MiniPerl6::Grammar.ws> <statement_parse>
+ | '{' <.Perlito::Grammar.ws>?
+ <Perlito::Grammar.exp_stmts> <.Perlito::Grammar.ws>? '}'
+ { make [ 'postfix_or_term', 'block', $$<Perlito::Grammar.exp_stmts> ] }
+ | 'method' <.Perlito::Grammar.ws> <Perlito::Grammar.method_def>
+ { make [ 'term', $$<Perlito::Grammar.method_def> ] }
+ | 'sub' <.Perlito::Grammar.ws> <Perlito::Grammar.sub_def>
+ { make [ 'term', $$<Perlito::Grammar.sub_def> ] }
+ | 'token' <.Perlito::Grammar.ws> <Perlito::Grammar.token>
+ { make [ 'term', $$<Perlito::Grammar.token> ] }
+ | 'do' <.Perlito::Grammar.ws> <statement_parse>
{ make [ 'term', Do.new( block => $$<statement_parse> ) ] }
| '??' <ternary_parse> '!!' { make [ 'op', '?? !!', $$<ternary_parse> ] }
- | <MiniPerl6::Grammar.var_ident> { make [ 'term', $$<MiniPerl6::Grammar.var_ident> ] }
+ | <Perlito::Grammar.var_ident> { make [ 'term', $$<Perlito::Grammar.var_ident> ] }
| '$<' <capture_name> '>'
{ make [ 'term', Lookup.new(
obj => Var.new( sigil => '$', twigil => '', name => '/' ),
index_exp => Val::Buf.new( buf => ~$<capture_name> )
) ] }
- | <MiniPerl6::Precedence.op_parse> { make $$<MiniPerl6::Precedence.op_parse> }
- | <MiniPerl6::Grammar.ident> <before <.MiniPerl6::Grammar.ws>? '=>' > # autoquote
- { make [ 'term', Val::Buf.new( buf => ~$<MiniPerl6::Grammar.ident> ) ] }
- | 'True' <!before [ <.MiniPerl6::Grammar.word> | '(' ] > { make [ 'term', Val::Bit.new( bit => 1 ) ] }
- | 'False' <!before [ <.MiniPerl6::Grammar.word> | '(' ] > { make [ 'term', Val::Bit.new( bit => 0 ) ] }
- | 'and' <!before [ <.MiniPerl6::Grammar.word> | '(' ] > { make [ 'op', 'and' ] }
- | 'not' <!before [ <.MiniPerl6::Grammar.word> | '(' ] > { make [ 'op', 'not' ] }
- | 'use' <.MiniPerl6::Grammar.ws> <MiniPerl6::Grammar.full_ident> [ - <MiniPerl6::Grammar.ident> ]? <list_parse>
- { make [ 'term', Use.new( mod => $$<MiniPerl6::Grammar.full_ident> ) ] }
- | [ 'package' | 'class' | 'grammar' ] <.MiniPerl6::Grammar.ws> <MiniPerl6::Grammar.grammar>
- { make [ 'term', $$<MiniPerl6::Grammar.grammar> ] }
- | <MiniPerl6::Grammar.declarator> <.MiniPerl6::Grammar.ws> <MiniPerl6::Grammar.opt_type> <.MiniPerl6::Grammar.opt_ws> <MiniPerl6::Grammar.var_ident> # my Int $variable
- { make [ 'term', Decl.new( decl => $$<MiniPerl6::Grammar.declarator>, type => $$<MiniPerl6::Grammar.opt_type>, var => $$<MiniPerl6::Grammar.var_ident> ) ] }
- | '.' <hyper_op> <MiniPerl6::Grammar.ident>
- [ <.MiniPerl6::Grammar.ws> <list_parse>
- { make [ 'postfix_or_term', 'methcall', ~$<MiniPerl6::Grammar.ident>, $$<list_parse>, $$<hyper_op> ] }
- | { make [ 'postfix_or_term', 'methcall_no_params', ~$<MiniPerl6::Grammar.ident>, $$<hyper_op> ] }
+ | <Perlito::Precedence.op_parse> { make $$<Perlito::Precedence.op_parse> }
+ | <Perlito::Grammar.ident> <before <.Perlito::Grammar.ws>? '=>' > # autoquote
+ { make [ 'term', Val::Buf.new( buf => ~$<Perlito::Grammar.ident> ) ] }
+ | 'True' <!before [ <.Perlito::Grammar.word> | '(' ] > { make [ 'term', Val::Bit.new( bit => 1 ) ] }
+ | 'False' <!before [ <.Perlito::Grammar.word> | '(' ] > { make [ 'term', Val::Bit.new( bit => 0 ) ] }
+ | 'and' <!before [ <.Perlito::Grammar.word> | '(' ] > { make [ 'op', 'and' ] }
+ | 'not' <!before [ <.Perlito::Grammar.word> | '(' ] > { make [ 'op', 'not' ] }
+ | 'use' <.Perlito::Grammar.ws> <Perlito::Grammar.full_ident> [ - <Perlito::Grammar.ident> ]? <list_parse>
+ { make [ 'term', Use.new( mod => $$<Perlito::Grammar.full_ident> ) ] }
+ | [ 'package' | 'class' | 'grammar' ] <.Perlito::Grammar.ws> <Perlito::Grammar.grammar>
+ { make [ 'term', $$<Perlito::Grammar.grammar> ] }
+ | <Perlito::Grammar.declarator> <.Perlito::Grammar.ws> <Perlito::Grammar.opt_type> <.Perlito::Grammar.opt_ws> <Perlito::Grammar.var_ident> # my Int $variable
+ { make [ 'term', Decl.new( decl => $$<Perlito::Grammar.declarator>, type => $$<Perlito::Grammar.opt_type>, var => $$<Perlito::Grammar.var_ident> ) ] }
+ | '.' <hyper_op> <Perlito::Grammar.ident>
+ [ <.Perlito::Grammar.ws> <list_parse>
+ { make [ 'postfix_or_term', 'methcall', ~$<Perlito::Grammar.ident>, $$<list_parse>, $$<hyper_op> ] }
+ | { make [ 'postfix_or_term', 'methcall_no_params', ~$<Perlito::Grammar.ident>, $$<hyper_op> ] }
]
- | <MiniPerl6::Grammar.optional_namespace_before_ident> <MiniPerl6::Grammar.ident>
- [ <.MiniPerl6::Grammar.ws> <list_parse>
+ | <Perlito::Grammar.optional_namespace_before_ident> <Perlito::Grammar.ident>
+ [ <.Perlito::Grammar.ws> <list_parse>
{ make [ 'postfix_or_term', 'funcall',
- ~$<MiniPerl6::Grammar.optional_namespace_before_ident>,
- ~$<MiniPerl6::Grammar.ident>, $$<list_parse> ] }
+ ~$<Perlito::Grammar.optional_namespace_before_ident>,
+ ~$<Perlito::Grammar.ident>, $$<list_parse> ] }
| <before '.'>
- { my $namespace = ~$<MiniPerl6::Grammar.optional_namespace_before_ident>;
- my $name = ~$<MiniPerl6::Grammar.ident>;
+ { my $namespace = ~$<Perlito::Grammar.optional_namespace_before_ident>;
+ my $name = ~$<Perlito::Grammar.ident>;
if $namespace {
$name = $namespace ~ '::' ~ $name;
}
make [ 'term', Proto.new( name => $name ) ]
}
| { make [ 'postfix_or_term', 'funcall_no_params',
- ~$<MiniPerl6::Grammar.optional_namespace_before_ident>,
- ~$<MiniPerl6::Grammar.ident> ] }
+ ~$<Perlito::Grammar.optional_namespace_before_ident>,
+ ~$<Perlito::Grammar.ident> ] }
]
- | <MiniPerl6::Grammar.val_num> { make [ 'term', $$<MiniPerl6::Grammar.val_num> ] } # 123.456
- | <MiniPerl6::Grammar.val_int> { make [ 'term', $$<MiniPerl6::Grammar.val_int> ] } # 123
- | <MiniPerl6::Grammar.val_buf> { make [ 'term', $$<MiniPerl6::Grammar.val_buf> ] } # 'moose'
+ | <Perlito::Grammar.val_num> { make [ 'term', $$<Perlito::Grammar.val_num> ] } # 123.456
+ | <Perlito::Grammar.val_int> { make [ 'term', $$<Perlito::Grammar.val_int> ] } # 123
+ | <Perlito::Grammar.val_buf> { make [ 'term', $$<Perlito::Grammar.val_buf> ] } # 'moose'
- | <.MiniPerl6::Grammar.ws> { make [ 'space', ' ' ] }
+ | <.Perlito::Grammar.ws> { make [ 'space', ' ' ] }
}
token has_newline_after {
| '#'
- | <.MiniPerl6::Grammar.is_newline>
- | <.MiniPerl6::Grammar.space> <.has_newline_after>
+ | <.Perlito::Grammar.is_newline>
+ | <.Perlito::Grammar.space> <.has_newline_after>
}
token has_no_comma_or_colon_after {
- <.MiniPerl6::Grammar.ws> <!before [ ',' | ':' ]> .
+ <.Perlito::Grammar.ws> <!before [ ',' | ':' ]> .
}
method list_parse ($str, $pos) {
@@ -460,7 +460,7 @@ class MiniPerl6::Expression {
$v = $lexer_stack.pop;
if $is_first_token
&& ($v[0] eq 'op')
- && !(MiniPerl6::Precedence::is_fixity_type('prefix', $v[1]))
+ && !(Perlito::Precedence::is_fixity_type('prefix', $v[1]))
{
# say "# finishing list - first token is: ", $v[1];
$v[0] = 'end';
@@ -475,7 +475,7 @@ class MiniPerl6::Expression {
$v = $$m;
if $is_first_token
&& ($v[0] eq 'op')
- && !(MiniPerl6::Precedence::is_fixity_type('prefix', $v[1]))
+ && !(Perlito::Precedence::is_fixity_type('prefix', $v[1]))
{
# say "# finishing list - first token is: ", $v[1];
$v[0] = 'end';
@@ -507,12 +507,12 @@ class MiniPerl6::Expression {
return $v;
};
- my $prec = MiniPerl6::Precedence.new(get_token => $get_token, reduce => $reduce_to_ast,
+ my $prec = Perlito::Precedence.new(get_token => $get_token, reduce => $reduce_to_ast,
end_token => [ 'and', 'or', '!!', ']', ')', '}', ';', 'if', 'else', 'elsif', 'unless', 'when', 'for', 'while', 'loop' ] );
my $res = $prec.precedence_parse;
# say "# list_lexer return: ", $res.perl;
if $res.elems == 0 {
- return MiniPerl6::Match.new(
+ return Perlito::Match.new(
'str' => $str, 'from' => $pos, 'to' => $last_pos, 'bool' => 1,
capture => {
exp => '*undef*',
@@ -532,7 +532,7 @@ class MiniPerl6::Expression {
$block = Lit::Block.new( stmts => $block[2], sig => $block[3] );
# say "# list exp terminated with a block (2): ", $block.perl;
}
- return MiniPerl6::Match.new(
+ return Perlito::Match.new(
'str' => $str, 'from' => $pos, 'to' => $last_pos, 'bool' => 1,
capture => {
exp => $result,
@@ -556,7 +556,7 @@ class MiniPerl6::Expression {
# say "# circumfix_lexer " ~ $v.perl;
return $v;
};
- my $prec = MiniPerl6::Precedence.new(get_token => $get_token, reduce => $reduce_to_ast,
+ my $prec = Perlito::Precedence.new(get_token => $get_token, reduce => $reduce_to_ast,
end_token => $delimiter );
my $res = $prec.precedence_parse;
$res = pop_term($res);
@@ -565,7 +565,7 @@ class MiniPerl6::Expression {
# can't return undef in a capture (BUG in Match object?)
$res = '*undef*';
}
- return MiniPerl6::Match.new(
+ return Perlito::Match.new(
'str' => $str, 'from' => $pos, 'to' => $last_pos, 'bool' => 1, capture => $res);
}
@@ -621,13 +621,13 @@ class MiniPerl6::Expression {
return $v;
};
- my $prec = MiniPerl6::Precedence.new(get_token => $get_token, reduce => $reduce_to_ast,
+ my $prec = Perlito::Precedence.new(get_token => $get_token, reduce => $reduce_to_ast,
end_token => [ ']', ')', '}', ';', 'if', 'else', 'elsif', 'unless', 'when', 'for', 'while', 'loop' ] );
my $res = $prec.precedence_parse;
# say "# exp terminated";
if $res.elems == 0 {
# say "# exp terminated with false";
- return MiniPerl6::Match.new(bool => 0);
+ return Perlito::Match.new(bool => 0);
}
# if the expression terminates in a block, the block was pushed to num_stack
my $block;
@@ -645,7 +645,7 @@ class MiniPerl6::Expression {
# say "# exp terminated with a block (2): ", $block.perl;
}
# say "# exp_parse result: ", $result.perl;
- return MiniPerl6::Match.new(
+ return Perlito::Match.new(
'str' => $str, 'from' => $pos, 'to' => $last_pos, 'bool' => 1,
capture => {
exp => $result,
@@ -654,12 +654,12 @@ class MiniPerl6::Expression {
}
token exp_stmt {
- | <MiniPerl6::Grammar.if> { make $$<MiniPerl6::Grammar.if> }
- | <MiniPerl6::Grammar.unless> { make $$<MiniPerl6::Grammar.unless> }
- | <MiniPerl6::Grammar.when> { make $$<MiniPerl6::Grammar.when> }
- | <MiniPerl6::Grammar.for> { make $$<MiniPerl6::Grammar.for> }
- | <MiniPerl6::Grammar.while> { make $$<MiniPerl6::Grammar.while> }
- | <MiniPerl6::Grammar.loop> { make $$<MiniPerl6::Grammar.loop> }
+ | <Perlito::Grammar.if> { make $$<Perlito::Grammar.if> }
+ | <Perlito::Grammar.unless> { make $$<Perlito::Grammar.unless> }
+ | <Perlito::Grammar.when> { make $$<Perlito::Grammar.when> }
+ | <Perlito::Grammar.for> { make $$<Perlito::Grammar.for> }
+ | <Perlito::Grammar.while> { make $$<Perlito::Grammar.while> }
+ | <Perlito::Grammar.loop> { make $$<Perlito::Grammar.loop> }
}
token statement_modifier {
@@ -671,7 +671,7 @@ class MiniPerl6::Expression {
my $expr;
my $last_pos = $pos;
my $lexer_stack = [];
- my $spaces = MiniPerl6::Grammar.ws($str, $pos);
+ my $spaces = Perlito::Grammar.ws($str, $pos);
if $spaces {
$pos = $spaces.to;
}
@@ -717,7 +717,7 @@ class MiniPerl6::Expression {
}
# TODO - require a statement terminator
# say "# statement_parse modifier result: ", $modifier_exp.perl;
- return MiniPerl6::Match.new(
+ return Perlito::Match.new(
'str' => $str, 'from' => $pos, 'to' => $modifier_exp.to, 'bool' => 1,
capture => {
exp => ($$res){'exp'},
@@ -731,7 +731,7 @@ class MiniPerl6::Expression {
=head1 NAME
-MiniPerl6::Expression - Parser and AST generator for MiniPerl6
+Perlito::Expression - Parser and AST generator for Perlito
=head1 SYNOPSIS
@@ -739,7 +739,7 @@ MiniPerl6::Expression - Parser and AST generator for MiniPerl6
=head1 DESCRIPTION
-This module parses source code for Perl 6 statements and generates MiniPerl6 AST.
+This module parses source code for Perl 6 statements and generates Perlito AST.
=head1 AUTHORS
View
38 lib/MiniPerl6/Go/Emitter.pm → lib/Perlito/Go/Emitter.pm
@@ -1,6 +1,6 @@
use v6;
-class MiniPerl6::Go::LexicalBlock {
+class Perlito::Go::LexicalBlock {
has @.block;
has $.needs_return;
has $.top_level;
@@ -45,8 +45,8 @@ class MiniPerl6::Go::LexicalBlock {
if $cond.isa( 'Var' ) && $cond.sigil eq '@' {
$cond = Apply.new( code => 'prefix:<@>', arguments => [ $cond ] );
};
- $body = MiniPerl6::Go::LexicalBlock.new( block => $body, needs_return => 1, top_level => $.top_level );
- $otherwise = MiniPerl6::Go::LexicalBlock.new( block => $otherwise, needs_return => 1, top_level => $.top_level );
+ $body = Perlito::Go::LexicalBlock.new( block => $body, needs_return => 1, top_level => $.top_level );
+ $otherwise = Perlito::Go::LexicalBlock.new( block => $otherwise, needs_return => 1, top_level => $.top_level );
$str = $str
~ 'if tobool( ' ~ Call::emit_go_call( $cond, 'Bool' ) ~ ' ) { '
~ $body.emit_go ~ ' } else { '
@@ -227,7 +227,7 @@ class CompUnit {
}
if $decl.isa( 'Method' ) {
my $sig = $decl.sig;
- my $block = MiniPerl6::Go::LexicalBlock.new( block => $decl.block, needs_return => 1, top_level => 1 );
+ my $block = Perlito::Go::LexicalBlock.new( block => $decl.block, needs_return => 1, top_level => 1 );
$str = $str
~ ' // method ' ~ $decl.name ~ "\n"
~ ' Method_' ~ $class_name ~ '.f_' ~ $decl.name
@@ -245,7 +245,7 @@ class CompUnit {
}
if $decl.isa( 'Sub' ) {
my $sig = $decl.sig;
- my $block = MiniPerl6::Go::LexicalBlock.new( block => $decl.block, needs_return => 1, top_level => 1 );
+ my $block = Perlito::Go::LexicalBlock.new( block => $decl.block, needs_return => 1, top_level => 1 );
$str = $str
~ ' // sub ' ~ $decl.name ~ "\n"
~ ' Namespace_' ~ $class_name ~ '.f_' ~ $decl.name
@@ -315,8 +315,8 @@ class CompUnit {
for @($comp_units) -> $comp_unit {
$str = $str ~ $comp_unit.emit_go;
}
- if !(%unit_seen{"MiniPerl6::Grammar"}) {
- $str = $str ~ "type MiniPerl6__Grammar struct{}\n";
+ if !(%unit_seen{"Perlito::Grammar"}) {
+ $str = $str ~ "type Perlito__Grammar struct{}\n";
}
$str = $str ~ "// interfaces for all methods\n";
my %meth_seen = {
@@ -368,7 +368,7 @@ class CompUnit {
$str = $str ~ "\n"
~ "func main () {\n"
- ~ " Init_MiniPerl6__Match();\n";
+ ~ " Init_Perlito__Match();\n";
for @($comp_units) -> $comp_unit {
$str = $str ~ " Init_" ~ Main::to_go_namespace( $comp_unit.name ) ~ "();\n"
}
@@ -717,7 +717,7 @@ class Apply {
if $code eq 'go' {
return 'go func () { ' ~ "\n"
- ~ ' ' ~ (MiniPerl6::Go::LexicalBlock.new( block => (@.arguments[0]).block, needs_return => 0, top_level => 1 )).emit_go ~ "\n"
+ ~ ' ' ~ (Perlito::Go::LexicalBlock.new( block => (@.arguments[0]).block, needs_return => 0, top_level => 1 )).emit_go ~ "\n"
~ ' }()'
}
@@ -930,14 +930,14 @@ class If {
$cond = Apply.new( code => 'prefix:<@>', arguments => [ $cond ] );
};
my $s = 'if tobool( ' ~ Call::emit_go_call( $cond, 'Bool' ) ~ ' ) { '
- ~ (MiniPerl6::Go::LexicalBlock.new( block => @.body, needs_return => 0 )).emit_go
+ ~ (Perlito::Go::LexicalBlock.new( block => @.body, needs_return => 0 )).emit_go
~ ' }';
if !(@.otherwise) {
return $s;
}
return $s
~ ' else { '
- ~ (MiniPerl6::Go::LexicalBlock.new( block => @.otherwise, needs_return => 0 )).emit_go
+ ~ (Perlito::Go::LexicalBlock.new( block => @.otherwise, needs_return => 0 )).emit_go
~ ' }';
}
}
@@ -951,7 +951,7 @@ class For {
~ ' var i = (*(*a_).(array_er).f_array(Capture{})).(*Array); ' ~ "\n"
~ ' for pos := 0; pos <= i.n; pos++ { ' ~ "\n"
~ ' func (' ~ $.topic.emit_go ~ ' *Any) { ' ~ "\n"
- ~ ' ' ~ (MiniPerl6::Go::LexicalBlock.new( block => @.body, needs_return => 0 )).emit_go ~ "\n"
+ ~ ' ' ~ (Perlito::Go::LexicalBlock.new( block => @.body, needs_return => 0 )).emit_go ~ "\n"
~ ' }(i.v[pos]) ' ~ "\n"
~ ' } ' ~ "\n"
~ '}(' ~ $.cond.emit_go ~ ')'
@@ -981,7 +981,7 @@ class While {
~ 'tobool( ' ~ Call::emit_go_call( $cond, 'Bool' ) ~ ' ); '
~ ( $.continue ?? $.continue.emit_go ~ ' ' !! '' )
~ '{ '
- ~ (MiniPerl6::Go::LexicalBlock.new( block => @.body, needs_return => 0 )).emit_go
+ ~ (Perlito::Go::LexicalBlock.new( block => @.body, needs_return => 0 )).emit_go
~ ' }';
}
}
@@ -1052,7 +1052,7 @@ class Method {
'func ' ~ $.name ~ '(v Capture) *Any { '
~ ' ' ~ ($.sig).emit_go_bind ~ "\n"
~ ' p := make(chan *Any); go func () { ' ~ "\n"
- ~ ' ' ~ (MiniPerl6::Go::LexicalBlock.new( block => @.block, needs_return => 1, top_level => 1 )).emit_go
+ ~ ' ' ~ (Perlito::Go::LexicalBlock.new( block => @.block, needs_return => 1, top_level => 1 )).emit_go
~ '; p <- nil }(); ' ~ "\n"
~ ' return <-p; ' ~ "\n"
~ ' }'
@@ -1069,7 +1069,7 @@ class Sub {
'toFunction( func(v Capture) *Any { '
~ ' ' ~ ($.sig).emit_go_bind ~ "\n"
~ ' p := make(chan *Any); go func () { ' ~ "\n"
- ~ ' ' ~ (MiniPerl6::Go::LexicalBlock.new( block => @.block, needs_return => 1, top_level => 1 )).emit_go
+ ~ ' ' ~ (Perlito::Go::LexicalBlock.new( block => @.block, needs_return => 1, top_level => 1 )).emit_go
~ '; p <- nil }(); ' ~ "\n"
~ ' return <-p; ' ~ "\n"
~ '} '
@@ -1079,7 +1079,7 @@ class Sub {
'func ' ~ $.name ~ '(v Capture) *Any { '
~ ' ' ~ ($.sig).emit_go_bind ~ "\n"
~ ' p := make(chan *Any); go func () { ' ~ "\n"
- ~ ' ' ~ (MiniPerl6::Go::LexicalBlock.new( block => @.block, needs_return => 1, top_level => 1 )).emit_go
+ ~ ' ' ~ (Perlito::Go::LexicalBlock.new( block => @.block, needs_return => 1, top_level => 1 )).emit_go
~ '; p <- nil }(); ' ~ "\n"
~ ' return <-p; ' ~ "\n"
~ ' }'
@@ -1090,7 +1090,7 @@ class Do {
has @.block;
method emit_go {
'(func () *Any { '
- ~ (MiniPerl6::Go::LexicalBlock.new( block => @.block, needs_return => 1 )).emit_go
+ ~ (Perlito::Go::LexicalBlock.new( block => @.block, needs_return => 1 )).emit_go
~ '; return u_undef() '
~ '})()'
}
@@ -1107,7 +1107,7 @@ class Use {
=head1 NAME
-MiniPerl6::Go::Emit - Code generator for MiniPerl6-in-Go
+Perlito::Go::Emit - Code generator for Perlito-in-Go
=head1 SYNOPSIS
@@ -1115,7 +1115,7 @@ MiniPerl6::Go::Emit - Code generator for MiniPerl6-in-Go
=head1 DESCRIPTION
-This module generates Go code for the MiniPerl6 compiler.
+This module generates Go code for the Perlito compiler.
=head1 AUTHORS
View
8 lib/MiniPerl6/Go/Prelude.pm → lib/Perlito/Go/Prelude.pm
@@ -1,6 +1,6 @@
use v6;
-class MiniPerl6::Match {
+class Perlito::Match {
has $.from;
has $.to;
has $.str;
@@ -30,7 +30,7 @@ class MiniPerl6::Match {
method exists { die "TODO" }
}
-class MiniPerl6::Grammar {
+class Perlito::Grammar {
# Note: These tokens are just stubs.
# The actual methods are implemented in Runtime.go
@@ -72,13 +72,13 @@ class Main {
=head1 NAME
-MiniPerl6::Go::Prelude - Runtime for MiniPerl6-in-Go
+Perlito::Go::Prelude - Runtime for Perlito-in-Go
=head1 SYNOPSIS
=head1 DESCRIPTION
-This module contains MiniPerl6 code for the MiniPerl6-in-Go runtime.
+This module contains Perlito code for the Perlito-in-Go runtime.
=head1 AUTHORS
View
32 lib5/MiniPerl6/Go/Runtime.go → lib/Perlito/Go/Runtime.go
@@ -1,6 +1,6 @@
-// lib/MiniPerl6/Javascript/Runtime.go
+// lib/Perlito/Javascript/Runtime.go
//
-// Runtime for "Perlito" MiniPerl6-in-Go
+// Runtime for "Perlito" Perlito-in-Go
//
// AUTHORS
//
@@ -762,7 +762,7 @@ func f_smaller_equal(v1, v2 *Any) *Any {
// implementation of functions and methods declared in the prelude file
-func (v_self MiniPerl6__Match) f_int(Capture) *Any {
+func (v_self Perlito__Match) f_int(Capture) *Any {
return (*v_self.f_Str(Capture{})).(int_er).f_int(Capture{})
}
@@ -778,7 +778,7 @@ func Init_Prelude() {
}
}
- Method_MiniPerl6__Match.f_scalar = func(v_self *MiniPerl6__Match, v Capture) *Any {
+ Method_Perlito__Match.f_scalar = func(v_self *Perlito__Match, v Capture) *Any {
if v_self.v_bool == nil {
v_self.v_bool = toBool(false)
}
@@ -794,7 +794,7 @@ func Init_Prelude() {
}
return toStr("")
}
- Method_MiniPerl6__Match.f_Str = func(v_self *MiniPerl6__Match, v Capture) *Any {
+ Method_Perlito__Match.f_Str = func(v_self *Perlito__Match, v Capture) *Any {
if v_self.v_bool == nil {
v_self.v_bool = toBool(false)
}
@@ -810,12 +810,12 @@ func Init_Prelude() {
}
return toStr("")
}
- Method_MiniPerl6__Match.f_exists = func(v_self *MiniPerl6__Match, v Capture) *Any {
+ Method_Perlito__Match.f_exists = func(v_self *Perlito__Match, v Capture) *Any {
tmp := v_self.f_hash(Capture{})
return (*tmp).(exists_er).f_exists(v)
}
- Method_MiniPerl6__Grammar.f_is_newline = func(v_grammar *MiniPerl6__Grammar, v Capture) *Any {
+ Method_Perlito__Grammar.f_is_newline = func(v_grammar *Perlito__Grammar, v Capture) *Any {
var s1 = tostr(v.p[0])
var i1 = toint(v.p[1])
var b1 = false
@@ -828,14 +828,14 @@ func Init_Prelude() {
b1 = true
}
}
- var m Any = new(MiniPerl6__Match)
+ var m Any = new(Perlito__Match)
*m.(str_er).f_str(Capture{}) = *v.p[0]
*m.(from_er).f_from(Capture{}) = *v.p[1]
*m.(to_er).f_to(Capture{}) = Int(i1)
*m.(bool_er).f_bool(Capture{}) = Bool(b1)
return &m
}
- Method_MiniPerl6__Grammar.f_word = func(v_grammar *MiniPerl6__Grammar, v Capture) *Any {
+ Method_Perlito__Grammar.f_word = func(v_grammar *Perlito__Grammar, v Capture) *Any {
var s1 = tostr(v.p[0])
var i1 = toint(v.p[1])
var b1 = false
@@ -846,14 +846,14 @@ func Init_Prelude() {
i1++
}
}
- var m Any = new(MiniPerl6__Match)
+ var m Any = new(Perlito__Match)
*m.(str_er).f_str(Capture{}) = *v.p[0]
*m.(from_er).f_from(Capture{}) = *v.p[1]
*m.(to_er).f_to(Capture{}) = Int(i1)
*m.(bool_er).f_bool(Capture{}) = Bool(b1)
return &m
}
- Method_MiniPerl6__Grammar.f_digit = func(v_grammar *MiniPerl6__Grammar, v Capture) *Any {
+ Method_Perlito__Grammar.f_digit = func(v_grammar *Perlito__Grammar, v Capture) *Any {
var s1 = tostr(v.p[0])
var i1 = toint(v.p[1])
var b1 = false
@@ -864,28 +864,28 @@ func Init_Prelude() {
i1++
}
}
- var m Any = new(MiniPerl6__Match)
+ var m Any = new(Perlito__Match)
*m.(str_er).f_str(Capture{}) = *v.p[0]
*m.(from_er).f_from(Capture{}) = *v.p[1]
*m.(to_er).f_to(Capture{}) = Int(i1)
*m.(bool_er).f_bool(Capture{}) = Bool(b1)
return &m
}
- Method_MiniPerl6__Grammar.f_not_newline = func(v_grammar *MiniPerl6__Grammar, v Capture) *Any {
+ Method_Perlito__Grammar.f_not_newline = func(v_grammar *Perlito__Grammar, v Capture) *Any {
var s1 = tostr(v.p[0])
var i1 = toint(v.p[1])
var b1 = (s1[i1] != 13 && s1[i1] != 10)
if b1 {
i1++
}
- var m Any = new(MiniPerl6__Match)
+ var m Any = new(Perlito__Match)
*m.(str_er).f_str(Capture{}) = *v.p[0]
*m.(from_er).f_from(Capture{}) = *v.p[1]
*m.(to_er).f_to(Capture{}) = Int(i1)
*m.(bool_er).f_bool(Capture{}) = Bool(b1)
return &m
}
- Method_MiniPerl6__Grammar.f_space = func(v_grammar *MiniPerl6__Grammar, v Capture) *Any {
+ Method_Perlito__Grammar.f_space = func(v_grammar *Perlito__Grammar, v Capture) *Any {
var s1 = tostr(v.p[0])
var i1 = toint(v.p[1])
var b1 = false
@@ -896,7 +896,7 @@ func Init_Prelude() {
i1++
}
}
- var m Any = new(MiniPerl6__Match)
+ var m Any = new(Perlito__Match)
*m.(str_er).f_str(Capture{}) = *v.p[0]
*m.(from_er).f_from(Capture{}) = *v.p[1]
*m.(to_er).f_to(Capture{}) = Int(i1)
View
56 lib/MiniPerl6/Grammar.pm → lib/Perlito/Grammar.pm
@@ -1,10 +1,10 @@
use v6;
-grammar MiniPerl6::Grammar {
+grammar Perlito::Grammar {
-use MiniPerl6::Expression;
-use MiniPerl6::Grammar::Regex;
-use MiniPerl6::Grammar::Control;
+use Perlito::Expression;
+use Perlito::Grammar::Regex;
+use Perlito::Grammar::Control;
token ident {
[ <!before \d ><.word> | _ ] [ <.word> | _ | <.digit> ]*
@@ -67,13 +67,13 @@ token declarator {
token exp_stmts2 { <exp_stmts> { make $$<exp_stmts> } }
token exp {
- <MiniPerl6::Expression.exp_parse>
- { make $$<MiniPerl6::Expression.exp_parse> }
+ <Perlito::Expression.exp_parse>
+ { make $$<Perlito::Expression.exp_parse> }
}
token exp2 {
- <MiniPerl6::Expression.exp_parse>
- { make $$<MiniPerl6::Expression.exp_parse> }
+ <Perlito::Expression.exp_parse>
+ { make $$<Perlito::Expression.exp_parse> }
}
token opt_ident {
@@ -152,20 +152,20 @@ token double_quoted_unescape {
token double_quoted_buf {
| <before \$ >
- [ <before \$ <.var_twigil> <.ident> > <MiniPerl6::Expression.operator>
- { make ($$<MiniPerl6::Expression.operator>)[1] }
+ [ <before \$ <.var_twigil> <.ident> > <Perlito::Expression.operator>
+ { make ($$<Perlito::Expression.operator>)[1] }
| <char_any>
{ make Val::Buf.new( buf => ~$<char_any> ) }
]
| <before \@ >
- [ <before \@ <.var_twigil> <.ident> > <MiniPerl6::Expression.operator> '[]'
- { make ($$<MiniPerl6::Expression.operator>)[1] }
+ [ <before \@ <.var_twigil> <.ident> > <Perlito::Expression.operator> '[]'
+ { make ($$<Perlito::Expression.operator>)[1] }
| <char_any>
{ make Val::Buf.new( buf => ~$<char_any> ) }
]
| <before \% >
- [ <before \% <.var_twigil> <.ident> > <MiniPerl6::Expression.operator> '{}'
- { make ($$<MiniPerl6::Expression.operator>)[1] }
+ [ <before \% <.var_twigil> <.ident> > <Perlito::Expression.operator> '{}'
+ { make ($$<Perlito::Expression.operator>)[1] }
| <char_any>
{ make Val::Buf.new( buf => ~$<char_any> ) }
]
@@ -198,13 +198,13 @@ token val_int {
}
token exp_stmts {
- | <MiniPerl6::Expression.statement_parse>
+ | <Perlito::Expression.statement_parse>
[
| <.opt_ws> [ \; | '' ] <.opt_ws> <exp_stmts>
<.opt_ws> [ \; <.opt_ws> | '' ]
- { make [ $$<MiniPerl6::Expression.statement_parse>, @( $$<exp_stmts> ) ] }
+ { make [ $$<Perlito::Expression.statement_parse>, @( $$<exp_stmts> ) ] }
| <.opt_ws> [ \; <.opt_ws> | '' ]
- { make [ $$<MiniPerl6::Expression.statement_parse> ] }
+ { make [ $$<Perlito::Expression.statement_parse> ] }
]
| { make [] }
}
@@ -224,14 +224,14 @@ token var_invocant {
token args_sig {
<var_invocant>
<.opt_ws>
- # TODO - MiniPerl6::Expression.list_parse / exp_mapping == positional / named
- <MiniPerl6::Expression.list_parse>
+ # TODO - Perlito::Expression.list_parse / exp_mapping == positional / named
+ <Perlito::Expression.list_parse>
{
# say ' invocant: ', ($$<var_invocant>).perl;
# say ' positional: ', ($$<>).perl;
make Sig.new(
invocant => $$<var_invocant>,
- positional => MiniPerl6::Expression::expand_list(($$<MiniPerl6::Expression.list_parse>){'exp'}),
+ positional => Perlito::Expression::expand_list(($$<Perlito::Expression.list_parse>){'exp'}),
named => { } );
}
}
@@ -272,18 +272,18 @@ token sub_def {
token token {
<opt_name> <.opt_ws> \{
- <MiniPerl6::Grammar::Regex.rule>
+ <Perlito::Grammar::Regex.rule>
\}
{
- #say 'Token was compiled into: ', ($$<MiniPerl6::Grammar::Regex.rule>).perl;
+ #say 'Token was compiled into: ', ($$<Perlito::Grammar::Regex.rule>).perl;
my $source = $<opt_name> ~ ' ( $grammar: $str, $pos ) { ' ~
- 'my $MATCH; $MATCH = MiniPerl6::Match.new( str => $str, from => $pos, to => $pos, bool => 1 ); ' ~
+ 'my $MATCH; $MATCH = Perlito::Match.new( str => $str, from => $pos, to => $pos, bool => 1 ); ' ~
'$MATCH.bool = ( ' ~
- ($$<MiniPerl6::Grammar::Regex.rule>).emit() ~
+ ($$<Perlito::Grammar::Regex.rule>).emit() ~
'); ' ~
'$MATCH }';
#say 'Intermediate code: ', $source;
- my $ast = MiniPerl6::Grammar.method_def( $source, 0 );
+ my $ast = Perlito::Grammar.method_def( $source, 0 );
# say 'Intermediate ast: ', $$ast.emit;
make $$ast;
}
@@ -295,16 +295,16 @@ token token {
=head1 NAME
-MiniPerl6::Grammar - Grammar for MiniPerl6
+Perlito::Grammar - Grammar for Perlito
=head1 SYNOPSIS
my $match = $source.parse;
- ($$match).perl; # generated MiniPerl6 AST
+ ($$match).perl; # generated Perlito AST
=head1 DESCRIPTION
-This module generates a syntax tree for the MiniPerl6 compiler.
+This module generates a syntax tree for the Perlito compiler.
=head1 AUTHORS
View
8 lib/MiniPerl6/Grammar/Control.pm → lib/Perlito/Grammar/Control.pm
@@ -1,7 +1,7 @@
use v6;
-grammar MiniPerl6::Grammar {
+grammar Perlito::Grammar {
token unless {
unless <.ws> <exp>
@@ -132,16 +132,16 @@ token loop {
=head1 NAME
-MiniPerl6::Grammar - Grammar for MiniPerl6
+Perlito::Grammar - Grammar for Perlito
=head1 SYNOPSIS
my $match = $source.parse;
- ($$match).perl; # generated MiniPerl6 AST
+ ($$match).perl; # generated Perlito AST
=head1 DESCRIPTION
-This module generates a syntax tree for the MiniPerl6 compiler.
+This module generates a syntax tree for the Perlito compiler.
=head1 AUTHORS
View
7 lib/Perlito/Grammar/Mapping.pm
@@ -0,0 +1,7 @@
+
+use v6;
+
+grammar Perlito::Grammar {
+ 1;
+}
+
View
46 lib/MiniPerl6/Grammar/Regex.pm → lib/Perlito/Grammar/Regex.pm
@@ -1,13 +1,13 @@
use v6;
-grammar MiniPerl6::Grammar::Regex {
+grammar Perlito::Grammar::Regex {
my %rule_terms;
-token ws { <.MiniPerl6::Grammar.ws> }
+token ws { <.Perlito::Grammar.ws> }
-token rule_ident { <.MiniPerl6::Grammar.full_ident> | <digit> }
+token rule_ident { <.Perlito::Grammar.full_ident> | <digit> }
token any { . }
@@ -53,7 +53,7 @@ token string_code {
token parsed_code {
# this subrule is overridden inside the perl6 compiler
- # XXX - call MiniPerl6 'Statement List'
+ # XXX - call Perlito 'Statement List'
<.string_code>
{ make ~$/ }
}
@@ -73,18 +73,18 @@ token variables {
{ make '$/{' ~ '\'' ~ $<rule_ident> ~ '\'' ~ '}' }
|
# TODO
- <MiniPerl6::Grammar.var_sigil>
- <MiniPerl6::Grammar.val_int>
- { make $<MiniPerl6::Grammar.var_sigil> ~ '/[' ~ $<MiniPerl6::Grammar.val_int> ~ ']' }
+ <Perlito::Grammar.var_sigil>
+ <Perlito::Grammar.val_int>
+ { make $<Perlito::Grammar.var_sigil> ~ '/[' ~ $<Perlito::Grammar.val_int> ~ ']' }
|
- <MiniPerl6::Grammar.var_sigil>
- <MiniPerl6::Grammar.var_twigil>
- <MiniPerl6::Grammar.full_ident>
+ <Perlito::Grammar.var_sigil>
+ <Perlito::Grammar.var_twigil>
+ <Perlito::Grammar.full_ident>
{
make Rul::Var.new(
- sigil => ~$<MiniPerl6::Grammar.var_sigil>,
- twigil => ~$<MiniPerl6::Grammar.var_twigil>,
- name => ~$<MiniPerl6::Grammar.full_ident>
+ sigil => ~$<Perlito::Grammar.var_sigil>,
+ twigil => ~$<Perlito::Grammar.var_twigil>,
+ name => ~$<Perlito::Grammar.full_ident>
)
}
}
@@ -251,10 +251,10 @@ token rule_term {
}
token quant_exp {
- | '**' <.MiniPerl6::Grammar.opt_ws>
+ | '**' <.Perlito::Grammar.opt_ws>
[
- | <MiniPerl6::Grammar.val_int>
- { make $$<MiniPerl6::Grammar.val_int> }
+ | <Perlito::Grammar.val_int>
+ { make $$<Perlito::Grammar.val_int> }
| <rule_term>
{ make $$<rule_term> }
]
@@ -264,19 +264,19 @@ token quant_exp {
token greedy_exp { \? | \+ | '' }
token quantifier {
- <.MiniPerl6::Grammar.opt_ws>
+ <.Perlito::Grammar.opt_ws>
<rule_term>
- <.MiniPerl6::Grammar.opt_ws2>
+ <.Perlito::Grammar.opt_ws2>
[
<quant_exp> <greedy_exp>
- <.MiniPerl6::Grammar.opt_ws3>
+ <.Perlito::Grammar.opt_ws3>
{ make Rul::Quantifier.new(
term => $$<rule_term>,
quant => $$<quant_exp>,
greedy => $$<greedy_exp>,
- ws1 => $$<MiniPerl6::Grammar.opt_ws>,
- ws2 => $$<MiniPerl6::Grammar.opt_ws2>,
- ws3 => $$<MiniPerl6::Grammar.opt_ws3>,
+ ws1 => $$<Perlito::Grammar.opt_ws>,
+ ws2 => $$<Perlito::Grammar.opt_ws2>,
+ ws3 => $$<Perlito::Grammar.opt_ws3>,
)
}
|
@@ -330,7 +330,7 @@ token rule {
=head1 NAME
-MiniPerl6::Grammar::Regex - Grammar for MiniPerl6 Regex
+Perlito::Grammar::Regex - Grammar for Perlito Regex
=head1 SYNOPSIS
View
30 lib/MiniPerl6/Javascript/Emitter.pm → lib/Perlito/Javascript/Emitter.pm
@@ -1,6 +1,6 @@
use v6;
-class MiniPerl6::Javascript::LexicalBlock {
+class Perlito::Javascript::LexicalBlock {
has @.block;
has $.needs_return;
has $.top_level;
@@ -37,12 +37,12 @@ class MiniPerl6::Javascript::LexicalBlock {
if $cond.isa( 'Var' ) && $cond.sigil eq '@' {
$cond = Apply.new( code => 'prefix:<@>', arguments => [ $cond ] );
};
- $body = MiniPerl6::Javascript::LexicalBlock.new( block => $body.stmts, needs_return => 1 );
+ $body = Perlito::Javascript::LexicalBlock.new( block => $body.stmts, needs_return => 1 );
$str = $str
~ 'if ( f_bool(' ~ $cond.emit_javascript() ~ ') ) { '
~ 'return (function () { ' ~ $body.emit_javascript() ~ ' })() }';
if $otherwise {
- $otherwise = MiniPerl6::Javascript::LexicalBlock.new( block => $otherwise.stmts, needs_return => 1 );
+ $otherwise = Perlito::Javascript::LexicalBlock.new( block => $otherwise.stmts, needs_return => 1 );
$str = $str
~ ' else { '
~ 'return (function () { ' ~ $otherwise.emit_javascript() ~ ' })() }';
@@ -114,7 +114,7 @@ class CompUnit {
my $sig = $decl.sig;
my $pos = $sig.positional;
my $invocant = $sig.invocant;
- my $block = MiniPerl6::Javascript::LexicalBlock.new( block => $decl.block, needs_return => 1, top_level => 1 );
+ my $block = Perlito::Javascript::LexicalBlock.new( block => $decl.block, needs_return => 1, top_level => 1 );
$str = $str
~ ' // method ' ~ $decl.name() ~ "\n"
~ ' ' ~ $class_name ~ '.f_' ~ $decl.name()
@@ -127,7 +127,7 @@ class CompUnit {
if $decl.isa( 'Sub' ) {
my $sig = $decl.sig;
my $pos = $sig.positional;
- my $block = MiniPerl6::Javascript::LexicalBlock.new( block => $decl.block, needs_return => 1, top_level => 1 );
+ my $block = Perlito::Javascript::LexicalBlock.new( block => $decl.block, needs_return => 1, top_level => 1 );
$str = $str
~ ' // sub ' ~ $decl.name() ~ "\n"
~ ' ' ~ $class_name ~ '.f_' ~ $decl.name()
@@ -598,11 +598,11 @@ class If {
{
$cond = Apply.new( code => 'prefix:<@>', arguments => [ $cond ] );
}
- my $body = MiniPerl6::Javascript::LexicalBlock.new( block => $.body.stmts, needs_return => 0 );
+ my $body = Perlito::Javascript::LexicalBlock.new( block => $.body.stmts, needs_return => 0 );
my $s = 'if ( f_bool(' ~ $cond.emit_javascript() ~ ') ) { '
~ '(function () { ' ~ $body.emit_javascript() ~ ' })() }';
if $.otherwise {
- my $otherwise = MiniPerl6::Javascript::LexicalBlock.new( block => $.otherwise.stmts, needs_return => 0 );
+ my $otherwise = Perlito::Javascript::LexicalBlock.new( block => $.otherwise.stmts, needs_return => 0 );
$s = $s
~ ' else { '
~ '(function () { ' ~ $otherwise.emit_javascript() ~ ' })() }';
@@ -618,7 +618,7 @@ class While {
has $.continue;
has @.body;
method emit_javascript {
- my $body = MiniPerl6::Javascript::LexicalBlock.new( block => @.body.stmts, needs_return => 0 );
+ my $body = Perlito::Javascript::LexicalBlock.new( block => @.body.stmts, needs_return => 0 );
return
'for ( '
~ ( $.init ?? $.init.emit_javascript() ~ '; ' !! '; ' )
@@ -638,7 +638,7 @@ class For {
if !( $cond.isa( 'Var' ) && $cond.sigil eq '@' ) {
$cond = Lit::Array.new( array1 => [$cond] )
}
- my $body = MiniPerl6::Javascript::LexicalBlock.new( block => @.body.stmts, needs_return => 0 );
+ my $body = Perlito::Javascript::LexicalBlock.new( block => @.body.stmts, needs_return => 0 );
my $sig = 'v__';
if $.body.sig() {
$sig = $.body.sig.emit_javascript();
@@ -695,7 +695,7 @@ class Method {
my $pos = $sig.positional;
my $str = $pos.>>emit_javascript.join(', ');
'function ' ~ $.name ~ '(' ~ $str ~ ') { ' ~
- (MiniPerl6::Javascript::LexicalBlock.new( block => @.block, needs_return => 1, top_level => 1 )).emit_javascript() ~
+ (Perlito::Javascript::LexicalBlock.new( block => @.block, needs_return => 1, top_level => 1 )).emit_javascript() ~
' }'
}
}
@@ -709,7 +709,7 @@ class Sub {
my $pos = $sig.positional;
my $str = $pos.>>emit_javascript.join(', ');
'function ' ~ $.name ~ '(' ~ $str ~ ') { ' ~
- (MiniPerl6::Javascript::LexicalBlock.new( block => @.block, needs_return => 1, top_level => 1 )).emit_javascript() ~
+ (Perlito::Javascript::LexicalBlock.new( block => @.block, needs_return => 1, top_level => 1 )).emit_javascript() ~
' }'
}
}
@@ -723,12 +723,12 @@ class Do {
if @.block.isa('Lit::Block') {
return
'(function () { ' ~
- (MiniPerl6::Javascript::LexicalBlock.new( block => @.block.stmts, needs_return => 1 )).emit_javascript() ~
+ (Perlito::Javascript::LexicalBlock.new( block => @.block.stmts, needs_return => 1 )).emit_javascript() ~
' })()'
}
return
'(function () { ' ~
- (MiniPerl6::Javascript::LexicalBlock.new( block => @.block, needs_return => 1 )).emit_javascript() ~
+ (Perlito::Javascript::LexicalBlock.new( block => @.block, needs_return => 1 )).emit_javascript() ~
' })()'
}
}
@@ -744,7 +744,7 @@ class Use {
=head1 NAME
-MiniPerl6::Javascript::Emit - Code generator for MiniPerl6-in-Javascript
+Perlito::Javascript::Emit - Code generator for Perlito-in-Javascript
=head1 SYNOPSIS
@@ -752,7 +752,7 @@ MiniPerl6::Javascript::Emit - Code generator for MiniPerl6-in-Javascript
=head1 DESCRIPTION
-This module generates Javascript code for the MiniPerl6 compiler.
+This module generates Javascript code for the Perlito compiler.
=head1 AUTHORS
View
6 lib/MiniPerl6/Javascript/Prelude.pm → lib/Perlito/Javascript/Prelude.pm
@@ -1,6 +1,6 @@
use v6;
-class MiniPerl6::Match {
+class Perlito::Match {
has $.from;
has $.to;
has $.str;
@@ -58,13 +58,13 @@ class Main {
=head1 NAME
-MiniPerl6::Lisp::Prelude - Runtime for MiniPerl6-in-Lisp
+Perlito::Lisp::Prelude - Runtime for Perlito-in-Lisp
=head1 SYNOPSIS
=head1 DESCRIPTION
-This module contains MiniPerl6 code for the MiniPerl6-in-Lisp runtime.
+This module contains Perlito code for the Perlito-in-Lisp runtime.
=head1 AUTHORS
View
44 lib5/MiniPerl6/Javascript/Runtime.js → lib/Perlito/Javascript/Runtime.js
@@ -1,6 +1,6 @@
-// lib/MiniPerl6/Javascript/Runtime.js
+// lib/Perlito/Javascript/Runtime.js
//
-// Runtime for "Perlito" MiniPerl6-in-Javascript
+// Runtime for "Perlito" Perlito-in-Javascript
//
// AUTHORS
//
@@ -95,15 +95,15 @@ if (typeof Main != 'object') {
}
})();
-if (typeof MiniPerl6$Match != 'object') {
- MiniPerl6$Match = function() {};
- MiniPerl6$Match = new MiniPerl6$Match;
- MiniPerl6$Match.f_isa = function (s) { return s == 'MiniPerl6::Match' };
- MiniPerl6$Match.f_perl = function () { return 'MiniPerl6::Match.new(' + Main._dump(this) + ')' };
+if (typeof Perlito$Match != 'object') {
+ Perlito$Match = function() {};
+ Perlito$Match = new Perlito$Match;
+ Perlito$Match.f_isa = function (s) { return s == 'Perlito::Match' };
+ Perlito$Match.f_perl = function () { return 'Perlito::Match.new(' + Main._dump(this) + ')' };
}
v_MATCH = {};
-v_MATCH.__proto__ = MiniPerl6$Match;
-MiniPerl6$Match.f_hash = function () { return this }
+v_MATCH.__proto__ = Perlito$Match;
+Perlito$Match.f_hash = function () { return this }
if (typeof f_print != 'function') {
var buf = "";
@@ -301,41 +301,41 @@ f_chars = function (o) {
}
// regex primitives
-if (typeof MiniPerl6$Grammar != 'object') {
- MiniPerl6$Grammar = function() {};
- MiniPerl6$Grammar = new MiniPerl6$Grammar;
+if (typeof Perlito$Grammar != 'object') {
+ Perlito$Grammar = function() {};
+ Perlito$Grammar = new Perlito$Grammar;
}
-MiniPerl6$Grammar.f_word = function (v_str, v_pos) {
+Perlito$Grammar.f_word = function (v_str, v_pos) {
var tmp = {
v_str: v_str,
v_from: v_pos,
v_to: v_pos + 1,
v_bool: v_str.substr(v_pos, 1).match(/\w/) != null
};
- tmp.__proto__ = MiniPerl6$Match;
+ tmp.__proto__ = Perlito$Match;
return tmp;
}
-MiniPerl6$Grammar.f_digit = function (v_str, v_pos) {
+Perlito$Grammar.f_digit = function (v_str, v_pos) {
var tmp = {
v_str: v_str,
v_from: v_pos,
v_to: v_pos + 1,
v_bool: v_str.substr(v_pos, 1).match(/\d/) != null
};
- tmp.__proto__ = MiniPerl6$Match;
+ tmp.__proto__ = Perlito$Match;
return tmp;
}
-MiniPerl6$Grammar.f_space = function (v_str, v_pos) {
+Perlito$Grammar.f_space = function (v_str, v_pos) {
var tmp = {
v_str: v_str,
v_from: v_pos,
v_to: v_pos + 1,
v_bool: v_str.substr(v_pos, 1).match(/\s/) != null
};
- tmp.__proto__ = MiniPerl6$Match;
+ tmp.__proto__ = Perlito$Match;
return tmp;
}
-MiniPerl6$Grammar.f_is_newline = function (v_str, v_pos) {
+Perlito$Grammar.f_is_newline = function (v_str, v_pos) {
var m_ = v_str.substr(v_pos).match(/^(\r\n?|\n\r?)/);
var tmp = {
v_str: v_str,
@@ -343,17 +343,17 @@ MiniPerl6$Grammar.f_is_newline = function (v_str, v_pos) {
v_to: m_ != null ? v_pos + m_[0].length : v_pos,
v_bool: m_ != null,
};
- tmp.__proto__ = MiniPerl6$Match;
+ tmp.__proto__ = Perlito$Match;
return tmp;
}
-MiniPerl6$Grammar.f_not_newline = function (v_str, v_pos) {
+Perlito$Grammar.f_not_newline = function (v_str, v_pos) {
var tmp = {
v_str: v_str,
v_from: v_pos,
v_to: v_pos + 1,
v_bool: v_str.substr(v_pos, 1).match(/[^\r\n]/) != null
};
- tmp.__proto__ = MiniPerl6$Match;
+ tmp.__proto__ = Perlito$Match;
return tmp;
}
View
22 lib/MiniPerl6/Lisp/Emitter.pm → lib/Perlito/Lisp/Emitter.pm
@@ -1,6 +1,6 @@
use v6;
-class MiniPerl6::Lisp::LexicalBlock {
+class Perlito::Lisp::LexicalBlock {
has @.block;
method emit_lisp {
if !(@.block) {
@@ -112,7 +112,7 @@ class CompUnit {
if ( $str_optionals ) {
$str_specific = $str_specific ~ ' &optional' ~ $str_optionals;
}
- my $block = MiniPerl6::Lisp::LexicalBlock.new( block => $decl.block );
+ my $block = Perlito::Lisp::LexicalBlock.new( block => $decl.block );
$str = $str
~ ';; method ' ~ $decl.name ~ "\n"
~ '(defmethod ' ~ Main::to_lisp_identifier($decl.name) ~ ' (' ~ $str_specific ~ ')'
@@ -134,7 +134,7 @@ class CompUnit {
if $param {
$sig = '&optional ' ~ $param;
}
- my $block = MiniPerl6::Lisp::LexicalBlock.new( block => $decl.block );
+ my $block = Perlito::Lisp::LexicalBlock.new( block => $decl.block );
$str = $str
~ '(defmethod ' ~ $class_name ~ '-' ~ Main::to_lisp_identifier($decl.name) ~ ' (' ~ $sig ~ ')'
~ $ignorable ~ "\n"
@@ -620,8 +620,8 @@ class If {
has @.body;
has @.otherwise;
method emit_lisp {
- my $block1 = MiniPerl6::Lisp::LexicalBlock.new( block => @.body );
- my $block2 = MiniPerl6::Lisp::LexicalBlock.new( block => @.otherwise );
+ my $block1 = Perlito::Lisp::LexicalBlock.new( block => @.body );
+ my $block2 = Perlito::Lisp::LexicalBlock.new( block => @.otherwise );
'(if (sv-bool ' ~ $.cond.emit_lisp ~ ') ' ~ $block1.emit_lisp ~ ' ' ~ $block2.emit_lisp ~ ')';
}
}
@@ -632,7 +632,7 @@ class For {
has @.topic;
method emit_lisp {
my $cond = $.cond;
- my $block = MiniPerl6::Lisp::LexicalBlock.new( block => @.body );
+ my $block = Perlito::Lisp::LexicalBlock.new( block => @.body );
if $cond.isa( 'Var' )
&& $cond.sigil eq '@'
{
@@ -663,7 +663,7 @@ class While {
'(progn '
~ ( $.init ?? $.init.emit_lisp ~ ' ' !! '' )
~ '(loop while (sv-bool ' ~ $.cond.emit_lisp ~ ') do '
- ~ (MiniPerl6::Lisp::LexicalBlock.new( block => @body )).emit_lisp
+ ~ (Perlito::Lisp::LexicalBlock.new( block => @body )).emit_lisp
~ '))';
}
}
@@ -721,7 +721,7 @@ class Sub {
method emit_lisp {
my $sig = $.sig;
my $pos = $sig.positional;
- my $block = MiniPerl6::Lisp::LexicalBlock.new( block => @.block );
+ my $block = Perlito::Lisp::LexicalBlock.new( block => @.block );
my $str;
if @$pos {
for @$pos -> $field {
@@ -750,7 +750,7 @@ class Sub {
class Do {
has @.block;
method emit_lisp {
- my $block = MiniPerl6::Lisp::LexicalBlock.new( block => @.block );
+ my $block = Perlito::Lisp::LexicalBlock.new( block => @.block );
return $block.emit_lisp;
}
}
@@ -767,7 +767,7 @@ class Use {
=head1 NAME
-MiniPerl6::Lisp::Emit - Code generator for MiniPerl6-in-Lisp (SBCL)
+Perlito::Lisp::Emit - Code generator for Perlito-in-Lisp (SBCL)
=head1 SYNOPSIS
@@ -775,7 +775,7 @@ MiniPerl6::Lisp::Emit - Code generator for MiniPerl6-in-Lisp (SBCL)
=head1 DESCRIPTION
-This module generates Lisp code for the MiniPerl6 compiler.
+This module generates Lisp code for the Perlito compiler.
=head1 AUTHORS
View
6 lib/MiniPerl6/Lisp/Prelude.pm → lib/Perlito/Lisp/Prelude.pm
@@ -1,6 +1,6 @@
use v6;
-class MiniPerl6::Match {
+class Perlito::Match {
has $.from;
has $.to;
has $.str;
@@ -60,13 +60,13 @@ class Main {
=head1 NAME
-MiniPerl6::Lisp::Prelude - Runtime for MiniPerl6-in-Lisp
+Perlito::Lisp::Prelude - Runtime for Perlito-in-Lisp
=head1 SYNOPSIS
=head1 DESCRIPTION
-This module contains MiniPerl6 code for the MiniPerl6-in-Lisp runtime.
+This module contains Perlito code for the Perlito-in-Lisp runtime.
=head1 AUTHORS
View
52 lib/MiniPerl6/Lisp/Runtime.lisp → lib/Perlito/Lisp/Runtime.lisp
@@ -1,5 +1,5 @@
-;; MiniPerl6 Lisp runtime
+;; Perlito Lisp runtime
;;
;; Author: Flavio Soibelmann Glock <fglock@gmail.com>
;;
@@ -266,91 +266,91 @@
;; Grammars
-(if (not (ignore-errors (find-class 'mp-MiniPerl6-Grammar)))
- (defclass mp-MiniPerl6-Grammar () ()))
+(if (not (ignore-errors (find-class 'mp-Perlito-Grammar)))
+ (defclass mp-Perlito-Grammar () ()))
(let (x)
- (setq x (make-instance 'mp-MiniPerl6-Grammar))
- (defun proto-mp-MiniPerl6-Grammar () x))
+ (setq x (make-instance 'mp-Perlito-Grammar))
+ (defun proto-mp-Perlito-Grammar () x))
;; token <space>
(if (not (ignore-errors (find-method 'sv-space () ())))
(defgeneric sv-space (sv-grammar &optional sv-str sv-pos)
(:documentation "a method")))
-(defmethod sv-space ((sv-grammar mp-MiniPerl6-Grammar) &optional sv-str sv-pos)
+(defmethod sv-space ((sv-grammar mp-Perlito-Grammar) &optional sv-str sv-pos)
(if (ignore-errors (or (char= (aref sv-str sv-pos) #\Space) (char= (aref sv-str sv-pos) #\Tab)))
- (let ((m (make-instance 'mp-MiniPerl6-Match)))
+ (let ((m (make-instance 'mp-Perlito-Match)))
(setf (sv-str m) sv-str)(setf (sv-from m) sv-pos)(setf (sv-to m) (+ sv-pos 1))(setf (sv-bool m) 1) m)
- (let ((m (make-instance 'mp-MiniPerl6-Match)))
+ (let ((m (make-instance 'mp-Perlito-Match)))
(setf (sv-bool m) nil) m)))
;; token <digit>
(if (not (ignore-errors (find-method 'sv-digit () ())))
(defgeneric sv-digit (sv-grammar &optional sv-str sv-pos)
(:documentation "a method")))
-(defmethod sv-digit ((sv-grammar mp-MiniPerl6-Grammar) &optional sv-str sv-pos)
+(defmethod sv-digit ((sv-grammar mp-Perlito-Grammar) &optional sv-str sv-pos)
(if (ignore-errors (digit-char-p (aref sv-str sv-pos)))
- (let ((m (make-instance 'mp-MiniPerl6-Match)))
+ (let ((m (make-instance 'mp-Perlito-Match)))
(setf (sv-str m) sv-str)(setf (sv-from m) sv-pos)(setf (sv-to m) (+ sv-pos 1))(setf (sv-bool m) 1) m)
- (let ((m (make-instance 'mp-MiniPerl6-Match)))
+ (let ((m (make-instance 'mp-Perlito-Match)))
(setf (sv-bool m) nil) m)))
;; token <word>
(if (not (ignore-errors (find-method 'sv-word () ())))
(defgeneric sv-word (sv-grammar &optional sv-str sv-pos)
(:documentation "a method")))
-(defmethod sv-word ((sv-grammar mp-MiniPerl6-Grammar) &optional sv-str sv-pos)
+(defmethod sv-word ((sv-grammar mp-Perlito-Grammar) &optional sv-str sv-pos)
(if (ignore-errors (or (alphanumericp (aref sv-str sv-pos)) (char= (aref sv-str sv-pos) #\_)))
- (let ((m (make-instance 'mp-MiniPerl6-Match)))
+ (let ((m (make-instance 'mp-Perlito-Match)))
(setf (sv-str m) sv-str)(setf (sv-from m) sv-pos)(setf (sv-to m) (+ sv-pos 1))(setf (sv-bool m) 1) m)
- (let ((m (make-instance 'mp-MiniPerl6-Match)))
+ (let ((m (make-instance 'mp-Perlito-Match)))
(setf (sv-bool m) nil) m)))
;; token <is_newline>
(if (not (ignore-errors (find-method 'sv-is_newline () ())))
(defgeneric sv-is_newline (sv-grammar &optional sv-str sv-pos)
(:documentation "a method")))
-(defmethod sv-is_newline ((sv-grammar mp-MiniPerl6-Grammar) &optional sv-str sv-pos)
+(defmethod sv-is_newline ((sv-grammar mp-Perlito-Grammar) &optional sv-str sv-pos)
(let (from)
(setq from sv-pos)
(if (ignore-errors (char= (aref sv-str sv-pos) #\Return))
(progn (setf sv-pos (+ sv-pos 1))
(if (ignore-errors (char= (aref sv-str sv-pos) #\Newline)) (setf sv-pos (+ sv-pos 1)))
- (let ((m (make-instance 'mp-MiniPerl6-Match)))
+ (let ((m (make-instance 'mp-Perlito-Match)))
(setf (sv-str m) sv-str)(setf (sv-from m) from)(setf (sv-to m) sv-pos)(setf (sv-bool m) 1) m))
(if (ignore-errors (char= (aref sv-str sv-pos) #\Newline))
(progn (setf sv-pos (+ sv-pos 1))
(if (ignore-errors (char= (aref sv-str sv-pos) #\Return)) (setf sv-pos (+ sv-pos 1)))
- (let ((m (make-instance 'mp-MiniPerl6-Match)))
+ (let ((m (make-instance 'mp-Perlito-Match)))
(setf (sv-str m) sv-str)(setf (sv-from m) from)(setf (sv-to m) sv-pos)(setf (sv-bool m) 1) m))
- (let ((m (make-instance 'mp-MiniPerl6-Match)))
+ (let ((m (make-instance 'mp-Perlito-Match)))
(setf (sv-bool m) nil) m)))))
;; token <not_newline>
(if (not (ignore-errors (find-method 'sv-not_newline () ())))
(defgeneric sv-not_newline (sv-grammar &optional sv-str sv-pos)
(:documentation "a method")))
-(defmethod sv-not_newline ((sv-grammar mp-MiniPerl6-Grammar) &optional sv-str sv-pos)
+(defmethod sv-not_newline ((sv-grammar mp-Perlito-Grammar) &optional sv-str sv-pos)
(if (not (ignore-errors (or (char= (aref sv-str sv-pos) #\Return) (char= (aref sv-str sv-pos) #\Newline))))
- (let ((m (make-instance 'mp-MiniPerl6-Match)))
+ (let ((m (make-instance 'mp-Perlito-Match)))
(setf (sv-str m) sv-str)(setf (sv-from m) sv-pos)(setf (sv-to m) (+ sv-pos 1))(setf (sv-bool m) 1) m)
- (let ((m (make-instance 'mp-MiniPerl6-Match)))
+ (let ((m (make-instance 'mp-Perlito-Match)))
(setf (sv-bool m) nil) m)))
;; Match objects
-(if (not (ignore-errors (find-class 'mp-MiniPerl6-Match)))
- (defclass mp-MiniPerl6-Match ()
+(if (not (ignore-errors (find-class 'mp-Perlito-Match)))
+ (defclass mp-Perlito-Match ()
(hash array)))
-(defvar sv-MATCH (make-instance 'mp-MiniPerl6-Match))
+(defvar sv-MATCH (make-instance 'mp-Perlito-Match))
-(defmethod sv-hash ((m mp-MiniPerl6-Match))
+(defmethod sv-hash ((m mp-Perlito-Match))
(or
(ignore-errors (slot-value m 'hash))
(setf (slot-value m 'hash) (make-hash-table :test 'equal))))
-(defmethod sv-array ((m mp-MiniPerl6-Match))
+(defmethod sv-array ((m mp-Perlito-Match))
(or
(ignore-errors (slot-value m 'array))
(setf (slot-value m 'array) (make-array 0 :adjustable 1))))
View
4 lib/MiniPerl6/Parrot/Emitter.pm → lib/Perlito/Parrot/Emitter.pm
@@ -888,7 +888,7 @@ class Use {
=head1 NAME
-MiniPerl6::Parrot::Emit - Code generator for MiniPerl6-in-Parrot
+Perlito::Parrot::Emit - Code generator for Perlito-in-Parrot
=head1 SYNOPSIS
@@ -896,7 +896,7 @@ MiniPerl6::Parrot::Emit - Code generator for MiniPerl6-in-Parrot
=head1 DESCRIPTION
-This module generates Parrot code for the MiniPerl6 compiler.
+This module generates Parrot code for the Perlito compiler.
=head1 AUTHORS
View
4 lib/MiniPerl6/Parrot/Match.pm → lib/Perlito/Parrot/Match.pm
@@ -3,8 +3,8 @@ use v6;
# See also: parrot/compilers/pge/PGE/Match.pir
-# XXX - class name - fix MiniPerl6::Emitter::Token to emit 'MiniPerl6::Runtime::Match' instead
-class MiniPerl6::Perl5::Match {
+# XXX - class name - fix Perlito::Emitter::Token to emit 'Perlito::Runtime::Match' instead
+class Perlito::Perl5::Match {
has $.str;
has $.array;
has $.hash;
View
4 lib/MiniPerl6/Perl5/Emitter.pm → lib/Perlito/Perl5/Emitter.pm
@@ -550,7 +550,7 @@ class Use {
=head1 NAME
-MiniPerl6::Perl5::Emit - Code generator for MiniPerl6-in-Perl5
+Perlito::Perl5::Emit - Code generator for Perlito-in-Perl5
=head1 SYNOPSIS
@@ -558,7 +558,7 @@ MiniPerl6::Perl5::Emit - Code generator for MiniPerl6-in-Perl5
=head1 DESCRIPTION
-This module generates Perl5 code for the MiniPerl6 compiler.
+This module generates Perl5 code for the Perlito compiler.
=head1 AUTHORS
View
6 lib/MiniPerl6/Perl5/Prelude.pm → lib/Perlito/Perl5/Prelude.pm
@@ -1,6 +1,6 @@
use v6;
-class MiniPerl6::Match {
+class Perlito::Match {
has $.from;
has $.to;
has $.str;
@@ -15,13 +15,13 @@ class MiniPerl6::Match {
=head1 NAME
-MiniPerl6::Lisp::Prelude - Runtime for MiniPerl6-in-Lisp
+Perlito::Lisp::Prelude - Runtime for Perlito-in-Lisp
=head1 SYNOPSIS
=head1 DESCRIPTION
-This module contains MiniPerl6 code for the MiniPerl6-in-Lisp runtime.
+This module contains Perlito code for the Perlito-in-Lisp runtime.
=head1 AUTHORS
View
18 lib5/MiniPerl6/Perl5/Runtime.pm → lib/Perlito/Perl5/Runtime.pm
@@ -3,7 +3,7 @@ use v5;
binmode(STDOUT, ":utf8");
{
- package MiniPerl6::Match;
+ package Perlito::Match;
use strict;
use warnings;
@@ -66,11 +66,11 @@ binmode(STDOUT, ":utf8");
}
-package MiniPerl6::Grammar;
+package Perlito::Grammar;
sub space {
my $grammar = $_[0]; my $str = $_[1]; my $pos = $_[2];
my $MATCH;
- $MATCH = MiniPerl6::Match->new(
+ $MATCH = Perlito::Match->new(
str => $str,from => $pos,to => $pos, );
$MATCH->{bool} = (
substr($str, $MATCH->to()) =~ m/^([[:space:]])/
@@ -81,7 +81,7 @@ package MiniPerl6::Grammar;
}
sub digit {
my $grammar = $_[0]; my $str = $_[1]; my $pos = $_[2];
- my $MATCH; $MATCH = MiniPerl6::Match->new(
+ my $MATCH; $MATCH = Perlito::Match->new(
str => $str,from => $pos,to => $pos, );
$MATCH->{bool} = (
substr($str, $MATCH->to()) =~ m/^([[:digit:]])/
@@ -93,7 +93,7 @@ package MiniPerl6::Grammar;
sub word {
my $grammar = $_[0]; my $str = $_[1]; my $pos = $_[2];
- my $MATCH; $MATCH = MiniPerl6::Match->new(
+ my $MATCH; $MATCH = Perlito::Match->new(
str => $str,from => $pos,to => $pos, );
$MATCH->{bool} = (
substr($str, $MATCH->to()) =~ m/^([[:word:]])/
@@ -105,7 +105,7 @@ package MiniPerl6::Grammar;
sub is_newline {
my $grammar = $_[0]; my $str = $_[1]; my $pos = $_[2];
- my $MATCH; $MATCH = MiniPerl6::Match->new(
+ my $MATCH; $MATCH = Perlito::Match->new(
str => $str,from => $pos,to => $pos, );
return $MATCH unless ord( substr($str, $MATCH->to()) ) == 10
|| ord( substr($str, $MATCH->to()) ) == 13;
@@ -118,7 +118,7 @@ package MiniPerl6::Grammar;
}
sub not_newline {
my $grammar = $_[0]; my $str = $_[1]; my $pos = $_[2];
- my $MATCH; $MATCH = MiniPerl6::Match->new(
+ my $MATCH; $MATCH = Perlito::Match->new(
str => $str,from => $pos,to => $pos, bool => 0 );
return $MATCH if ord( substr($str, $MATCH->to()) ) == 10
|| ord( substr($str, $MATCH->to()) ) == 13;
@@ -296,11 +296,11 @@ __END__
=head1 NAME
-MiniPerl6::Perl5::Runtime
+Perlito::Perl5::Runtime
=head1 DESCRIPTION
-Provides runtime routines for the MiniPerl6-in-Perl5 compiled code
+Provides runtime routines for the Perlito-in-Perl5 compiled code
=head1 AUTHORS
View
14 lib/MiniPerl6/Precedence.pm → lib/Perlito/Precedence.pm
@@ -1,5 +1,5 @@
-class MiniPerl6::Precedence {
+class Perlito::Precedence {
has $.get_token;
has $.reduce;
@@ -42,7 +42,7 @@ class MiniPerl6::Precedence {
if is_ident_middle($c1) && ( is_ident_middle($c2) || $c2 eq '(' ) {
}
else {
- return MiniPerl6::Match.new( 'str' => $str, 'from' => $from, 'to' => $pos+2, 'bool' => 1,
+