Urban M
jazzed
Posts: 11,803
Thought I would spend some time making the BF language work on Propeller. Here's the result so far.
BF is a programmer's toy; it is an incredibly obscure "write only language" (this means "once you write it, you may as well forget about reading and understanding it after just a few hours" [noparse]:)[/noparse] The BF interpreter is implemented in less than 120 PASM instructions (I've not tried to optimize it).
The interpreter works with lots of code but there are challenges that I haven't debugged yet ... this is a work in progress ... and may forever be a WIP depending on how I feel [noparse]:)[/noparse]. UPDATE: Found that primes.bf is looking for 10 as ENTER ... changed to 13 and now works with PST (warm fuzzy feeling).
Various trivial demo program strings such as "Hello World!" are included. The "99 Bottles" demo is default.
The PASM interpreter has an interface to serial input/output provided by the demo code; the interface should be easily changed to a keyboard/TV with a little work. The _XINFREQ is set to 6MHz (PLL16), so watch out.
Cheers.
--Steve
Post Edited (jazzed) : 10/30/2009 1:45:18 AM GMT
BF is a programmer's toy; it is an incredibly obscure "write only language" (this means "once you write it, you may as well forget about reading and understanding it after just a few hours" [noparse]:)[/noparse] The BF interpreter is implemented in less than 120 PASM instructions (I've not tried to optimize it).
The interpreter works with lots of code but there are challenges that I haven't debugged yet ... this is a work in progress ... and may forever be a WIP depending on how I feel [noparse]:)[/noparse]. UPDATE: Found that primes.bf is looking for 10 as ENTER ... changed to 13 and now works with PST (warm fuzzy feeling).
Various trivial demo program strings such as "Hello World!" are included. The "99 Bottles" demo is default.
The PASM interpreter has an interface to serial input/output provided by the demo code; the interface should be easily changed to a keyboard/TV with a little work. The _XINFREQ is set to 6MHz (PLL16), so watch out.
Cheers.
--Steve
Post Edited (jazzed) : 10/30/2009 1:45:18 AM GMT
zip
12K
Comments
That must be about the smallest interpreter around.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
-Phil
The BF page on Wikipedia is pretty interesting. Just google "brainf***" with the stars or otherwise.
There is a small repository of code on the net. For some reason I can't get primes.bf to work.
There is a BF compiler written in BF [noparse]:)[/noparse] No idea what that does at this point.
Playing with BF certainly makes one appreciate other languages. Not even an "=" sign ... jeez.
Seems like the patterns that end up being used in the source are more like spells than anything.
Post Edited (jazzed) : 10/30/2009 1:55:53 AM GMT
--Steve
Post Edited (jazzed) : 10/30/2009 1:40:11 AM GMT
: Five_stars 5 0 do 2a emit loop 0d emit ;
cheers
Steve, we all were worried about your Brain *before* you did this ...
please pull your self back from the brink and go code some sensible PASM stuff, OK?
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Long answer.
The hub version of the Dictionary stuff, add_word, find_word, TIB parser, etc are ok now. Some core primatives have been done. Now I am moving the dictionary out of HUB into Xmem. I need to find out how fast I can access a dictionary word from the Xmem. I am only concerned about reads. I want minimal Forth to run in a single cog, leaving most of the Hub free. Forth, hopefully can run along other spin cogs. I have yet to see if I have set the bar too high, but the journey is fascinating.
Ron