mirror of
https://gitlab.cs.washington.edu/fidelp/frustration.git
synced 2024-12-25 21:58:11 +01:00
wtf I can't add
This commit is contained in:
parent
af8618675b
commit
8d8c886cf4
1 changed files with 5 additions and 8 deletions
13
README.md
13
README.md
|
@ -165,7 +165,7 @@ struct Stack<const N: usize> {
|
|||
```
|
||||
|
||||
First we'll need a function to add a number to the stack.
|
||||
|
||||
|
||||
When a fixed-size stack fills up, there is a failure case
|
||||
(stack overflow) that must be handled somehow.
|
||||
|
||||
|
@ -437,7 +437,7 @@ Address Data stack Return stack
|
|||
202 [3] [102]
|
||||
204 [3 4] [102] <--- About to return from subroutine...
|
||||
102 [3 4] []
|
||||
104 [5] []
|
||||
104 [7] []
|
||||
```
|
||||
|
||||
The return stack is there to make sure that returning from a subroutine
|
||||
|
@ -1044,9 +1044,9 @@ pointing to the previous dictionary entry.
|
|||
self.dp = here;
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
Now we can start building the dictionary.
|
||||
|
||||
To create our Forth interactive programmming environment, we will start
|
||||
|
@ -2291,9 +2291,7 @@ word from name lookups. We will talk more about this later.
|
|||
// smudge ( -- )
|
||||
d.entry(); d.name(6 | 0x80, *b"smu"); let smudge = d.here;
|
||||
forth!(word_addr, DUP, LD, Literal(0x0040), OR, SWP, ST, RET);
|
||||
```
|
||||
|
||||
```rust
|
||||
// unsmudge ( -- )
|
||||
d.entry(); d.name(8 | 0x80, *b"uns"); let unsmudge = d.here;
|
||||
forth!(word_addr, DUP, LD, Literal(0x0040), INV, AND, SWP, ST, RET);
|
||||
|
@ -2384,9 +2382,7 @@ up to the programmer.
|
|||
/* Compile a number */
|
||||
d.entry(); d.name(3, *b"lit"); let lit = d.here;
|
||||
forth!(DUP, ADD, Literal(1), ADD, comma, RET);
|
||||
```
|
||||
|
||||
```rust
|
||||
// Helper function to compile a number ( n -- n? )
|
||||
let try_compile_lit = d.here;
|
||||
forth!(
|
||||
|
@ -2641,6 +2637,8 @@ Put a call to the outer interpreter at the CPU's
|
|||
}
|
||||
```
|
||||
|
||||
Finally, start the machine.
|
||||
|
||||
```rust
|
||||
fn main() {
|
||||
/* Create the machine */
|
||||
|
@ -2707,4 +2705,3 @@ There is a shell script supplied that will do all of the above for you.
|
|||
Please read
|
||||
[frustration.4th](./frustration.4th)
|
||||
if you want to learn more about how to use Forth.
|
||||
|
||||
|
|
Loading…
Reference in a new issue