-
Traditional front end: Lexer, Parser to CST, Transformer to AST
- Concrete vs. Abstract Syntax Tree is Important (see below)
-
Type Checker
-
Compiler (to WASM) That Relies on Types (+)
-
Interpreter that does dynamic checks (for quick prototyping)
-
Data Types:
- Bool Num (is a float for mandelbrot)
- Str List
Vector[T]
(+)- with UTF-8 support? At least count the length
-
String Interpolation
(echo "hello \(name)")
-
Comptime like Zig, (C++ constexpr/consteval), D has this too I think
(constexpr x (+ 2 3)
(constexpr [x Int] (+ 2 3)
-
Serialization with YON: Yaks Object Notation
- TODO: static vs. dynamic variant?
-
Reader macros?
-
Quasi-quote with
\\(foo $unquote @splice)
-
Not sure if we need
$(a b) @(c d)
, maybe not- I think those are just variables
-
for shell
$(echo hi)
=>(cmd echo hi)
? -
$(echo "hello \(name)")
=>(cmd echo hi)
? -
There's a conflict between string substitution
$var $ (echo hi) and macro -
use case:
and
macro
-
-
Julia uses $
-
Elixir just uses unquote(x) and unquote do end?
- just use process.stdout and process.stdin?
- for reading and writing YON
-
console.log() binding I guess
-
maybe the
<canvas></canvas>
binding for Mandelbrot- https://github.com/andychu/javascript-vs-c
- file:///home/andy/git/oilshell/javascript-vs-c/mandelbrot.html
- How do you do Math.log?
-
Exchange YON with browser?
- "" string literal syntax should be easy
- I guess you can send UTF-8 strings, but not everything
-
File I/O with
Int
FD -
(fork) and (wait) concurreency?
-
What about garbage collection and signals?
-
Formatter
- indentation and whitespace
- maybe comments -- we don't have that right now -- I think Lisps traditionally have some problems with this
-
Linter
- unused variables
-
Syntax highlighter in Treesitter? I want to at least try it
-
Test framework? Probably need it, could use macros for assert?
-
Bundler? Probably not, we don't have modules?
-
textarea and input box
-
reprint the whole text with
<span class="error"></span>
when there's an error -
IDE server with completion
- look at matklad posts
- the three loops?
- complete keywords/functions first
- but really you need objects like (obj.method 1 2 3)
- Mandelbrot (graphics)
- Num and
Vector[Num]
- Num and
- Shak: Shell implemented in Yaks?
- can probably use Deno/node.js stdout, and possibly
- $(echo hi)
Title: A Statically Typed Language in 500 lines of TypeScript (or Python)
"Simplest code that's not a toy" -- Has a good parser with exhaustive reasoning, and gives precise error emssages. Based on Oils.
- Similar to "500 lines or less" book (which doesn't have this)