Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you do multi-line input with the shell? #30

Open
kasbah opened this issue May 10, 2016 · 4 comments
Open

How do you do multi-line input with the shell? #30

kasbah opened this issue May 10, 2016 · 4 comments

Comments

@kasbah
Copy link

kasbah commented May 10, 2016

Hey, first time using any sort of Forth so this might be a stupid question. I arrived here by trying to control the LEDs on my new ICE40 dev kit with the least effort possible. I managed to do that. Thanks so much for paving the way!

I am a bit stuck now though as I haven't been able to figure out how to program in the multi-line words mentioned in the reference manual and your video, I tried Shift-Enter an Alt-Enter and Ctrl-V and ; but none of those seem to work.

@jamesbowman
Copy link
Owner

Enter is the continuation character -- here I'm entering the 'blink' program.

image

Swapforth should do something to show that you're in compilation state, so the interaction looks like:

> : blink
    32 0 do
      i leds
      100 ms
    loop
    ;
ok
> blink

@larsbrinkhoff
Copy link

I suggest something like

: ok   state @ 0= if ."  ok" cr then ;

@kasbah
Copy link
Author

kasbah commented May 10, 2016

Ah, got it running. The interaction looks like the image you linked. What do you mean by it "should do something to show you're in compilation state"? Is there something wrong with the way I have run things? If not, would it be worth mentioning somewhere in the docs, for newbies like me, that you just hit enter and that the "ok" response is expected? The interaction in the video looks different with a "+" character at the start of new lines.

@larsbrinkhoff I copy pasted your code into the interpreter and it doesn't seem to have any effect.

@jamesbowman
Copy link
Owner

@kasbah I mean "I should fix this so it is less confusing" ... the code that @larsbrinkhoff posted is intended to go into the Forth interpreter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants