Is there an OpenSource BASIC interpreter in Ruby / Python?

I want something simple to experiment / hack. I have created many interpreters / compilers for c and I just want something simple. Basic BASIC: D

If you don't know (I did my google search ...) yacc / bison is the only way?

thank

+1


source to share


6 answers


None of those listed in TheFreeCountry are acceptable? None of these are in Python, but I should think that starting with XBLite might be more useful than starting with Yacc / Bison / PLY .

Also, Vb2py may be a better starting position than PLY.



If you must go the PLY route, however, consider the MOLE Basic grammar as a starting point instead of trying to tip your own scratch.

+3


source


PLY is a great library for building a parser for Python. It has a simple BASIC interpreter as one of its example scripts. You can start there.



+4


source


I also don't know a basic interpreter under ruby, but with enough time and interest, ruby ​​easily "supports" writing an interpreter for any language you like: Developing an Agile DSL in Ruby . I have to admit that this approach comes with some investment of time. :( There are some links at the end of the presentation for further reading about DSL.

+1


source


You can also look into the Parrot virtual machine which, according to wikipedia today, has some BASIC support.

+1


source


miniBasic in ruby ​​is available here . Rockit seems WAY more fun than racc.

0


source


There is pybasic (basic python), rockit-minibasic (rubybasic).

To make them able to use the gui, it is necessary to develop extensions with the kiwi and shine gui tools for pybasic and rockit-minibasic respectively and similarly to the prima gui for perlbasic if ever exists.

-1


source







All Articles