https://github.com/khtdr/stoa
language framework
https://github.com/khtdr/stoa
Last synced: over 1 year ago
JSON representation
language framework
- Host: GitHub
- URL: https://github.com/khtdr/stoa
- Owner: khtdr
- Created: 2020-02-07T06:19:16.000Z (over 6 years ago)
- Default Branch: sage
- Last Pushed: 2024-03-10T22:05:30.000Z (over 2 years ago)
- Last Synced: 2025-04-14T00:13:27.095Z (over 1 year ago)
- Language: TypeScript
- Homepage: https://khtdr.github.io/stoa
- Size: 2.56 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
* Project Stoa
** Project Status
*** [ ] create an example language based on Crafting Interpreters called =Stox=
*** [ ] create a malleable language framework for exploring language ideas
** Example Languages
*** Stox
**** Code Structure
#+begin_src shell :results none
make graphics
#+end_src
[[./images/stox-code.png]]
**** Build Status
#+begin_src sh :exports both :results verbatim
make clean all
#+end_src
#+RESULTS:
#+begin_example
rm -rf node_modules
rm -rf coverage
rm -f ./bin/stox.js
pnpm install
Lockfile is up to date, resolution step is skipped
Progress: resolved 1, reused 0, downloaded 0, added 0
Packages: +305
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 305, reused 305, downloaded 0, added 296
Progress: resolved 305, reused 305, downloaded 0, added 305, done
devDependencies:
+ @istanbuljs/nyc-config-typescript 1.0.2
+ @types/node 14.18.63
+ dependency-cruiser 11.18.0
+ nodemon 2.0.22
+ nyc 15.1.0
+ opts 2.0.2
+ tsup 6.7.0
+ typescript 4.9.5
Done in 1.8s
CLI Building entry: lib/repl-kit/index.ts
CLI Using tsconfig: tsconfig.json
CLI tsup v6.7.0
CLI Target: es6
CJS Build start
CJS packages/repl-kit/index.js 5.13 KB
CJS packages/repl-kit/index.js.map 13.73 KB
CJS ⚡️ Build success in 229ms
DTS Build start
DTS ⚡️ Build success in 622ms
DTS packages/repl-kit/index.d.ts 228.00 B
CLI Building entry: stox.ts
CLI Using tsconfig: tsconfig.json
CLI tsup v6.7.0
CLI Target: es6
CJS Build start
CJS bin/stox.js 29.19 KB
CJS bin/stox.js.map 118.16 KB
CJS ⚡️ Build success in 20ms
#+end_example
**** Usage Documentation
#+begin_src sh :exports both :results verbatim
./bin/stox --help
#+end_src
#+RESULTS:
#+begin_example
Usage: node ./bin/stox.js [options] [file]
Show this help message
--help
prints version info and exits
-v, --version
prints parse tree and exits
-p, --parse
prints tokens and exits
-t, --tokens
runs the repl
-r, --repl
#+end_example
**** Current Version
#+begin_src sh :exports both :results verbatim
./bin/stox -v
#+end_src
#+RESULTS:
: stox-2022.08.15
**** Code Coverage
#+begin_src sh :exports both :results verbatim
make coverage
#+end_src
#+RESULTS:
#+begin_example
=============================== Coverage summary ===============================
Statements : 95.53% ( 813/851 )
Branches : 80.4% ( 357/444 )
Functions : 97.76% ( 219/224 )
Lines : 95.44% ( 713/747 )
================================================================================
------------------|---------|----------|---------|---------|----------------------------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
------------------|---------|----------|---------|---------|----------------------------------------
All files | 95.53 | 80.4 | 97.76 | 95.44 |
lib/stoa-ltk | 98.33 | 92.07 | 95.74 | 98.1 |
language.ts | 100 | 95.23 | 100 | 100 | 60
parser.ts | 95.23 | 75 | 84.61 | 94.28 | 13,84
reporter.ts | 100 | 100 | 100 | 100 |
runtime.ts | 100 | 100 | 100 | 100 |
tokenizer.ts | 98.82 | 98.14 | 100 | 98.63 | 216
stox | 94.01 | 75.42 | 99.23 | 94.38 |
cli-app.ts | 100 | 80 | 100 | 100 | 34-39
interpreter.ts | 90.06 | 75.7 | 100 | 90.44 | ...108,124-126,157,168,229,244,253,255
parser.ts | 93.68 | 73.04 | 97.14 | 94.47 | 16,56,180-181,272,375,463,469-481
printer.ts | 96.87 | 80 | 100 | 96.42 | 55-56
resolver.ts | 100 | 85 | 100 | 100 | 46,123,166
stox-lang.ts | 100 | 100 | 100 | 100 |
tokenizer.ts | 100 | 100 | 100 | 100 |
stox/ast | 100 | 100 | 100 | 100 |
declarations.ts | 100 | 100 | 100 | 100 |
expressions.ts | 100 | 100 | 100 | 100 |
nodes.ts | 100 | 100 | 100 | 100 |
statements.ts | 100 | 100 | 100 | 100 |
visitor.ts | 100 | 100 | 100 | 100 |
stox/runtime | 92.3 | 82.5 | 90.9 | 89.79 |
classes.ts | 90 | 75 | 87.5 | 87.5 | 19,32
control-flow.ts | 100 | 75 | 100 | 100 | 7
environment.ts | 90 | 82.14 | 100 | 84.61 | 17,23
globals.ts | 66.66 | 100 | 50 | 66.66 | 7
values.ts | 100 | 100 | 100 | 100 |
------------------|---------|----------|---------|---------|----------------------------------------
#+end_example
The latest uploaded code-coverage reports are at: https://khtdr.com/stoa/coverage
**** Test Suite Status
#+begin_src sh :exports both :results verbatim
make test
#+end_src
#+RESULTS:
#+begin_example
Testing: arithmetic.stox
✔✔✔✔✔✔
Testing: bad-token.stox
✔✔✔✔✔✔
Testing: class-syntax.stox
✔✔✔✔✔✔
Testing: closures.stox
✔✔✔✔✔✔
Testing: comments.stox
✔✔✔✔✔✔
Testing: divide-by-zero.stox
✔✔✔✔✔✔
Testing: fib.stox
✔✔✔✔✔✔
Testing: functions.stox
✔✔✔✔✔✔
Testing: global-redefine.stox
✔✔✔✔✔✔
Testing: hello-world.stox
✔✔✔✔✔✔
Testing: literals.stox
✔✔✔✔✔✔
Testing: logical-ternary.stox
✔✔✔✔✔✔
Testing: name.stox
✔✔✔✔✔✔
Testing: same-names.stox
✔✔✔✔✔✔
Testing: scope.stox
✔✔✔✔✔✔
Testing: semantic-return.stox
✔✔✔✔✔✔
Testing: sticky-precision.stox
✔✔✔✔✔✔
Testing: triforce.stox
✔✔✔✔✔✔
Testing: version.stox
✔✔✔✔✔✔
Passing: 114 out of 114 (100%)
Failing: 0 out of 114 (0%)
#+end_example
**** Potential Goals
- full stack from sql to hover effects
- lsp compatible
- actually use it to create
- minimize user function writing with string/date/number primitives
* ...
** clean
src_elisp[:results none]{(save-excursion (org-goto-line 1) (+org/remove-result-blocks t))}
** build
src_elisp[:results none]{(save-excursion (org-goto-line 1) (org-babel-execute-subtree))}