Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:rakudo/rakudo
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Mar 2, 2009
2 parents 21e5dc3 + 0d369db commit 50279cf
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 40 deletions.
7 changes: 7 additions & 0 deletions docs/glossary.pod
Expand Up @@ -57,6 +57,13 @@ for parsers ( C<PCT::Grammar> ), a base class for compilers
( C<PCT::HLLCompiler> ), an abstract syntax tree representation
(PAST), and a PAST compiler.

=item PGE - Parse Grammar Engine

The Parse Grammar Engine is the primarily regular expression
engine for Rakudo and Parrot. It's the component that handles
grammars and regular expressions in Rakudo, as well as being
the primary foundation for parsing Perl 6 itself.

=item Rakudo

Rakudo is the name of a Perl 6 implementation that runs on Parrot.
Expand Down
4 changes: 2 additions & 2 deletions docs/release_guide.pod
Expand Up @@ -18,8 +18,8 @@ part of monthly Parrot releases.

Dates are based on Parrot's expected release schedule.

2009-03-18 Rakudo #15
2009-04-23 Rakudo #16 "Oslo"
2009-03-18 Rakudo #15 "Oslo"
2009-04-23 Rakudo #16
2009-05-21 Rakudo #17
2009-06-18 Rakudo #18 (likely "Pittsburgh")
2009-07-23 Rakudo #19
Expand Down
3 changes: 3 additions & 0 deletions docs/spectest-progress.csv
Expand Up @@ -280,3 +280,6 @@
"2009-02-24 00:00",e074bf4,6999,0,308,1987,9294,15232,314
"2009-02-25 00:00",5944501,7007,0,310,1985,9302,15240,314
"2009-02-26 00:00",e6b7133,7041,0,309,1962,9312,15250,314
"2009-02-27 00:00",08b7890,7037,48,311,1947,9343,15261,315
"2009-02-28 00:00",c1f3976,7084,0,315,1944,9343,15261,315
"2009-03-01 00:00",af4b730,7084,0,315,1944,9343,15261,315
40 changes: 38 additions & 2 deletions perl6.pir
Expand Up @@ -153,8 +153,9 @@ to the Perl 6 compiler.
.sub 'main' :main
.param pmc args_str

$S0 = args_str[1]
if $S0 != '-le' goto not_harness
$S0 = args_str[2]
$I0 = index $S0, '@INC'
if $I0 < 0 goto not_harness
exit 0
not_harness:

Expand Down Expand Up @@ -231,6 +232,41 @@ to the Perl 6 compiler.
.include 'src/gen_metaop.pir'
.include 'src/gen_junction.pir'

=item postload()

Perform any tasks that need to be done at the end of loading.
Currently this does the equivalent of EXPORTALL on the core namespaces.

=cut

.namespace []

.sub '' :anon :load :init
.local pmc perl6, nslist, nsiter
perl6 = get_hll_global ['Perl6'], 'Compiler'
nslist = split ' ', 'Any'
nsiter = iter nslist
ns_loop:
unless nsiter goto ns_done
$S0 = shift nsiter
$S0 .= '::EXPORT::ALL'
$P0 = perl6.'parse_name'($S0)
.local pmc ns, symiter
ns = get_hll_namespace $P0
if null ns goto ns_loop
symiter = iter ns
sym_loop:
unless symiter goto sym_done
$S0 = shift symiter
$P0 = ns[$S0]
set_global $S0, $P0
goto sym_loop
sym_done:
goto ns_loop
ns_done:
.end


# Local Variables:
# mode: pir
# fill-column: 100
Expand Down
2 changes: 1 addition & 1 deletion src/classes/ClassHOW.pir
Expand Up @@ -61,7 +61,7 @@ Dispatches to method of the given name on this class or one of its parents.
mro = inspect parrotclass, 'all_parents'
mro_it = iter mro

# Iterate MRO and check it's methods.
# Iterate MRO and check its methods.
.local int have_pmc_proxy
have_pmc_proxy = 0
mro_loop:
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Grammar.pir
Expand Up @@ -14,7 +14,7 @@ This file implements the Grammar class.
load_bytecode "PGE.pbc"
.local pmc p6meta
p6meta = get_hll_global ['Perl6Object'], '$!P6META'
p6meta.'new_class'('Grammar', 'parent'=>'PGE::Grammar')
p6meta.'new_class'('Grammar', 'parent'=>'Match')
.end

=head2 Methods
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Match.pir
Expand Up @@ -11,7 +11,7 @@ Match - Perl 6 match objects
.sub '' :anon :load :init
.local pmc p6meta, matchproto
p6meta = get_hll_global ['Perl6Object'], '$!P6META'
matchproto = p6meta.'new_class'('Match', 'parent'=>'PGE::Match Any')
matchproto = p6meta.'new_class'('Match', 'parent'=>'PGE::Grammar Any')
$P0 = get_hll_global 'Positional'
$P0 = $P0.'!select'()
p6meta.'add_role'($P0, 'to'=>matchproto)
Expand Down
18 changes: 7 additions & 11 deletions src/parser/actions.pm
Expand Up @@ -3048,20 +3048,16 @@ sub transform_to_multi($past) {
# by infix:~~ and the when statement.
sub process_smartmatch($lhs, $rhs, $rhs_pt) {
if $rhs_pt<noun><dotty> {
# Method truth - just call RHS.
# method truth
$rhs<invocant_holder>[0] := $lhs;
return PAST::Op.new(
:pasttype('call'),
:name('prefix:?'),
$rhs
);
if $rhs_pt<noun><dotty><dottyop><postcircumfix> {
# array/hash slice truth
$rhs := PAST::Op.new( :pasttype('call'), :name('all'), $rhs);
}
return PAST::Op.new( :pasttype('call'), :name('prefix:?'), $rhs);
}
else {
return PAST::Op.new(
:pasttype('call'),
:name('infix:~~'),
$lhs, $rhs
);
return PAST::Op.new( :pasttype('call'), :name('infix:~~'), $lhs, $rhs);
}
}

Expand Down
56 changes: 36 additions & 20 deletions src/parser/grammar.pg
Expand Up @@ -89,6 +89,7 @@ token unsp {
}

token unspacey { <.unsp>? }
token nofun { <!before '(' | '.(' | '\\' > }

token unv {
|| \h+
Expand Down Expand Up @@ -183,7 +184,7 @@ token terminator {
| <[ ; ) \] } ]>
| '!!'
| '-->'
| [ if | unless | while | until | for | given | when ] >>
| [ if | unless | while | until | for | given | when ] >> <.nofun>
}

token stdstopper {
Expand All @@ -193,13 +194,7 @@ token stdstopper {
token eat_terminator {
|| ';'
|| <?terminator>
|| {{ $P0 = get_global '$!endstmt'
$P1 = get_global '$!ws'
$P2 = $P1.'from'()
if $P0 != $P2 goto end
.return (1)
end:
}} <fail> # FIXME: <!>
|| <?AT_STATEMENT_END>
|| $
|| <.panic: "Statement not terminated properly">
}
Expand All @@ -212,21 +207,34 @@ token MARK_STATEMENT_END {
<.ws>
}

token AT_STATEMENT_END {
<?{{
$P0 = get_global '$!endstmt'
$P1 = get_global '$!ws'
$P2 = $P1.'from'()
$I0 = iseq $P0, $P2
.return ($I0)
}}>
}



## Parse a single statement, which may be either a bare block
## or an expression. Any statement termination is handled by
## the calling rule.
rule statement {
token statement {
[
| <statement_control> {*} #= control
| <expr=EXPR>
[
|| <?AT_STATEMENT_END> {*} #= expr
|| <statement_mod_loop> {*} #= mod_loop
|| <statement_mod_cond>
|| <statement_mod_cond> <.ws>
<statement_mod_loop>?
{*} #= mod_cond
|| {*} #= expr
]
<.ws>
| <?before ';'> {*} #= null
]
{{ $P0 = get_hll_global ['Bool'], 'False'
Expand All @@ -252,15 +260,15 @@ rule statement_control {
}

rule if_statement {
$<sym>=[if]
$<sym>=[if<.nofun>]
<xblock>
[ 'elsif' <xblock> ]*
[ 'else' <pblock> ]?
{*}
}

rule unless_statement {
$<sym>=[unless]
$<sym>=[unless<.nofun>]
<xblock> {*}
[ <!before 'else'> || <.panic: "unless does not take \"else\" in Perl 6; please rewrite using \"if\""> ]
}
Expand All @@ -274,19 +282,19 @@ rule repeat_statement {
}

rule while_statement {
$<sym>=[while|until]
$<sym>=[[while|until]<.nofun>]
<xblock>
{*}
}

rule given_statement {
$<sym>=[given]
$<sym>=[given<.nofun>]
<xblock>
{*}
}

rule when_statement {
$<sym>=[when]
$<sym>=[when<.nofun>]
<EXPR> <block>
{*}
}
Expand All @@ -311,7 +319,7 @@ rule loop_statement {
}

rule for_statement {
$<sym>=[for]
$<sym>=[for<.nofun>]
<xblock>
{*}
}
Expand Down Expand Up @@ -351,11 +359,11 @@ rule no_statement {
}

rule statement_mod_loop {
$<sym>=[while|until|for|given] <EXPR> {*}
$<sym>=[[while|until|for|given]<.nofun>] <EXPR> {*}
}

rule statement_mod_cond {
$<sym>=[if|unless|when] <EXPR> {*}
$<sym>=[[if|unless|when]<.nofun>] <EXPR> {*}
}

rule statement_prefix {
Expand Down Expand Up @@ -810,12 +818,20 @@ token quote {
# | <.before '«' > <quote_expression: :ww :qq> FIXME: unicode
| <.before '/'> <quote_expression: :regex>
| m <.ws> <quote_expression: :regex>
| q
| q [ <.ws> ':' ]?
[ q <.ws> <quote_expression: :qq>
| w <.ws> <quote_expression: :q :w>
| ':PIR' <.ws> <quote_expression: :PIR>
| 'PIR' <.ws> <quote_expression: :PIR>
| x <.ws> <.panic: "qx not yet implemented">
| <.ws> <quote_expression: :q>
]
| Q [ <.ws> ':' ]?
[ 'PIR' <.ws> <quote_expression: :PIR>
| 'q' <.ws> <quote_expression: :q>
| 'qq' <.ws> <quote_expression: :qq>
| 'b' <.ws> <quote_expression: :b>
| <.ws> <quote_expression: >
]
]
{*}
}
Expand Down
2 changes: 1 addition & 1 deletion t/harness
Expand Up @@ -19,7 +19,7 @@ $Test::Harness::switches = '';
GetOptions(
'tests-from-file=s' => \my $list_file,
'fudge' => \my $do_fudge,
'verbosity=i' => \my $verbosity,
'verbosity=i' => \$Test::Harness::verbose,
'jobs:3' => \my $jobs,
);
my @pass_through_options = grep m/^--?[^-]/, @ARGV;
Expand Down
2 changes: 1 addition & 1 deletion tools/test_summary.pl
Expand Up @@ -145,7 +145,7 @@
if ($rev) {
my $file = scalar(@tfiles);
print join(',', $rev, (map { $sum{$_} } @col), $file), "\n";
print "[rakudo]: spectest-progress.csv update: ",
print "spectest-progress.csv update: ",
"$file files, $sum{'pass'} passing, $sum{'fail'} failing\n";
}

Expand Down

0 comments on commit 50279cf

Please sign in to comment.