问题
I'm looking for a fast interpreted language for a microcontroller.
The requirements are:
- should be fast (not crucial but would be nice)
- should be light on data memory (small overhead <8KB, excludes program variable space)
- preferably would be small in program size and the language would be compact
- preferably, human readable (for example, BASIC)
Thanks!
回答1:
Some AVR interpreters:
- http://www.cqham.ru/tbcgroup/index_eng.htm
- http://www.jcwolfram.de/projekte/avr/chipbasic2/main.php
- http://www.jcwolfram.de/projekte/avr/chipbasic8/main.php
- http://www.jcwolfram.de/projekte/avr/main.php
- http://code.google.com/p/python-on-a-chip/
- http://www.avrfreaks.net/index.php?module=Freaks%20Academy&func=viewItem&item_id=688&item_type=project
- http://www.avrfreaks.net/index.php?module=Freaks%20Academy&func=viewItem&item_id=626&item_type=project
- http://www.avrfreaks.net/index.php?module=Freaks%20Academy&func=viewItem&item_id=460&item_type=project
回答2:
This is a bit generic: there are many kinds of Microcontrollers, and thanks to technologies like Jazelle, it is possible to run hardware-accelerated Java on Microcontrollers. (if... your microcontroller supports it)
For a generic answer: Forth is commonly referenced. But really, you need to be far more specific with your question.
回答3:
Micro-controllers come in a vast variety of architectures. There are small 8-bit families, 32-bit families with simple architectures and 32-bit families with MMU support, suitable for running a modern OS. If you don't state which family you are targeted at, it is impossible to answer your question.
Anyway, for 8-bit families the best you can get is a BASIC variant. See Bascom for example. Note that this would be a compiler version of the "interpreted" language. If you actually want to have a runtime or an interpreter that will execute your code, then you most probably need to install an operation system in your microcontroller.
回答4:
There were a variety of interpreted languages for small micros back in the late 1970's and 1980's. They seem to have mostly fallen out of fashion. I'd like to have a p-code based C compiler for the PIC18 that could coexist nicely with my other C compiler; for much of my code I'd be willing to accept a 100-fold slowdown for a 50% space reduction (so long as I could keep the important stuff in native code). I would think that would be achievable, but I'm not about to implement such a thing from scratch myself.
来源:https://stackoverflow.com/questions/4106320/fast-interpreted-language-for-memory-constrained-microcontroller