Is there a good Basic interpreter?

Hello,

I'm looking for a Basic interpreter which can run on the Arduino. I've seen many such as TinyBasic, but the problem I always had is that they are not very generic. They can be easily compiled to the Arduino, but I was rather looking for a 'library' where you could you know... Pass the code as string and the library executes it? I don't necessarily need the shell that many interpreters provide. I can do this myself. But in order to be able to implement other things, some structured code is needed.

I hope you know what I mean. Does anyone know a good interpreter language (not necessarily Basic), which can be easily included?

Thanks.

I've got to ask - Why?

Is there a good Basic interpreter?

No.

I've got to ask - Why?

I want to build a computer like the C64 including screen and keyboard. I want it to be completely programmable. Therefore I need a scripting language.

What's good is highly subjective.

They can be easily compiled to the Arduino, but I was rather looking for a 'library' where you could you know..

How hard would it be for you to stripe out the "shell"?

I guess it shouldn't be so hard. But as these sources evolve, I would have to change the code over and over again in order to make the new version fit.

Bitlash might be a good fit for your application: http://bitlash.net

Bitlash is an iterpreter for a tiny language that runs entirely on the Arduino. It's easy to integrate into your Arduino application, and to extend the interpreter with functions you write in C and in the Bitlash language.

-br

I've seen bitlash before and to be honest, I don't like it. It has a weird syntax and only allows variables 27 from a-z.

De gustibus non disputandum est.

Good luck with your project. :slight_smile:

-br

I've seen bitlash before and to be honest, I don't like it. It has a weird syntax and only allows variables 27 from a-z.

You know, a reality check would be a good thing. Which Arduino are you using? Look at how much SRAM it has. The "code" to be interpreted has to fit in that space. Along with the interpreters variables.

Currently, I'm using the Mega 2560. But I already ordered a Due.

But as these sources evolve,

Life isn't supposed to be perfect.

DevilsChild:
I've seen bitlash before and to be honest, I don't like it. It has a weird syntax and only allows variables 27 from a-z.

27 variables from a-z. Clever !

Got another idea: What about an assembly compiler on the Arduino? Pass ASM code as string and get binary code as return and then execute it by setting the instruction pointer? Is that somehow possible or does it sound ridiculous?

Is that somehow possible or does it sound ridiculous?

Yes on both counts.

Okay... But how can I execute a set of instructions, and how can I compile assembly code into binary code?

how can I compile assembly code into binary code?

The gcc compiler is really good at that.

That still leaves the question on how to execute a set of binary code on the Arduino. I think you need to add the instruction pointer on the stack, then excecute the binary code and at the end of that code pop esi and jump to it, right? Though I haven't found any examples yet...
Also, is it possible to compile asm on the Arduino?

Hmmm

"...lightweight interpreter..." , "... sources evolving...", "... life perfecting ..."

Of course!

....+++---> brainf*ck

Oh. And this guy has already written the interpreter for atmega:

Cheers,
John

That still leaves the question on how to execute a set of binary code on the Arduino.

The bootloader allows you to do that.