mikaelpatel / Arduino-Shell

RPN Postscript/Forth Command Shell for Arduino
19 stars 5 forks source link

Question: Umbilical Arduino-Shell #48

Closed andrewtholt closed 8 years ago

andrewtholt commented 8 years ago

Hi,

I had a couple of ideas and was wondering if you guys have either already considered them or already done them.

1) Umbilical: On a host machine a use enters scripts interactively. These are 'compiled' and the results passed to the Arduino relieving it of compilation duties, but still providing an interactive environment.

2) Compiler. Take a script and produce the corresponding .ino file for compiling onto the Arduino.

I suspect that 2) would be fairly simple.

Comment welcome :)

Andrew

mikaelpatel commented 8 years ago

@andrewtholt

Actually there is no compiler. The script, sequence of tokens/characters, is the code. This is actually the idea behind the implementation of this token threaded interpreter. The issue becomes how to handle literals (characters, number and strings), code blocks and control flow.

It is possible to write a very simple compiler that takes the full function names and translates to tokens. This is on the to-do-list :). It could run on a host which passes the compiled block to the target (Arduino) but it could also run on the Arduino as the Shell may be configured with full function name trace, i.e. input line(s) with full function names is translated to a script line.

One interpretation of your second question is to translate a script to C/C++ with the Shell stack operations.