request for a few Pugs parser updates

0 views
Skip to first unread message

Darren Duncan

unread,
Apr 8, 2007, 5:44:35 AM4/8/07
to perl6-c...@perl.org
Hello,

This note is a request for help from anyone that is saavy with the
Pugs internals such that they can add a few small features, to the
parser mainly, without too much difficulty.

While trying to port a significant codebase (ext/QDRDBMS/) to Perl 6
from Perl 5, I discovered that a few of the simpler Perl 6 language
features that I employed were not actually implemented yet in Pugs.

While the missing features were few enough that I could just
comment-out about a hundred code lines and write alternate versions
in their place in order to get QDRDBMS-as-it-is to compile, I believe
it would be a great help to my further development of the project if
the language features were implemented as soon as possible, so I can
avoid the associated complexity caused by their absense.

1. The number one most useful improvement would be implementing the
language feature of long-hand named parameters in routine signatures
as per Synopsis 6, eg so one could say ":foo($bar)" where a caller
passes a parameter using "foo" and the routine itself uses it in the
variable "$bar". I use those in submethod BUILD (and hence, 'new'),
methods, and subs, currently.

2. The next most useful improvement would be if inline hierarchical
type definitions as per Synopsis 2, such as "Foo of Bar of Baz" could
be made to parse successfully, even if the details (all but the
"Foo") are ignored at runtime. I use those in parameter defs,
attribute defs, and other variables.

3. I've only used this once so far, but polymorphic type definitions,
eg Int|Str do not parse in attribute definitions, though they do
parse in parameter definitions; if this could be at least made to
parse (even if we get an Any behind the scenes for now), that would
be great.

I am hoping that making the above work wouldn't be too difficult for
the right people. In particular, I don't think any of the above
would have prerequisites.

You can see examples of the first 2 attempted uses in
ext/QDRDBMS/lib/QDRDBMS.pm of the Pugs repository, and the last one
in ext/QDRDBMS/lib/QDRDBMS/AST.pm. The goal is to make the
commented-out code like I mentioned compile.

Note that some other things are commented out also, but those are a
non-issue for the short term and can be ignored.

On a side note, I've observed that uncommenting the values of the
Hash declaration at the top of AST.pm causes Pugs to infinite-loop at
runtime. While I will revisit this to try and debug it, I may
possibly need help there later.

Thank you in advance.

-- Darren Duncan

Reply all
Reply to author
Forward
0 new messages