1 unstable release
0.1.0 | May 7, 2022 |
---|
#584 in Programming languages
10KB
167 lines
Wysk
A statically typed, functional language inspired by Haskell, ML, and Rust. This language is effectively a rewrite and redesign of all the prior languages I've (incompletely) implemented, but with an emphasis on modular (and ideally non-monolithic) code.
I am still fairly inexperienced when it comes to compiler development, so it follows that this project -- and its documentation -- is very much a work in progress.
Goals
Below are some of the things I'm hoping to implement.
- Algebraic data types
- Typeclasses/systematic overloading
- Hindley-Milner type inference
- Extensible records
- Interactive bytecode interpreter
- LLVM JIT compilation
Todo
- Implement project manifest serializer/deserializer
- Design spans to allow for byte-indexing the source code
- Thread-safe handwritten string interner.
- Separate lexeme and token definitions to minimize footprint and facilitate error reporting
- Modify lexer to depend on byte positions rather than character indices
- Design module-friendly and polymorphic AST to facilitate later simplification and semantic analysis phases
- Implement parser to allow for code-reuse in later syntactic analysis
- Implement post-parse pass to reflect user-defined operator precedence and associativity (either from definitions within the same module or from dependencies)
- Implement identifier renaming pass to identify name clashes and generate unique names for entities involved
- Implement support for (hygienic) macros in lexing and parsing
- Improve lexer error reporting to include context
- Unify error handling into its own library
- Prettify error messages
- Add suggestions to error messages
- Implement static type inference engine (Hindley-Milner+)
- Implement dependency analysis for global (module-level) and local (entity definition-level) scopes
- Model entities as a graph and find strongly connected components (SCCs) to identify recursive dependencies
- Implement graph reduction scheme
- Model bytecode (and implement simple stack-based VM?)
- Implement REPL as bytecode interpreter
- Implement primitives in Rust/C along with stdlib/prelude
- Implement spineless tagless G-machine (STG)
- Implement compiler interface
- Add support for LLVM
- Implement documentation generation and integrate with doc comments
Some reading
The following may not necessarily be directly involved within the development of this compiler, but have proven nonetheless to be valuable sources of information.
- [1992] Simon Peyton Jones. Implementing lazy functional languages on stock hardware: the Spineless Tagless G-machine
- [2005] Daan Leijen. Extensible records with scoped labels
- [2010] The Haskell Community. The Haskell 2010 report
- [2013] Susan B. Horwitz. UW CS704 notes
- [2013] Dunfield and Krishnaswami. Complete and easy bidirectional typechecking for higher-rank polymorphism
- [2015] Stephen Diehl. Write you a Haskell
- [2020] Serrano, Have, Jones, Vytiniotis. A Quick Look at Impredicativity