Skip to content

Latest commit

 

History

History
135 lines (114 loc) · 5.4 KB

todo.md

File metadata and controls

135 lines (114 loc) · 5.4 KB

TODOs

MVP

  • Re association of lambda calculus terms

Features

  • Shift+enter in REPL continues without execution
  • REPL remembers variables from previous executions
  • REPL completion from std::lib and imported files
  • Load, unload, reload and display loaded modules in REPL
  • Imports
  • Move globals / std into a file using low level ops (started)
  • Check for associativity errors (e.g. a&&b||c)
  • Allow operator declaration (with semantics on evaluation order [i.e. which sides are auto converted to lambdas before being sent to the operator])
    • Ops need:
      • Precedence (maybe a set of allowed inner operators rather than a number)
      • left or right associativity
      • a bin/un-op form (possibly both)
  • Convert bin and un-op to calls to the operator functions
  • Introduce "." notation for identifiers.
  • Convenient Conditionals / Ifs / Matches
    • i.e. Shouldn't have to use operators
    • Should mirror if-then-else, loop, while, for(each)
  • Type checking
    • Effects system (e.g. type & Effect)
      • Handlers (i.e. continuations)
    • Mutability (via effects)
    • Containers (Vec, Set, HashMap)
    • Products / Anonymous + Named Tuples / Records
    • Unions / Enums / GADTs
    • Monads?
  • Sugar
    • pointer(ty)
    • x?.y (mapped .get and .set)
    • x?:y (sugar for if x then x else y)
  • Locals (scope management)
  • Main + command function argument parsing
  • Conversion to SSA (after parsing)
  • Conversion to stack?
  • Move source locations out of errors and AST nodes in favour of symbol 'paths'
  • Look up source locations only when displaying info / errors to the user
  • Incremental re-parsing

Testing

  • Unit tests for code generator

  • Unit tests for error generation (i.e. source locations, file names)

  • Tests for compiled programs (not just golden sources, but behaviour)

  • Standardize on cli arguments (copying, where possible from go, rustc, cargo) e.g.:

    • tako help
    • tako build
    • tako run
    • tako doc
    • tako clean

User code optimisations

Compiler optimisations and usability

  • Intern strings
  • Could use a fast string matching algorithm to quickly count newlines when building error messages, rather than counting them during tokenization
  • For logging and timing purposes, it seems likely that a scope guard pattern would make reporting much more reliable
  • Probably should eventually support Unicode identifiers
  • Should use smallvec for argument lists and other compiler info
  • Should experiment with LLVM
  • Explore using worker threads for the parser
    • Job per file, contributing to a queue of nodes to store
    • Bunches of nodes to store would be faster to store as groups and could be async from file access
    • Parsing the file could be broken up by balanced brackets
    • This may be premature optimisation the store medium / RAM may be the bottle neck
  • Remove AST and Info types

Communication

  • Improve on (and updating) Read Me
  • Put the license on the site
  • Improve on the site (add the Read Me)
  • Write a getting started
  • Language documentation

Pain points

  • No way to run machine or low level instructions
  • No type checking (requirements and exhaustiveness checking)
  • Compiler is far behind interpreter feature set

Benchmarks

  • lexing benchmarks
  • parsing benchmarks
  • type checking benchmarks
  • cache benchmarks

Resources

Vision

  • Main programs have a build function alongside main for config
    • This means no 2nd language for config, or reduction in expressivity when doing config
    • Build is run in the interpreter to generate build effects and config, including any operator overloads needed
    • Build config is type checked and auto completed etc.
    • Version info as static arg to makePackage?
    • tako ci
      • Runs install deps, builds & type check and tests
    • "features" are just flags passed to build
    • Statically declarable arg parsing
      • No more int main(int argc, char* argv[])
      • main(expression: string, show_working: Arg(bool, "--show-working", default=false), *unknown: Arg[]): ErrorCode {
      • Pass unknowns to tako.cli(unknown) to get "--help", "-h", "--verbose", "-v", "--autocomplete"
    • Cli generator is a default argument to makeBinary & the interpreter state
      • It uses tako's reflection capabilities to do 'run time' code gen, but its statically available because it doesn't produce side effects.
    • Git hash available in build artifacts
    • Multiple entry points possible in a single file
      • makeBinary(main, "main") is default but
      • makeBinary(test, "unit") is just as valid