mikaelpatel / Arduino-Shell

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

Question: Escape #21

Closed dpharris closed 8 years ago

dpharris commented 8 years ago

Can you explain how you saw '$' working?

I had assumed that $ sucked in the next char and sent that to the trap(char) function. I messed with the code and got that to work. However, ...

It seems like you are trying for a more general mechanism that just traps to a trap(char) function, and then the trap function can do anything (within reason). Is it allowed to play with the stream, i.e. peek and poke it?

mikaelpatel commented 8 years ago

There is no escape/prefix op code. Any op code that is not used by the Shell is passed to the trap function. The function can consume multiple op codes in the given script reference. The vision is multiple "co-processors". The Arduino instructions would move out of the inner interpreter and into a trap handler. This is for the next step when the code get ported back to linux.

dpharris commented 8 years ago

Ok, I am starting to grok this ... nice idea. Perhaps one token should be reserved for an escape, though, so one can always add something, event if all other tokens are used. It also lets one standardize somewhat, since its fixed.

On Sun, Feb 28, 2016 at 5:03 PM, Mikael Patel notifications@github.com wrote:

There is no escape/prefix op code. Any op code that is not used can be used. And the trap function can use multiple op codes. The vision is multiple co-processors. The Arduino instructions would move out of the inner interpreter and into a trap handler. This is for the next step when the code get ported back to linux.

— Reply to this email directly or view it on GitHub https://github.com/mikaelpatel/Arduino-Shell/issues/21#issuecomment-189984738 .