-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,8 +32,6 @@ require ./compiler/cross.fs | |
: [host] forth ; immediate | ||
: [target] gbforth-user ; immediate | ||
|
||
: [if] if else [char] ] parse drop drop then ; immediate | ||
|
||
\ | ||
\ Expose words into the GBFORTH-USER vocabulary. Available within | ||
\ [TARGET] in interpreting mode. | ||
|
@@ -44,16 +42,17 @@ also gbforth | |
' [host] alias [host] immediate | ||
' [target] alias [target] immediate | ||
|
||
' [if] alias [if] immediate | ||
' [then] alias [then] immediate | ||
|
||
export ( immediate \ ) | ||
export \ immediate | ||
export ==> | ||
export include | ||
export require | ||
export [asm] | ||
export [endasm] | ||
export [if] | ||
export [else] | ||
export [then] | ||
export [endif] | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
tkers
Author
Member
|
||
|
||
export main: | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
true [if] | ||
: foo 1 ; \ foo | ||
[then] | ||
|
||
false [if] | ||
: foo 2 ; | ||
[endif] | ||
|
||
true [if] | ||
: bar 3 ; \ bar | ||
[else] | ||
: bar 4 ; | ||
[then] | ||
|
||
false [if] | ||
: baz 5 ; | ||
[else] | ||
: baz 6 ; \ baz | ||
[endif] | ||
|
||
true [if] | ||
false [if] | ||
: main baz bar foo ; | ||
[else] | ||
true [if] : main foo bar baz ; [then] \ main | ||
false [if] : main bar foo baz ; [then] | ||
[endif] | ||
[endif] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const gb = require('../gbtest')(__filename) | ||
|
||
test('bracket-if', () => { | ||
gb.run() | ||
expect(gb.stack).toEqual([1, 3, 6]) | ||
}) |
So these were already implemented right? Nice!