Commit graph

354 commits

Author SHA1 Message Date
Remko Tronçon
f4484be2ef thurtle: Style tweaks 2022-05-21 11:03:40 +02:00
Remko Tronçon
cce720ea73 thurtle: Clean up stack in examples 2022-05-21 10:53:45 +02:00
Remko Tronçon
b701efd803 thurtle: Share & Export 2022-05-20 20:30:56 +02:00
Remko Tronçon
69bb024a5f thurtle: Change default program 2022-05-20 08:37:10 +02:00
Remko Tronçon
bc6d68c447 thurtle: Batch draw 2022-05-20 08:34:06 +02:00
Remko Tronçon
108de077c9 thurtle: Tweak plant 2022-05-19 23:27:33 +02:00
Remko Tronçon
322dff1997 thurtle: Add fractals 2022-05-19 21:34:49 +02:00
Remko Tronçon
d6f2418248 thurtle: Add Load/Save 2022-05-18 21:10:26 +02:00
Remko Tronçon
84a06ac1ba thurtle: Add syntax highlighting 2022-05-18 21:08:11 +02:00
Remko Tronçon
9ec19dbc15 thurtle: Add SETXY & SETROTATION 2022-05-18 21:04:38 +02:00
Remko Tronçon
47b83fc610 thurtle: Tweak examples 2022-05-15 21:57:53 +02:00
Remko Tronçon
629707587a Make dictionary entries consistent 2022-05-15 21:01:03 +02:00
Remko Tronçon
f11728bec8 Make dictionary entries consistent 2022-05-15 19:48:00 +02:00
Remko Tronçon
e6f0fe0841 Make dictionary entries consistent 2022-05-15 17:07:44 +02:00
Remko Tronçon
77fb0be735 Remove redundant string 2022-05-15 16:40:01 +02:00
Remko Tronçon
168c9784d2 Put word parse region on a fixed offset after HERE 2022-05-15 12:52:44 +02:00
Remko Tronçon
eedf29d63c Put pictured output region on a fixed offset after HERE 2022-05-15 09:28:23 +02:00
Remko Tronçon
0ccc44a741 thurtle: Add GitHub link 2022-05-15 09:25:53 +02:00
Remko Tronçon
c4c83cd872 thurtle: Tweak examples 2022-05-15 08:00:57 +02:00
Remko Tronçon
65c375b0d9 thurtle: Better flower 2022-05-14 21:46:25 +02:00
Remko Tronçon
6402001a8d thurtle: Move about text to header 2022-05-14 21:37:14 +02:00
Remko Tronçon
2f99a79459 thurtle: Add 2 spiral examples 2022-05-14 21:23:31 +02:00
Remko Tronçon
90ccc78ead Fix NIP & TUCK 2022-05-14 21:23:31 +02:00
Remko Tronçon
0a7b49d29d examples: Fix stack comment 2022-05-14 20:05:01 +02:00
Remko Tronçon
18fcdc6b58 READM: Documentation update 2022-05-14 08:56:27 +02:00
Remko Tronçon
5773010948 web: Call async callbacks with WAForth object 2022-05-14 08:51:25 +02:00
Remko Tronçon
3c40468de6 web: Add bindAsync 2022-05-14 08:31:08 +02:00
Remko Tronçon
eab641d0d1 examples: Update fetch example 2022-05-14 08:01:54 +02:00
Remko Tronçon
5cbbd733ff web: Add pushString() 2022-05-14 07:40:48 +02:00
Remko Tronçon
3d3092a24e examples: Add fetch example 2022-05-13 22:02:28 +02:00
Remko Tronçon
164d7bee0f web: Expose push/pop on main object 2022-05-13 21:46:55 +02:00
Remko Tronçon
79ab8c8e7f thurtle: Use JSX 2022-05-12 21:10:04 +02:00
Rick Carlino
9e30411d1b Add documentation comment to WAForth#read. 2022-05-12 07:27:46 +02:00
Remko Tronçon
8f37f588c1 thurtle: Fix link 2022-05-10 22:47:10 +02:00
Remko Tronçon
21eb8d7073 build: Set HTML titles in index 2022-05-10 22:45:17 +02:00
Remko Tronçon
b1546ad4a3 Thurtle 2022-05-10 22:41:43 +02:00
Remko Tronçon
01fcb9e2a8 build: Resolve waforth import from examples 2022-05-08 15:32:20 +02:00
Remko Tronçon
75c6490dc5 EXECUTE: Do a character load instead of full load 2022-05-08 14:33:20 +02:00
Remko Tronçon
893d093968 Replace BASE,STATE,>IN with Forth variables 2022-05-08 14:31:43 +02:00
Remko Tronçon
945cc3bede compiler: Fix compilation of BEGIN+WHILE+WHILE+ELSE combinations 2022-05-07 17:32:00 +02:00
Remko Tronçon
860618af3e compiler: Use TOS to store branch nesting 2022-05-07 16:48:56 +02:00
Remko Tronçon
721d4912b3 compiler: Fix branch nesting of begin 2022-05-07 12:21:41 +02:00
Remko Tronçon
a11c7a10ea Make onEmit log to console by default 2022-05-06 21:47:00 +02:00
Remko Tronçon
f252014644 Documentation 2022-05-05 21:32:00 +02:00
Remko Tronçon
d7b80a49f0 Documentation 2022-05-05 21:15:35 +02:00
Remko Tronçon
f1160105cd Simplify onEmit API 2022-05-05 20:52:18 +02:00
Remko Tronçon
c583565528 build: Fix lint error 2022-05-05 20:45:58 +02:00
Remko Tronçon
a6d71029dc Support calling JS from Forth
Initial attempt at an API.

Resolves: #13
2022-05-05 20:19:39 +02:00
Remko Tronçon
674dce6514 Detect stack underflow after interpreting 2022-05-03 21:52:27 +02:00
Remko Tronçon
85efb6262e Improve sieve-raw-wasm 2022-05-03 21:38:07 +02:00
Remko Tronçon
64357b336f Name WAForth module 2022-05-03 21:37:58 +02:00
Remko Tronçon
0b1c7d2a24 benchmarks: Add C and JS version 2022-05-01 22:52:49 +02:00
Remko Tronçon
63841b65ab sieve-vanilla->sieve-raw-wasm 2022-05-01 20:34:38 +02:00
Remko Tronçon
9e0705c9cd Cleanup 2022-05-01 17:47:08 +02:00
Remko Tronçon
fffd982121 Remove sieve_direct 2022-05-01 17:09:14 +02:00
Remko Tronçon
f5df37a12f Remove obsolete environment queries 2022-05-01 16:58:33 +02:00
Remko Tronçon
ed469cbef4 <#, #>, #, #S, SIGN, HOLD 2022-05-01 16:56:20 +02:00
Remko Tronçon
ba5bff8a99 ENVIRONMENT? 2022-05-01 11:37:35 +02:00
Remko Tronçon
bed0d392c8 Refactor string comparison 2022-05-01 10:45:53 +02:00
Remko Tronçon
38ed36b337 Cleanup 2022-05-01 09:40:17 +02:00
Remko Tronçon
5d687e8253 >NUMBER 2022-04-30 23:25:23 +02:00
Remko Tronçon
504ae3e93e Fix FM/MOD + Implement SM/REM, UM/MOD. 2022-04-30 23:25:23 +02:00
Remko Tronçon
c798ad8826 compiler: Repace get+set of TOS with tee 2022-04-30 12:46:42 +02:00
Remko Tronçon
fdda5b5009 do/loop: Use diff as index
This avoids an extra local per loop, avoids a branch
in +LOOP, and fixes handling of large unsigned integers as loop indices.
2022-04-30 12:46:26 +02:00
Remko Tronçon
a07772536c tests: Enable parts of test suite 2022-04-26 22:46:54 +02:00
Remko Tronçon
3d9b10c860 tests: Enable BASE test 2022-04-26 22:46:54 +02:00
Remko Tronçon
4d6c3cb34d compiler: Fix behavior of I & J to be compliant with ANS.
Keep loop indexes on the return stack for behavior of I and J.
2022-04-26 22:46:54 +02:00
Remko Tronçon
175bf67767 compiler: do: replace set+get by tee 2022-04-26 20:48:41 +02:00
Remko Tronçon
d6e8406c11 Remove unused predefined words from predefined list 2022-04-26 09:08:05 +02:00
Remko Tronçon
eeb6bf9587 Fix wabt 1.0.27 compatibility 2022-04-25 21:29:23 +02:00
Remko Tronçon
e2dedf224a remove whitespace 2022-04-24 20:42:45 +02:00
Remko Tronçon
3034869230 compiler: compile push & pop inline (infrastructure) 2022-04-24 12:23:42 +02:00
Remko Tronçon
257d731b96 compiler: fix bad local index offset 2022-04-24 12:22:16 +02:00
Remko Tronçon
610006c63e remove tos import in compiled words
This was there in case we wanted to use mutable globals for the TOS.
Since we now use a local TOS, this is no longer useful.
2022-04-23 23:13:17 +02:00
Remko Tronçon
5023ea7b2f thread tos as local through all words
This gives a 20% execution time improvement.
2022-04-23 22:45:55 +02:00
Remko Tronçon
da3ad27c43 Revert "make stack grow downward"
Reduces binary, but decreases performance, and only makes things a little bit simpler.
2022-04-22 13:57:48 +02:00
Remko Tronçon
41c6aa5d6f make stack grow downward 2022-04-22 12:15:02 +02:00
Remko Tronçon
6dd4f644f0 tests: use stackValues everywhere 2022-04-22 08:20:28 +02:00
Remko Tronçon
39dc0d422a remove toplevel module 2022-04-22 08:20:28 +02:00
Remko Tronçon
e7cf4909fa shell: display build date 2022-04-18 14:41:52 +02:00
Remko Tronçon
ea97e51644 shell: styling tweaks 2022-04-18 14:20:41 +02:00
Remko Tronçon
48dfdd00aa shell: avoid scroll on space 2022-04-18 14:05:02 +02:00
Remko Tronçon
4fe9471c66 shell: scroll cursor into view 2022-04-18 13:31:42 +02:00
Remko Tronçon
9a400f17c9 shell: bring up keyboard on iOS 2022-04-18 13:26:48 +02:00
Remko Tronçon
8fd40215c6 implement WORDS
Closes #25
2022-04-17 21:14:07 +02:00
Remko Tronçon
05e341c865 add comments 2022-04-17 17:19:15 +02:00
Remko Tronçon
0f0335568b fix backspace in shell 2022-04-17 17:12:32 +02:00
Remko Tronçon
ef0a360366 move waforth2c to src/ 2022-04-17 17:08:52 +02:00
Remko Tronçon
31bf2734b8 add failing standard testsuite test to unit tests
Temporarily disabled
2022-04-17 16:06:23 +02:00
Remko Tronçon
739556cec0 log error message when generated module fails to load 2022-04-17 16:04:10 +02:00
Remko Tronçon
9c647ef565 simplify compiled control flow instructions 2022-04-17 15:47:06 +02:00
Remko Tronçon
74bb57b72e simplify some loops 2022-04-17 13:59:01 +02:00
Remko Tronçon
7b62970b19 remove unnecessary branch 2022-04-17 13:40:47 +02:00
Remko Tronçon
1606979349 use forth loader for web build 2022-04-17 10:00:15 +02:00
Remko Tronçon
c39724348e reorganize directory structure 2022-04-17 09:30:19 +02:00
Remko Tronçon
2a7240c043 move wrapper & sieve to src/ 2022-04-15 15:39:59 +02:00
Remko Tronçon
7e2cf5dad5 move tools to scripts 2022-04-15 15:33:56 +02:00
Remko Tronçon
c64957e41e fix lint error 2022-04-14 23:00:45 +02:00
Remko Tronçon
5aa2485cd4 new shell tweaks 2022-04-14 22:40:57 +02:00
Remko Tronçon
aec82f987b ignore sieve emit 2022-04-14 22:33:22 +02:00
Remko Tronçon
e957c69723 remove unused b64 param 2022-04-14 22:21:35 +02:00
Remko Tronçon
c8fd06464e handle copy/paste 2022-04-14 22:15:37 +02:00
Remko Tronçon
533de49cd5 simplify base64 handling 2022-04-14 21:46:06 +02:00
Remko Tronçon
806ebd742c replace console with own implementation 2022-04-14 21:36:44 +02:00
Remko Tronçon
387f339780 use esbuild for tests 2022-04-14 16:53:57 +02:00
Remko Tronçon
10bfbf3876 remove commander dependency 2022-04-13 22:31:54 +02:00
Remko Tronçon
89e0ef71d8 remove promise-polyfill dependency 2022-04-13 22:23:30 +02:00
Remko Tronçon
6b9de10002 webpack -> esbuild 2022-04-13 21:09:18 +02:00
Remko Tronçon
3dd6aa11f1 Add .S implementation 2020-06-01 16:22:22 +02:00
Remko Tronçon
5d2a92abcf Readability 2019-11-12 13:41:50 +01:00
Remko Tronçon
6d91c15610 Get rid of preprocessor need 2019-11-11 11:40:52 +01:00
Remko Tronçon
6f3609f364 Prettify 2019-11-11 10:35:34 +01:00
Remko Tronçon
74420aa86a Clean up word names 2019-11-09 21:36:28 +01:00
Remko Tronçon
2077651bc7 Move README around 2019-11-09 21:13:55 +01:00
Remko Tronçon
face95106d Support bulk memory operations 2019-11-09 20:42:34 +01:00
Remko Tronçon
61db4bcbcb Add WIP file 2019-11-09 20:42:34 +01:00
Remko Tronçon
5f779eeeff Some simplification 2019-11-09 19:49:34 +01:00
Remko Tronçon
a8fa217933 Switch to dot notation for instructions 2019-11-09 19:28:59 +01:00
Remko Tronçon
b2cd69847b Some cleanup 2019-11-08 22:42:11 +01:00
Remko Tronçon
eecbca693f Prettify constants 2019-11-08 22:42:11 +01:00
Remko Tronçon
9c99a927be Replace assembler with preprocessor 2019-11-08 22:42:11 +01:00
Remko Tronçon
46cbda1f6a Remove prelude 2019-11-08 16:19:47 +01:00
Remko Tronçon
eaf52649f9 Implement U. natively 2019-11-08 16:16:13 +01:00
Remko Tronçon
29a8f5c518 Implement . natively 2019-11-08 16:10:19 +01:00
Remko Tronçon
7202762f0f Implement VALUE natively 2019-11-08 15:20:10 +01:00
Remko Tronçon
2446f28f91 Implement VALUE natively 2019-11-08 15:18:47 +01:00
Remko Tronçon
0a3debbd87 Implement UWIDTH natively 2019-11-08 15:13:58 +01:00
Remko Tronçon
f0127b4691 Implement CONSTANT natively 2019-11-08 15:00:35 +01:00
Remko Tronçon
9cfd1100dd Add helper to create dictionary entry 2019-11-08 14:17:53 +01:00
Remko Tronçon
fa5bf0558a Remove more macros 2019-11-08 10:39:49 +01:00
Remko Tronçon
3395713abf Bring back some constants 2019-11-08 09:56:26 +01:00
Remko Tronçon
c20c93d516 Make some prelude functions native 2019-11-08 09:21:50 +01:00
Remko Tronçon
8391028855 Remove macro for table elements 2019-11-07 21:59:26 +01:00
Remko Tronçon
2e236860a1 Remove dictionary macros 2019-11-07 21:32:11 +01:00
Remko Tronçon
62f295d536 Reordering 2019-11-07 21:09:55 +01:00
Remko Tronçon
fd3a69cb93 Hard-code string offsets 2019-11-07 20:21:16 +01:00
Remko Tronçon
a6e8d28219 Fix POSTPONE 2019-03-14 20:28:01 +01:00
Remko Tronçon
621d77d622 Use 1 byte for counted string length 2019-03-14 18:10:08 +01:00
Remko Tronçon
c15e5549e8 Fix EVALUATE 2019-03-14 17:15:34 +01:00
Remko Tronçon
ac2517248c Implement WORD 2019-03-14 15:35:02 +01:00
Remko Tronçon
172312b595 Implement \ as a real word 2019-03-14 12:11:25 +01:00
Remko Tronçon
bb657661aa Fix +LOOP with negative increment 2019-03-14 11:54:20 +01:00
Remko Tronçon
a0f216f79b Fix bug in LEAVE 2019-03-14 09:49:17 +01:00
Remko Tronçon
870014d3b9 More tests 2019-03-13 22:35:19 +01:00
Remko Tronçon
bb9e6196ff Implement M* + UM* 2019-03-13 21:24:40 +01:00
Remko Tronçon
186ab96276 Implement S>D 2019-03-13 20:01:17 +01:00
Remko Tronçon
e41247b2a7 Implement REFILL + make >IN handling compliant 2019-03-13 17:47:35 +01:00
Remko Tronçon
c507d50f19 Order assembled output 2019-03-12 22:05:29 +01:00
Remko Tronçon
0248e87dc3 Cleanup 2019-03-12 21:16:43 +01:00
Remko Tronçon
0417afefe6 Add error messages 2019-03-12 20:15:01 +01:00
Remko Tronçon
03b045d943 Implement ABORT" 2019-03-12 16:05:19 +01:00
Remko Tronçon
7920432071 Implement ABORT + QUIT 2019-03-12 14:26:38 +01:00
Remko Tronçon
2e344baf31 Implement KEY + ACCEPT 2019-03-12 11:14:13 +01:00
Remko Tronçon
06dd7c12e7 shell.key->shell.getc 2019-03-12 09:04:39 +01:00
Remko Tronçon
7bac62308a Remove unused export 2019-03-11 16:25:19 +01:00
Remko Tronçon
166d82d899 Remove unused code 2019-03-11 15:57:32 +01:00
Remko Tronçon
775c714904 Remove stray ; 2019-03-11 15:20:58 +01:00
Remko Tronçon
4af07fe635 KEY isn't what some other forths made me think it was 2019-03-11 14:24:50 +01:00
Remko Tronçon
779945c306 Implement [CHAR] 2019-03-11 14:01:46 +01:00
Remko Tronçon
f17dac3e09 Implement ['] 2019-03-11 14:01:42 +01:00
Remko Tronçon
5c1c33d63d Implement POSTPONE 2019-03-11 11:18:29 +01:00
Remko Tronçon
b23bf78a45 Implement CONSTANT & VALUE in terms of CREATE DOES> 2019-03-10 16:59:40 +01:00
Remko Tronçon
2a7322cfa5 Implement DOES> 2019-03-10 16:46:51 +01:00
Remko Tronçon
f7a1ab2aa2 Prepare for DOES> 2019-03-10 14:29:25 +01:00
Remko Tronçon
eb97d29d90 Add command-line unit test runner 2019-03-10 14:29:25 +01:00
Remko Tronçon
bbe5a4eec3 Add documentation 2019-03-09 22:03:13 +01:00
Remko Tronçon
05323af20a Fix CREATE 2019-03-09 22:03:13 +01:00
Remko Tronçon
e824778981 Add some code comments 2019-03-09 21:04:17 +01:00
Remko Tronçon
d536309494 Update quadruple.wat. 2019-03-09 20:17:16 +01:00
Remko Tronçon
6a3c1d96b4 Export state symbols 2019-03-08 22:05:34 +01:00
Remko Tronçon
b23d7ec689 Import better initial table size 2019-03-08 21:59:26 +01:00
Remko Tronçon
ae0f0c6347 Don't import table index offset 2019-03-08 21:52:14 +01:00
Remko Tronçon
6ce0cf86bc Don't use unnecessary parameter for non-data words 2018-06-03 21:40:03 +02:00
Remko Tronçon
1c9d8182e5 Simplify interpreter 2018-06-03 20:43:16 +02:00
Remko Tronçon
d481a1cdb1 Implement UNUSED 2018-06-03 20:08:03 +02:00
Remko Tronçon
f038f31ba0 Implement SOURCE-ID 2018-06-03 20:05:14 +02:00
Remko Tronçon
255f963ae7 Implement TRUE & FALSE 2018-06-03 20:00:31 +02:00
Remko Tronçon
8097b7575c Support BASE in number parser.
Resolves #7
2018-06-03 19:56:09 +02:00
Remko Tronçon
328f362982 Implement more words 2018-06-03 18:35:28 +02:00
Remko Tronçon
56e3750344 Implement EVALUATE 2018-06-03 16:49:36 +02:00
Remko Tronçon
f6293c9d3d Refactor I/O again 2018-06-03 15:17:38 +02:00
Remko Tronçon
5fb2a671ca Implement SOURCE 2018-06-03 09:54:35 +02:00
Remko Tronçon
ef0eb1209b Implement >IN 2018-06-03 09:51:57 +02:00
Remko Tronçon
692e0ea288 Refactor I/O 2018-06-03 09:40:23 +02:00
Remko Tronçon
c5453432f3 Implement */MOD 2018-06-01 23:05:28 +02:00
Remko Tronçon
8140811ead Implement */ 2018-06-01 22:49:16 +02:00
Remko Tronçon
b6fecdebb1 Implement MOVE 2018-06-01 22:26:45 +02:00
Remko Tronçon
9cd4e7134d Move state to memory 2018-06-01 21:39:22 +02:00
Remko Tronçon
eb1971de73 Implement more core words 2018-06-01 21:09:05 +02:00
Remko Tronçon
76b1975ff6 Add name section support.
Resolves #2
2018-05-31 22:06:55 +02:00
Remko Tronçon
903ccd2df5 Fix direct sieve 2018-05-30 18:09:40 +02:00
Remko Tronçon
d6033e83ce Refactor push compilation in preparation for #1 2018-05-30 14:49:46 +02:00
Remko Tronçon
4043db2afd Use webpack for bundling
Parcel has too many limitations.
2018-05-29 20:54:45 +02:00
Remko Tronçon
bebe495332 Extract sieve benchmark 2018-05-29 13:44:26 +02:00
Remko Tronçon
df64428f77 Import memory and TOS in compiled word modules
In preparation of #1
2018-05-28 13:48:05 +02:00
Remko Tronçon
e49e8439ea Move table index management to WebAssembly core 2018-05-28 13:48:05 +02:00
Remko Tronçon
bdfb63fa88 Factor out push compilation.
In preparation of #1
2018-05-28 13:48:05 +02:00
Remko Tronçon
71b506fddd Optimize loop compilation
Fixes #3
2018-05-28 13:48:05 +02:00
Remko Tronçon
15cb0a8256 Add variable support 2018-05-24 22:16:31 +02:00
Remko Tronçon
664e8863fb Thread data pointer to words 2018-05-24 22:14:55 +02:00