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

[perl #32112] [PATCH] Fixes for Befunge interpreter

0 views
Skip to first unread message

Stepan Roh

unread,
Oct 23, 2004, 11:25:11 AM10/23/04
to bugs-bi...@rt.perl.org
# New Ticket Created by Stepan Roh
# Please include the string: [perl #32112]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=32112 >


While playing with Parrot I found a few bugs and problems in Befunge
interpreter. Although it is not important part of Parrot I tried to fix
them. All changes are in attached patch created with cvs diff -u against
CVS HEAD 2004/10/23 and one new file.

Changes:

- Befunge-97 directives (lines starting with =) are ignored
- stdout buffering is disabled
- fixed bug in integer input (instead of read integer, length of it's
string representation was returned)
- fixed bug in integer input (only integers with one digit were
allowed which was fixed by using readline instead of read)
- when outputing integer, output one space as well to conform with specs

I tested all Befunge scripts I have and there is one which does not work
as expected. I attached it as pascserp.bef, it is also mentioned in
README.

Hope I did everything right.

Have a nice day.

Stepan Roh

befunge.patch
pascserp.bef

Jerome Quelin

unread,
Oct 23, 2004, 2:10:28 PM10/23/04
to perl6-i...@perl.org
On 04/10/23 08:25 -0700, Stepan Roh wrote:
> While playing with Parrot I found a few bugs and problems in Befunge
> interpreter. Although it is not important part of Parrot

What? Not important? I was one of the first small languages implemented!
And saying that befunge is not important is like saying cows can't fly...
Erm... Maybe I just mixed up things... Anyway... You get my point! :o)


> - Befunge-97 directives (lines starting with =) are ignored

Uh? I've never seen this in the specs... Do you have a pointer?

In the following url: http://dufflebunk.iwarp.com/JSFunge/spec98.html,
there is no such mention of this behavior.

Anyway, I'm not going to commit this change, since the interpreter
shipped with Parrot is Befunge-93 compliant, and not 97 (nor 98).

==> rejected.


> - stdout buffering is disabled
> - fixed bug in integer input (instead of read integer, length of it's
> string representation was returned)
> - fixed bug in integer input (only integers with one digit were
> allowed which was fixed by using readline instead of read)

Regarding all the i/o stuff, I know it was b0rken, but don't forget I
wrote it in the early parrot days.
I'm glad you've fixed it, but maybe things will change with Parrot i/o?

==> applied.


> - when outputing integer, output one space as well to conform with specs

D'oh! I've missed it?! Thank you.

==> applied.


> I tested all Befunge scripts I have and there is one which does not work
> as expected. I attached it as pascserp.bef, it is also mentioned in
> README.
>
> Hope I did everything right.

Just missed the MANIFEST (pascserp.bef) and the changelog, fixed.

You make me guilty, since I *know* I should go through befunge's TODO list...
Anyway, I think the better would be to restart from scratch in imcc
instead of pasm...


Thank you,
Jerome
--
jqu...@mongueurs.net

Stepan Roh

unread,
Oct 23, 2004, 4:45:04 PM10/23/04
to Jerome Quelin via RT

On Sat, 23 Oct 2004, Jerome Quelin via RT wrote:

>> - Befunge-97 directives (lines starting with =) are ignored
>
> Uh? I've never seen this in the specs... Do you have a pointer?
>
> In the following url: http://dufflebunk.iwarp.com/JSFunge/spec98.html,
> there is no such mention of this behavior.
>
> Anyway, I'm not going to commit this change, since the interpreter
> shipped with Parrot is Befunge-93 compliant, and not 97 (nor 98).
>
> ==> rejected.

It is present in original Befunge-93 Interpreter/Debugger. See changelog:

v2.10: Jul 1997, Chris Pressey
added -q command line option.
added primitive understanding of = directive from b97 spec.
any file with a =l directive but without =l b93 is rejected.
also understands # as a pre-directive line prefix for
Un*x-ish systems.

And I have translation of Befunge-93 spec with appendix D which mentions
directive '='. I translated it myself in 1998, but lost original :-)

> Anyway, I think the better would be to restart from scratch in imcc
> instead of pasm...

Me too.

Leopold Toetsch

unread,
Oct 23, 2004, 6:19:36 PM10/23/04
to Jerome Quelin, perl6-i...@perl.org
Jerome Quelin <jqu...@mongueurs.net> wrote:
> On 04/10/23 08:25 -0700, Stepan Roh wrote:
>> While playing with Parrot I found a few bugs and problems in Befunge
>> interpreter. Although it is not important part of Parrot

> What? Not important?

[ ... ]

> ==> applied.

[ ... ]

Thanks Jerome, for all the fun I had reading your comments, and well,
yes - just applying the patches, and of course to Stepan for awakening
Jerome ;)

leo

0 new messages