Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Wikipedia example

4 views
Skip to first unread message

Aaron Sherman

unread,
Oct 3, 2006, 4:41:03 PM10/3/06
to parrot-...@perl.org
I'm finally getting around to sending this patch as requested on IRC...
dang commit bits are rare around here ;)

This contains the Makefile, README, .pg grammar, a -harness.pir that
executes the parser on a sample string and dumps the parse tree and a
-stress.pir that runs 50,000 trial runs to see how fast PGE is (not too
shabby is the answer, as it comes in at about 1/2 the time of a P::RD
version for the simple example, and gets a bigger lead the more complex
the input expression).

What I didn't understand was why -j didn't run any faster than -b in my
trials... that seemed odd.

wikipedia-examples-2.diff

Markus Triska

unread,
Oct 3, 2006, 5:31:52 PM10/3/06
to Aaron Sherman, parrot-...@perl.org
Aaron Sherman writes:

> +Written in 2006 by Aaron Sherman, and distrbuted

Typo: distributed


Aaron Sherman

unread,
Oct 4, 2006, 10:03:35 AM10/4/06
to Markus Triska, parrot-...@perl.org

You are correct, sir.

This was not, in fact some strange attempt to seize control of the
Parrot codebase ;)

Chromatic

unread,
Oct 6, 2006, 10:46:34 PM10/6/06
to parrot-...@perl.org, Aaron Sherman
On Tuesday 03 October 2006 13:41, Aaron Sherman wrote:

> This contains the Makefile, README, .pg grammar, a -harness.pir that
> executes the parser on a sample string and dumps the parse tree and a
> -stress.pir that runs 50,000 trial runs to see how fast PGE is (not too
> shabby is the answer, as it comes in at about 1/2 the time of a P::RD
> version for the simple example, and gets a bigger lead the more complex
> the input expression).

I can't get this to work. If I run 'make' in the target directory, I get a
PASM file (with the .pir) extension. Then if I run either of the PIR files,
I get:

$ parrot wptest-harness.pir
error:imcc:syntax error, unexpected LABEL, expecting $end
in file 'wptest.pir' line 3
Parsing simple expression: 1+(1+1)
Null PMC access in get_bool()
current instr.: 'main' pc 24 (wptest-harness.pir:21)

-- c

Aaron Sherman

unread,
Oct 12, 2006, 10:05:42 AM10/12/06
to chromatic, parrot-...@perl.org
Hey there, sorry about not responding. My mailer hid this message from
me. I was actually about to reply asking what the deal was. ;)

chromatic wrote:
> On Tuesday 03 October 2006 13:41, Aaron Sherman wrote:
>
>> This contains the Makefile, README, .pg grammar, a -harness.pir that
>> executes the parser on a sample string and dumps the parse tree and a
>> -stress.pir that runs 50,000 trial runs to see how fast PGE is (not too
>> shabby is the answer, as it comes in at about 1/2 the time of a P::RD
>> version for the simple example, and gets a bigger lead the more complex
>> the input expression).
>
> I can't get this to work. If I run 'make' in the target directory, I get a
> PASM file (with the .pir) extension. Then if I run either of the PIR files,
> I get:
>
> $ parrot wptest-harness.pir
> error:imcc:syntax error, unexpected LABEL, expecting $end
> in file 'wptest.pir' line 3

That's odd. I double-checked the diffs to make sure I didn't send out an
old version. This code works fine on my box, which I just updated to
r14904. For me, line 3 of wptest.pir is "main:". Should that be a syntax
error?

That's the very first line of code output by:

../../../parrot -o wptest.pir ../../../compilers/pge/pgc.pir wptest.pg

so if there's a problem with it, I'm not sure that I could actually fix
it. Any pointers appreciated!

Here's what I get:

$ ../../../parrot wptest-harness.pir
Parsing simple expression: 1+(1+1)
Match results begin:
"VAR1" => PMC 'PGE::Match' => "1+(1+1)" @ 0 {
<expr> => PMC 'PGE::Match' => "+" @ 1 {
<type> => "infix:+"
[0] => PMC 'PGE::Match' => "1" @ 0 {
<number> => PMC 'PGE::Match' => "1" @ 0
<type> => "term:"
}
[1] => PMC 'PGE::Match' => "(1+1)" @ 2 {
<expr> => PMC 'PGE::Match' => "1+1" @ 3 {
<expr> => PMC 'PGE::Match' => "+" @ 4 {
<type> => "infix:+"
[0] => PMC 'PGE::Match' => "1" @ 3 {
<number> => PMC 'PGE::Match' => "1" @ 3
<type> => "term:"
}
[1] => PMC 'PGE::Match' => "1" @ 5 {
<number> => PMC 'PGE::Match' => "1" @ 5
<type> => "term:"
}
}
}
<type> => "term:"
}
}
}
match complete

0 new messages