Keeps track of:
- Reader state:
- Position
- Errors
- Reader Macros
- Readtable
Keeps track of:
- Analyzer state:
- Identifer bindings
- Import paths (do when needed)
- Errors
- 1st upgrade: Rc<str>
- 2nd: Cow<str> or custom indexing (no lifetimes required, I think)
Consumes a text stream, produces a form.
Untyped syntax tree, essentially.
Need to figure out what the fundamental variants here are.
Forms should provide span information, for compiler messages.
Possibly / Probably:
| List | Sequence of forms. |
| Atom |
Clojure’s model:
(def eval [form]
(-> form
macroexpand
analyze
execute)) ;; emit, etc.Takes in a form, produces a typed AST.
Wait, do macros need to be type checked before expansion? (probably, right?)
Forms a regular langauge of types.
Language primitives, the base alphabet Σ of the type langauge, the terminal symbols of it’s grammar.
The user cannot create new types of this family.
- Kleen Star
- Sum
- Product
Form concrete strings in the type language.
(TODO: thus the Kleen star is not present, correct?)
Global (+ some boundaries? At least by convention?).
Need to work out unification rules for axiomatic constructs. Pay attention to hazards outlined here. (find better/more resources)
Use fibers/coroutines when evaulating arbitrary (non-totality checked) code at compile time, such as reader macros, EPEG rewriters, constant functions, etc. That keeps any non-terminating code from blocking the compiler, and doesn’t require bailing out at an arbitrary timeout. Perhaps have some kind of ease-off (like in CAS loops) for when computations start taking too long, as it’s more likely they won’t terminate and we want to waste as little time as possible. Perhaps have a priority order for incremental computations that are making progress vs. ones that aren’t making observable progress.
Including parametricity over effects
Types: (rust-y syntax) Result<T, E = Error>
Creates Result<T> and Result<T, E>
How do they work? How do they interact with other features?
” ”
Start laying out a high-level design
;; how do namespaces/modules fit into this?
(-> String
InputStream
Form
AST- new-session
- Begins a new session. Server returns session token?
Header
| request | response |
| format | format |
|---|---|
| u8 | u8 |
- form
- (needs revision)
A list, identifier, or a number.
What else? Is this a bounded category?
Is there a ‘generalized object’ type of form?
- read
- Function that deserializes an object/form from a text stream.
- eval
- Evalutates an object/form.
The symbol table primarily facilitatesthe replacement of identifiers in the program with a primary key.
http://www.slideshare.net/Tech_MX/symbol-table-design-compiler-construction
AST - lexical; program elements referred to by textual name. ASG - “semantic”; program elements referred to by unique key.
- Be able to pass a closure to
assertto do something other than panic on failure
Use eqsat or something to shorten/idiomaticize source code
Will involve some pretty-printing
- syntax highlighting
- formatter
- error/warning reporting
- (symbols in scope/variants & methods of type) for autocomplete
- extensibilty system for this (i.e. plugins)
- create aliases for overloaded function variants
- documentation search engine
- Limit by scope (current ns, std lib, imported libs, etc.)
- Search item desctiptions as well as names and types
- fuzzy expression-shape searching
Polymorphic on host markup language?
- KWargs
(kw the-func map-or-struct-or-arg-pairs)whereclause- Desugars to a
let. (would have to be a reader macro, no?)
(+ a b c
where a 3
b 2
c (* a b))- Add/change variants to type
- similar with namespaces
- memotize a function
- make a recursive function use iteration+heap
Perhaps a generalized dependancy graph module?
Include incorporation of formatting info? (e.g. [color, style] spans?)
- code
- tables
- graphs
Ask user a question at each node, their answer directs them to a child. New answers can be added to the graph.