This is a very early version of a programming language I'm currently working on.
It produces machine code and ELF binaries directly without using an external assembler or compiler.
git clone https://github.com/akyoto/q cd q go build
This will produce the
q compiler in your current directory.
./q build examples/hello ./examples/hello/hello
- No binary dependencies (not even libc)
- No compiler dependencies (no LLVM, no GCC, ...)
- No global state (all mutable variables are local)
- No classes or methods: There is just a) data and b) functions that can operate on data
- No name shadowing, names never change their meaning
- No side effects when importing a package
- Fast compilation (<1 ms for simple programs)
- Small binaries ("Hello World" is 247 bytes)
- High performance (compete with C and Rust)
- Contracts (reduce bugs at run time)
- Testing (reduce bugs at test time)
- Linting (reduce bugs at compile time)
- Format source code
- Packages should be highly reusable
- Statically typed with type inference
- User-friendly compiler messages
- Parallel function compiler
- Error messages
- Expression parser
- Function calls
- Detect pure functions
- Immutable variables
- Mutable variables via
- Variable lifetime tracking
- Exclude unused functions
requirefor input validation
ensurefor output validation
- Data structures
- Stack allocation
- Heap allocation
- Type system
- Type operator:
User | Error)
- Hexadecimal, octal and binary literals
- Error handling
- Cyclic function calls
- Lock-free data structures
- Multiple return values
- Expression optimization
- Assembly optimization
- Unused variables
- Unused parameters
- Unused imports
- Ineffective assignments
How do I navigate the source code?
- benchmarks contains tests for compilation speed
- build contains the actual compiler source
- cli contains the command line interface
- examples contains a few examples that are also used in tests
- lib contains the standard library
How do I run the tests?
go test -v ./...
How do I run the benchmarks?
go test -run=^$ -bench=. ./...
How do I view the produced assembly output?
q build -v examples/loops
How can I make a performance optimized build?
q build -O examples/loops
Is the syntax final?
No, the syntax will be changed in the future.
Which builtin functions are available?
There are currently 2 builtin functions,
syscall becomes the only builtin function.
Which editor can I use to edit Q code?
There is a simple VS Code extension with syntax highlighting.
git clone https://github.com/akyoto/vscode-q ~/.vscode/extensions/vscode-q
Is there a community for this project?
There is a Discord channel and a Telegram group for sponsors.
Please take a look at the style guidelines if you'd like to make a pull request.
|Cedric Fung||Scott Rayapoullé||Eduard Urbach|
Want to see your own name here?