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

Reply via email to