TODO for self-hosting ================ [x] subtraction [x] make 1-2 work (make -2 be parsed as - 2) [x] handle negative literals: -2 [x] preamble while [x] make `ret` not compile into a function call [x] if-else [x] array indexing [x] array literals [x] and [x] or [x] quoted table access [x] output a compiler program [x] not [x] multiplication [x] division [x] call a function with no arguments [x] multi-if [x] fix normalize in arrays [x] fix ``` multiple times [x] add 'single quote strings' [x] fix empty array literal [x] add `throw` [x] escape quotes in strings [x] single-line array literals [x] rewrite jison/parser-generator.js TODO to make a usable syntax [x] unescape strings for macros, and [x] escape string contents [x] `rewrite@(node.type) (node)` syntax doesn't work [x] allow escaping "s in strings [x] array literals with commas [x] what to do about commas [x] regexes [x] `key = value` syntax instead of (or temporarily `or`) `:` in tables [x] multi-line statements (skip newline parse in `(`) [x] single line lambdas auto-return [x] auto-return lambdas still force you to wrap a single result in parens [x] `->` operator [x] implicit `_it` parameter (only if used?) and explicit no-arg functions [ ] preamble for [ ] return from outer block [ ] keywords and/or useable as table keys TODO for variables pass[es?] [x] add an errors compiler pass [x] enforce const [x] enfoce no shadowing outside of `self` and `it` [x] enforce mutate can only be used on mutables [ ] add tests for const [x] check for undefined variables [ ] make `global` refer to `window` or `global` in a prelude [x] add `global` as a special variable TODO misc to make a usable compiler [ ] have `if` check for `else` or `if` in incorrect positions [ ] escape javascript keywords used as variables/table keys [ ] change the syntax to look more like swift TODO for types [ ] recognize type annotations in the grammar [ ] write a type theorem prover [x] add a type checker as a compiler pass [ ] we seem to be running `check` twice on mutable a = {a: 5, b: 7} mutable b = 1 mutate b = a.a [x] fix bug where it thinks lots of things are undefined (or is console...?) [ ] enforce using mutate to modify a table variable, so we don't get `var module.exports = {}` in js [ ] type inference on functions [ ] figure out type declarations [x] figure out how to unify contexts for lambda's `check` and `get_type` functions [x] problem caused by a recursive lookup of the type of ParseNode while we're in the ParseNode variable. [ ] fix "at location unknown" error for using an undeclared variable TODO to make everyone happy ================ [ ] export function to set module.exports [ ] better name for implicit `_it` [ ] ? operator [ ] `<-` operator? [ ] what to do about multi-line function calls [ ] a repl [ ] dashes in table field names? [ ] macros [ ] source maps [ ] destructuring [ ] pattern matching [ ] figure out what to do with all the parens? [ ] alformat / alc -f