dir parser/
dir shared/
dir tokeniser/
dir typechecker/
file go.mod
file grammar
file LICENSE
file main.go
file README.md
file test.qk

README.md

# quokka

this is my work in progress programming language targeting the [QBE backend](https://c9x.me/compile/)

as this is my first language i aim for:
- no crazy/revolutionary new features
- simple type system
- modern and clean syntax inspired by rust and go

you can find the language specification in [the `grammar` file](./grammar) or look at the current example i have comitted in [`test.qk`](./test.qk)

## roadmap

- [ ] tokeniser:
  - [x] various punctuation tokens
  - [x] keyword/identifier tokens
  - [x] number literals
  - [ ] char literals
  - [ ] string literals
  - [x] boolean literals (true, false)
- [ ] parser:
  - [ ] statements:
    - [x] import statements
    - [x] function definitons
    - [x] variable declarations
    - [x] assigment/increment/decrement/... statements
    - [x] if statements
    - [x] for loops
    - [x] break, continue keywords
    - [x] return keyword
    - [ ] struct definitions
  - [x] expressions:
    - [x] logical operators ('not', 'and', 'or')
    - [x] comparison operators
    - [x] +, - operators
    - [x] *, / operators
    - [x] negation operator
    - [x] all elsewhere supported type literals
    - [x] identifiers
    - [x] function calls 
    - [x] if expressions
- [ ] import/module system:
  - [ ] imports by simple inclusion by filepath during parse time
  - [ ] rewrite solution to use a module system:
    - [ ] resolve imports after parsing
    - [ ] flatten symbols
- [ ] type system:
  - [x] signed and unsigned integers
  - [x] booleans
  - [ ] chars
  - [ ] strings and cstrings
  - [x] void for function return types
  - [ ] structs
- [x] typechecker:
  - [x] statements:
    - [x] function definitons
    - [x] variable declarations
    - [x] assigment/increment/decrement/... statements
    - [x] if statements
    - [x] for loops
    - [x] break, continue keywords
    - [x] return keyword
  - [x] expressions:
    - [x] logical operators ('not', 'and', 'or')
    - [x] comparison operators
    - [x] +, - operators
    - [x] *, / operators
    - [x] negation operator
    - [x] all elsewhere supported type literals
    - [x] identifiers
    - [x] function calls 
    - [x] if expressions
- [ ] QBE IR generation:
  - [ ] primitives and literals:
    - [ ] map integer types to QBE types
    - [ ] boolean literals
    - [ ] char literals
  - [ ] variable management:
    - [ ] local variable allocation (registers/stack)
    - [ ] global variable initialization
    - [ ] handle SSA form for mutable variables
    - [ ] assignment operations with type-appropriate stores
  - [ ] expression translation:
    - [ ] arithmetic operators
    - [ ] comparison operators
    - [ ] logical operators via branching
    - [ ] if-expression codegen (via phi nodes)
    - [ ] function call argument handling
  - [ ] control flow:
    - [ ] basic block management for control structures
    - [ ] if statements
    - [ ] for loops with break/continue support
    - [ ] return statement implementation
  - [ ] functions:  
    - [ ] basic function scaffolding (prologue/epilogue)
    - [ ] parameter passing (register/stack ABI compliance)
    - [ ] return value management
    - [ ] external function declarations
    - [ ] stack frame management
  - [ ] composite types:
    - [ ] struct field access (offset calculations)
    - [ ] nested struct support
  - [ ] strings:
    - [ ] string literals in data section
    - [ ] c-string null termination
    - [ ] pointer arithmetic for array/string access
  - [ ] optimizations:
    - [ ] dce 
    - [ ] constant propagation
    - [ ] loop invariant code motion
  - [ ] debug
    - [ ] line number annotations for debugging