help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BISON To Represent BASIC Grammer


From: Chris Cranford
Subject: Re: BISON To Represent BASIC Grammer
Date: Tue, 13 Apr 2004 21:12:18 -0400

Hans -

I looked around a little more detailed since I knew what to be looking for
and found a great post in a newsgroup where someone has put their yacc/flex
implementation of a subset of BASIC in their post.

I followed this as an example and thus far it seems to be working.  So with
that said, let me make sure I have an understanding of what I should do.

1. Develop a way to pass the BASIC file's source to the yyparse()
   function and detect if the parse is successful or not.

2. Once the syntax pass #1 is successful, then I need to develop a
   way to 'interpret' the code and generate a bytecode instruction
   list of the code and this bytecode should then be stored in a
   file.

The the bytecode file will get used by the Virtual Machine in order to
emulate/run the code ...

Right?

Thanks
Chris

----- Original Message ----- 
From: "Hans Aberg" <address@hidden>
To: "Chris Cranford" <address@hidden>
Cc: <address@hidden>
Sent: Tuesday, April 13, 2004 7:07 PM
Subject: Re: BISON To Represent BASIC Grammer


> At 18:34 -0400 2004/04/13, Chris Cranford wrote:
> >I am trying to write a BASIC-language script bytecode compiler.  Someone
> >recommended that I use BISON in order to properly parse my .BAS and to
> >generate my bytecode file.  Has anyone attempted this in the past or can
> >offer some assistance?
>
> If you do not get any suggestions in this list, I suggest you try the
> newsgroup comp.compilers and its FAQ published there monthly. Also, Bison
> just applies the LALR(1) parsing algorithm, so you might check if there is
> already a open source BASIC compiler around with a .y grammar file. If all
> that fails, the best way is to get hold of a BASIC grammar from some
> standard, and then attempt to adapt it for use with an LALR(1) parser
> generator. And you probably need Flex as well to generate the lexer, see
> GNU links, and:
>   Help-flex mailing list
>   address@hidden
>   http://mail.gnu.org/mailman/listinfo/help-flex
>
>   Hans Aberg
>
>
>
>
> _______________________________________________
> address@hidden http://mail.gnu.org/mailman/listinfo/help-bison
>






reply via email to

[Prev in Thread] Current Thread [Next in Thread]