Native Shell
Native Shell:AI 生成的 UI,在你的应用中原生呈现,覆盖每个平台。iOS、Android、macOS、Windows 与 Linux 上的应用、GPUI 应用与网页在运行时加载已签名、沙箱隔离的 TSX 模块并绘制 th
AI 翻译
尚未检测到更新。GitHub 发布版本后会显示在这里。
个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
在项目文件夹中运行 /nomorevibe verify,即可验证所有权并自行管理介绍。
一分钟完成验证A small, mostly standard Forth in the browser: compiled words, return stack, DO/LOOP, BEGIN/WHILE, CREATE DOES>, live stack view. Zero dependencies.
翻译准备中
取自仓库 README
正在加载完整 README。
查看完整 README ↗A small Forth that runs in the browser, close to the standard. Colon definitions are compiled, there's a real return stack and proper control flow, and the terminal shows the data stack live. There are no dependencies and no build step.
Live demo: https://cstroie.github.io/forth/
2 3 + . \ 5
: square ( n -- n*n ) dup * ;
7 square . \ 49
: countdown ( n -- ) begin dup . 1- dup 0= until drop ;
5 countdown \ 5 4 3 2 1
Type help for an overview, words to list every word, and see name to show a definition. The Examples panel loads ready-made programs:
CREATE … DOES> arraysmsCASE and KEY<# #>| Area | Words |
|---|---|
| Stack | dup drop swap over rot -rot nip tuck pick roll ?dup 2dup 2drop 2swap 2over depth clear >r r> r@ |
| Arithmetic | + - * / mod /mod */ negate abs min max 1+ 1- 2* 2/ and or xor invert lshift rshift random |
| Comparison | = <> < > <= >= 0= 0<> 0< 0> u< within true false |
| Output | . u. .r .s ? emit cr space spaces type ." .( page / cls, decimal hex binary |
| Control | if else then, do ?do loop +loop i j leave unloop, begin until again, begin while repeat, case of endof endcase, recurse exit |
| Defining | : ; variable constant value to create allot , c, does> ' ['] execute literal char [char] |
| Memory | @ ! +! c@ c! 2@ 2! here cells cell+ chars char+ 2variable 2constant |
| Compiler | immediate postpone [ ] literal compile, marker forget |
| Formatting | <# # #s hold sign #>, s>d d. |
| Input and time | key key? accept ms |
| Floating point | f+ f- f* f/ f** fnegate fabs fsqrt fsin fcos ftan fatan fexp fln flog floor fround fmin fmax, fdup fdrop fswap fover frot fdepth, s>f f>s f= f< f0= f0< f. f.s pi f@ f! fvariable fconstant |
| Strings and comments | ." text", s" text", ( comment ), \ comment |
| Tools | words see help cold |
| Storage | save name, load name, files, delete name |
How it behaves:
true is -1. / and mod round toward negative infinity (floored division).1.5, 2e0) is a float.base. A prefix overrides it: $FF is hex, #10 decimal, %101 binary, and 'a' is a character code.ABORT does. The message points at the word that failed, for example 2 3 >>>foo<<<.key waits for a keystroke, accept reads a typed line, and ms pauses without freezing the page.Tab completes word names. ↑/↓ scroll through history. Esc or Ctrl+C interrupts a runaway word: the interpreter runs in time slices, so begin again can't freeze the page.cold starts from scratch.The page is a Progressive Web App. Your browser offers to install it (on a phone, use Add to Home Screen). After the first visit it also works offline: a service worker (sw.js) caches the app and refreshes it in the background, so updates appear on the next visit.
forth.js holds the interpreter: outer interpreter, compiler, inner interpreter and the built-in words. It doesn't touch the DOM, so it can run in Node:
const { Forth } = require('./forth.js');
const storage = { get: () => null, set: () => true, remove() {}, keys: () => [] };
const f = new Forth(text => process.stdout.write(text), storage);
f.enter(': sq dup * ; 12 sq .');
f.runSlice(); // prints "144 ok"
index.html holds the terminal user interface.
node --test
The tests run the interpreter core under Node (version 18 or later) with no dependencies. GitHub Actions runs them on every push.
This started as a fork of eatonphil/jsforth (2013–2015), a micro-Forth Phil Eaton wrote for a programming-languages course. Version 2 is a complete rewrite. The original passed words around as strings and re-interpreted them; this version compiles definitions into code, runs them on an inner interpreter, and uses standard Forth behaviour throughout.
Programs saved with the old save command can still be loaded with load.
MIT. Original © Phil Eaton, rewrite © Costin Stroie.