A statically typed poggers Lisp in Lean. LISPoggers is an acronym for “Lisp Is Simply Poggers”.
- [ ] Data types
- [ ] Type constructors
- [ ] Lists
- [ ] Maps
- [ ] Pattern matching
- [ ] Functions
- [ ] Macros
Every structure can be represented by a data type, every datatype is represented by a map of dependencies and a list of constructors that hold types.
(data <dependencies>
(<constructor> <type>*)*)
Simplest datatype example:
(def Bool
(data {}
(false)
(true)))
I still need to think about its syntax:
(def Nat
(data {}
(zero)
(inc %))) ;; TODO: recursive datatype syntax
Generic datatypes receive its parameters as dependencies:
(def List
(data {a Type}
(empty)
(cons a (List a)))) ;; TODO: recursive datatype syntax
Runtime values exists and can be used on type level, so it can be used on datatypes definitions
(def Map
(data {k Type
v Type}
(empty)
(cons k v (Map k v)))) ;; TODO: recursive datatype syntax
(match <expr>
(<pattern> <expr>)
(<pattern> <expr>))
(match <expr>
(false <expr>)
(true <expr>))
(fn <param>
<param type>
<return type>
<expr>)
(<fn> <expr>)
;; as in
((fn foo
Bool
Bool
(not foo))
bar)
Basically the same as functions but it runs on compile time, so it also has access to types as values.
(macro <param>
<param type>
<return type>
<expr>)
(<macro> <expr>)
<expr> ::= <identifier> | <list> | <map>
<list> ::= "(" <divider> <expr> (<divider> <expr>)* <divider> ")"
<map> ::= "{" <divider> <expr> (<divider> <expr>)* <divider>"}"
<identifier> ::= ([a-z] | [A-Z])+
<divider> ::= (" " | "\n")*
flowchart TD
A[Raw Source Code] --> B[CST]
B --> C[AST]
C --> D[Macro Expansion]
D --> E[Source Compiled to KekwVM Bytecode]
C --> G[Type Checking Compiled to KekwVM Bytecode]
C -.- J[Types Checking Interpreter]
J --> K[Type Checking Evaluation]
K --> I[Source Type Tree]
flowchart TD
L[Source as Bytecode] --> M{KekwVM}
M{KekwVM} --> N[Code Execution]
O[Type Checking as Bytecode] --> M{KekwVM}
M{KekwVM} --> P[Type Tree]