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

IMCC minor issues

7 views
Skip to first unread message

David Robins

unread,
Dec 2, 2002, 2:43:02 PM12/2/02
to perl6-i...@perl.org
These all using the 2002-12-02_160000 snapshot.

1. Can't ret early from .subs - looks like the parser sees a ret and figures
that's the end of the sub.

..sub foo
$P0 = 1
if $P0 goto bar
ret
bar:
print "BAR"
ret

Parse error at 'bar'.

2. Most things can only be done in a sub.

$P0 = 1

Parse error at '$P0'.

3. It would be nice to have freer naming so that it would be possible to
generate names not valid in the underlying language (the docs indicate
that an IDENTIFIER may be a quoted string, imcc.l doesn't agree).
e.g. allow '$' in identifiers. Not a huge deal, right now I'm
preprending '_' to names of Ruby locals.

4. ret can't immediately follow a label. Looks to perhaps be a symptom
of a larger problem. Works fine if a line is inserted between the ret
and the label (blank, or with a comment, either works).

..sub foo
label:
ret

Parse error at 'ret'.

Resolutions (looking into things sure beats banging one's head against a a
wall):

1. Relies on the definition of a sub being ".sub" ... "ret", so the IMCC
maintainer is going to have to decide if returning early is kosher or not
and how the grammer is to be changed if so (perhaps ".sub" .. ".end" and
.end => ret, instead, and add ret to the list of legal instructions?)

2. Seems to be by design, alrighty, I see it, and if I really want pasm I
know where .emit is.

3. Small matter of changing the definition of IDENTIFIER in imcc.l, if it's
wanted. I'm happy enough with my workaround.

4. Same origin as 1.

Not that I'm trying to slough off fixing these myself and submitting a
patch, but I don't want to step on any toes, and the author is the best
person to declare what's right and implement it.

Dave
Isa. 40:31

Leopold Toetsch

unread,
Dec 3, 2002, 3:17:44 AM12/3/02
to David Robins, perl6-i...@perl.org
David Robins wrote:

> These all using the 2002-12-02_160000 snapshot.
>
> 1. Can't ret early from .subs - looks like the parser sees a ret and figures
> that's the end of the sub.


Yes. Imcc parses and produces code per subroutine, which are delimited
by ".sub" and "ret". A proposal was, to change the latter to ".bus" ;-)


> 2. Most things can only be done in a sub.


Yes


> 3. It would be nice to have freer naming


Name mangling can take care of this, but the lexer could be improved of
course.


> 4. ret can't immediately follow a label.


This is related to 1).


> Resolutions


> 1. ... (perhaps ".sub" .. ".end"


Yep


> Not that I'm trying to slough off fixing these myself and submitting a
> patch, but I don't want to step on any toes, and the author is the best
> person to declare what's right and implement it.


We (Melvin Smith, Sean O'Rourke, Angel Faus, me) had already a bunch of
discussion on these issues + some more: e.g. imcc reserved words (like
"if") clash with pasm reserved words, so that you can't really mix the
two languages.

One proposal was, to change *all* imcc directives to have a dot in
front. There are 2 problems with this: perl6 (P6C) would need a lot of
rework (of course doable) and Melvin (the original author) was really
not fond of such changes.

Recent work from Jürgen Bömmels ("Use imcc instead of assemble.pl")
clearly shows, that imcc could be the future parrot assembler, where the
assembler part is only a small subset of imcc features. Register
allocation, optimization and running code are the major goodies.

But I will not make any decisions here (beyond the .sub .. .end thingy,
which can be done w/o much damage).


> Dave


leo

0 new messages