Adventures in interpreters
Spork Frog
Posts: 212
Making an interpreter has always been one of those things I've wanted to do. I've always wanted to try and do a full QBasic 1.0 on the Prop, as far out and hard as that might be. I realized that I need a starting place, however.
Then I came across brainf*ck. It's simple enough, only 8 tokens, all whitespace ignored, no variables, no nothing. It's used a lot in obfuscated coding challenges.
After a couple hours of work and a lot of stupid mistakes, I have a mostly working interpreter (I believe it's correctly interpreting all 7 of the symbols I've implemented), with the "," operator not yet implemented. It's supposed to have a 30,000 byte stack, but there's not going to be enough room to do that. I'll take as much as I can.
Still have a few bugs to chase down yet, but I figure some people might enjoy playing with it as is.
VERSION 0.5
Current open bugs:
-Uses 13 as newline instead of 10 like most implementations.
Unimplemented features:
-Stack overrun detector
I'm as always very open to feature requests and bug reports.
Post Edited (Spork Frog) : 7/29/2008 2:45:17 PM GMT
Then I came across brainf*ck. It's simple enough, only 8 tokens, all whitespace ignored, no variables, no nothing. It's used a lot in obfuscated coding challenges.
After a couple hours of work and a lot of stupid mistakes, I have a mostly working interpreter (I believe it's correctly interpreting all 7 of the symbols I've implemented), with the "," operator not yet implemented. It's supposed to have a 30,000 byte stack, but there's not going to be enough room to do that. I'll take as much as I can.
Still have a few bugs to chase down yet, but I figure some people might enjoy playing with it as is.
VERSION 0.5
Current open bugs:
-Uses 13 as newline instead of 10 like most implementations.
Unimplemented features:
-Stack overrun detector
I'm as always very open to feature requests and bug reports.
Post Edited (Spork Frog) : 7/29/2008 2:45:17 PM GMT
Comments
Found out that most brainf*ck implementations use 10 as newline instead of 13 like most everything on the Prop does, have to fix that yet. Also need to add a stack overflow detector.
Added the "," symbol and fixed the other open bug, changed the stack to an array.
13 ($0D) is <LF> which means go to the next line, but may not necessarily return to the beginning of the line (depending on implementation).
Usually therefore <cr> + <lf> is issued. Usually <lf> will surfice, like on Hyerterminal and PST.
ps Please change the name.
10 ($0A) is LF
13 ($0D) is CR
What's "newline" ? Whatever you want it to be
Spork Frog: Don't forget that Windows and Unix(Linux etc) have different ideas about what is a newline.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
" (expletive)" is bad Anglo Saxon swearing.
I agree with Cluso99.
swearing and foul words have no place here or in software.
I always hated the FCUK brand in the UK.
if I named a language Bin Ladin would you also be so neutral ?
Mike
this parallax board has just removed "ffuucckk" as an " (expletive), but seems to allows "brain(expletive)"
It's always interesting to come across the decisions of censors of films, books etc from fifty or so years ago. They banned things that no one would bat an eye at nowadays.
As for the language interpreter we cannot mention, it may be aptly named. Perhaps trying to write any useful program in it does something bad to you brain [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
I was once taken by surprise with an episode of the Married with Children TV sit-com and the classic line, "My mother always told me never to marry a Wanker". I didn't know at the time that Wanker was a reasonably common surname in the US. It means something quite different in the UK.
I'd not take offence at a programming language called "bin Ladin", but would recommend a TLA ( three letter acronym ) as being more traditional in computing circles which conveniently gives OBL or UBL depending on one's transliteration of Arabic. Which rather proves how arbitrary offence is; some might be offended at one but not the other.
Five down, five across. Some people will wet themselves, others won't understand ...
www.electraisd.net/alumni/display_class.aspx?y=1993
I could say the same for the horrible word "Cxxt".
I really really think that you are wrong. If your daughter came home and said to you " you are a "xxxx", would you smile and
say "Foul words are whatever we choose them to be. They have no special attributes other than some people don't like them, others use them as part of their everyday conversation. I'm personally of the opinion use them frequently and they become just words like every other."
I seem to get involved in these off topic discussions. maybe its becuse I was raised by Victorian grandparents.
Mike
ROFL, that's got to be someone taking the mickey, surely
Nice one hippy!
As for the whole expletive thing they are just words, some people choose more appropriate ones than others but I don't worry about it
I'm sure it wasn't meant in an abusive context.
Regards,
Coley
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
PropGFX Forums - The home of the Hybrid Development System and PropGFX Lite
While we are on this off-topic topic: For those of you in the UK what is the status of the word "drat"? Here in the
USA it is no worse than "phooey" but I know in the UK it used to be a very offensive swear word. However I've heard that this has changed lately.
Post Edited (Beanie2k) : 7/29/2008 10:00:26 PM GMT
and the only 'phooey' I remember was a mild mannered janitor called Henry......
LOL
Regards,
Coley
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
PropGFX Forums - The home of the Hybrid Development System and PropGFX Lite
My comment was based on the fact that Spork Frog said there was an open bug using 13 instead of 10. It is more common to use 13 ($0D). Sometimes $0A is required first. Nothing about changing the spec - that's the way it's been for 30+ years. In the 60's $0A was just a line feed (no carriage return) and $0D was just a carriage return. The terminals required time to implement both these operations (with cams etc).
Having two different characters for this stems from early teletype machines, wherein a CR (or its Baudot equivalent) returned the carriage to the home position, and a LF (or its Baudot equivalent) rolled the paper up. In TTY links that were unreliable, some machines could be configured to advance the paper automatically when a CR was received and/or return the carriage when a LF was received. This helped to eliminate accidental overprinting or running off the right edge of the page. (Microsoft, in clinging to the old TTY standard, apparently thought their systems unreliable enough to require two line-end characters — just in case. 'Kinda like wearing a belt and suspenders! )
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Still some PropSTICK Kit bare PCBs left!