mirror of
https://github.com/remko/waforth
synced 2025-01-18 22:26:39 +01:00
Tweak README
This commit is contained in:
parent
b2cd69847b
commit
24ed2a3013
1 changed files with 11 additions and 12 deletions
23
README.md
23
README.md
|
@ -4,12 +4,11 @@ WAForth is a bootstrapping Forth interpreter and dynamic compiler for
|
||||||
[WebAssembly](https://webassembly.org). You can see it in a demo
|
[WebAssembly](https://webassembly.org). You can see it in a demo
|
||||||
[here](https://el-tramo.be/waforth/).
|
[here](https://el-tramo.be/waforth/).
|
||||||
|
|
||||||
It is (almost) entirely written in WebAssembly and Forth, and the compiler
|
It is entirely written in (raw) WebAssembly, and the compiler
|
||||||
generates WebAssembly code on the fly. The only parts for which it relies on
|
generates WebAssembly code on the fly. The only parts for which it relies on
|
||||||
external (JavaScript) code is the dynamic loader (since WebAssembly [doesn't
|
external (JavaScript) code is to dynamically load modules (since WebAssembly [doesn't
|
||||||
support JIT
|
support JIT yet](https://webassembly.org/docs/future-features/#platform-independent-just-in-time-jit-compilation)),
|
||||||
yet](https://webassembly.org/docs/future-features/#platform-independent-just-in-time-jit-compilation)),
|
and the I/O primitives to read and write a character to a screen.
|
||||||
and the I/O primitives to read and write a character.
|
|
||||||
|
|
||||||
Parts of the implementation were influenced by
|
Parts of the implementation were influenced by
|
||||||
[jonesforth](http://git.annexia.org/?p=jonesforth.git;a=summary).
|
[jonesforth](http://git.annexia.org/?p=jonesforth.git;a=summary).
|
||||||
|
@ -22,12 +21,12 @@ core word tests.
|
||||||
|
|
||||||
## Install Dependencies
|
## Install Dependencies
|
||||||
|
|
||||||
The build uses [Racket](https://racket-lang.org) for processing the WebAssembly
|
The build uses the [WebAssembly Binary
|
||||||
code, the [WebAssembly Binary Toolkit](https://github.com/WebAssembly/wabt) for
|
Toolkit](https://github.com/WebAssembly/wabt) for converting raw WebAssembly
|
||||||
converting it in binary format,and [Yarn](https://yarnpkg.com) for managing the
|
text format into the binary format, and [Yarn](https://yarnpkg.com) for
|
||||||
dependencies of the shell.
|
managing the dependencies of the shell.
|
||||||
|
|
||||||
brew install wabt yarn minimal-racket
|
brew install wabt yarn
|
||||||
yarn
|
yarn
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +59,7 @@ format](https://webassembly.github.io/spec/core/text/index.html). The text
|
||||||
format isn't really meant for writing code in, so it has no facilities like a
|
format isn't really meant for writing code in, so it has no facilities like a
|
||||||
real assembler (e.g. constant definitions, macro expansion, ...).
|
real assembler (e.g. constant definitions, macro expansion, ...).
|
||||||
To help with maintenance, the WebAssembly file is piped through a simple string
|
To help with maintenance, the WebAssembly file is piped through a simple string
|
||||||
preprocessor that replaces constants with defined values.
|
preprocessing script that replaces constants with defined values.
|
||||||
|
|
||||||
### The Interpreter
|
### The Interpreter
|
||||||
|
|
||||||
|
@ -88,7 +87,7 @@ the next offset, which in turn is recorded in the word dictionary.
|
||||||
|
|
||||||
Because words reside in different modules, all calls to and from the words need
|
Because words reside in different modules, all calls to and from the words need
|
||||||
to happen as indirect `call_indirect` calls through the shared function table.
|
to happen as indirect `call_indirect` calls through the shared function table.
|
||||||
This of course introduces some overhead, although it seems limited.
|
This of course introduces some overhead, although it appears limited.
|
||||||
|
|
||||||
As WebAssembly doesn't support unstructured jumps, control flow words
|
As WebAssembly doesn't support unstructured jumps, control flow words
|
||||||
(`IF/ELSE/THEN`, `LOOP`, `REPEAT`, ...) can't be implemented in terms of more
|
(`IF/ELSE/THEN`, `LOOP`, `REPEAT`, ...) can't be implemented in terms of more
|
||||||
|
|
Loading…
Reference in a new issue