piq (/piːk/) is a fast, minimal, statically typed, easily bootstrappable,
compiled programming language. It is written piq
, with a lowercase p
,
because this has a nice symmetry. If it doesn't look symmetrical to you,
consider changing your font.
The language is fast. It's close to the metal, there's no indirection.
The compiler is fast. The single-threaded performance is currently at about 170_000 sloc/s on my laptop.1
The compiler itself is fast to compile.2
The piq syntax is a direct representation of the AST, where all compound
constructs have an introducer keyword, and are parenthesized. For example (if cond a b)
for ternary expressions, and (fn () 3)
for lambdas.3 This is
easy to parse, for humans and computers, without backtracking.
All piq types are known at compile time. It has full type inference, so if you have enough type constraints in your compilation unit such that there is only one solution, the compiler will be satisfied.
It currently has working LLVM codegen, with JIT'd code running in our test suites, but the plan is to support libgccjit and others.
The piq stage0 compiler is written in C99.4 This is currently the only compiler.
Please see the (incomplete) usage guide.
- Tokenizer
- Parser
- Name Resolution
- Typecheck/inference
- Codegen (llvm)
- Function declarations
- Let bindings
- Function calls
- Builtin types
- Type parameters
- If statements
- Pattern matching
- Custom datatypes
- Mutation
- References
- C FFI
- Generics
- Syscall wrappers
- Malloc/free replacements
- A name
- Compilation multithreading
- A compiler perf tracking website5
- Package management
- A good logo
Footnotes
-
This is on laptop with an AMD Ryzen 5 5625U. The compiler performance can be greatly improved by multi-threading, and by a tonne of optimizations I haven't yet had time to implement. ↩
-
Takes about 3.4 seconds on my laptop. This can be improved, see 4. ↩
-
The current tuple syntax doesn't follow this rule, but this is a bug I will fix soon. ↩
-
There's a smidgen of C++, written because LLVM's C interface is missing a feature I want. This is trivial to get rid of, but requires a malloc somewhere to do so, so I haven't brought myself to 🔥 do it yet. ↩ ↩2
-
There was one here but I need to update it to use a benchmark-specific machine with a fixed clock speed. ↩