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

Tiny imcc example doesn't work

6 views
Skip to first unread message

gre...@focusresearch.com

unread,
Dec 4, 2002, 10:03:33 AM12/4/02
to perl6-i...@perl.org
All --

I thought that something like what follows:

goto _foo
end
_foo:
print "Howdy!\n"
end

would be legal imcc input, but I get:

last token = [(null)]
(error) line 1: parse error
Didn't create output asm.

instead of happiness. I'm trying to learn enough IMCC that
I can make the jakoc compiler work with it. I've read the
imcc README and scanned a few examples of output from the
Perl6 compiler, but I think I'm still missing something...


Regards,

-- Gregor

Mr. Nobody

unread,
Dec 4, 2002, 10:15:02 AM12/4/02
to gre...@focusresearch.com, perl6-i...@perl.org

--- gre...@focusresearch.com wrote:
> I thought that something like what follows:
>
> goto _foo
> end
> _foo:
> print "Howdy!\n"
> end
>
> would be legal imcc input

IMCC requires you to put everything in .subs. So it should be something like

..sub main


goto _foo
end
_foo:
print "Howdy!\n"
end

..end

There's nothing special about calling it "main", the pasm entry point is the
first sub.

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

Mr. Nobody

unread,
Dec 4, 2002, 10:17:25 AM12/4/02
to perl6-i...@perl.org
--- "Mr. Nobody" <mrnob...@yahoo.com> wrote:
> ..sub main
> ..end

Except without those extra dots. Stupid mailer.

Leopold Toetsch

unread,
Dec 4, 2002, 10:30:18 AM12/4/02
to gre...@focusresearch.com, perl6-i...@perl.org
gre...@focusresearch.com wrote:

> All --
>
> I thought that something like what follows:
>
> goto _foo
> end
> _foo:
> print "Howdy!\n"
> end


Works fine *if* you insert your example into ".sub" ... ".end":

..sub _test
goto _foo
end
_foo:
print "ok 1\n"
end
..end


> Regards,
>
> -- Gregor


leo


gre...@focusresearch.com

unread,
Dec 4, 2002, 10:41:29 AM12/4/02
to Mr. Nobody, perl6-i...@perl.org
Thanks for the tip.

I think I can use that to work around the limitation. It makes it
unnatural to
have a script with the pattern:

some code
some subroutine definitions
some more code, calling the subroutines.

Which Jako permits.

It looks like I can wrap all the bits of miscellaneous code in little
pseudo-
subs:

.sub __CODE__0
...
goto __CODE__1
.end

.sub some_real_sub
....
.end

.sub __CODE__1
...
call some_real_sub
...
.end

And just ignore the spurrious 'ret' instructions imcc generates to
"properly"
terminate each of the "subroutines" (if imcc ever does dead code removal,
it could actually remove these instructions before they make it to the
..pasm
file).


Regards,

-- Gregor

"Mr. Nobody" <mrnob...@yahoo.com>
12/04/2002 10:15 AM


To: gre...@focusresearch.com
cc: perl6-i...@perl.org
Subject: Re: Tiny imcc example doesn't work

--- gre...@focusresearch.com wrote:
> I thought that something like what follows:
>
> goto _foo
> end
> _foo:
> print "Howdy!\n"
> end
>

> would be legal imcc input

IMCC requires you to put everything in .subs. So it should be something
like

..sub main


goto _foo
end
_foo:
print "Howdy!\n"
end

..end

There's nothing special about calling it "main", the pasm entry point is
the
first sub.

__________________________________________________

Leopold Toetsch

unread,
Dec 4, 2002, 11:07:33 AM12/4/02
to gre...@focusresearch.com, Mr. Nobody, perl6-i...@perl.org
gre...@focusresearch.com wrote:


> And just ignore the spurrious 'ret' instructions imcc generates to
> "properly"
> terminate each of the "subroutines" (


These "ret" ins are remnants from the ret => .end change - they will go
away.

leo


0 new messages