# 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

- [x] tokeniser:
  - [x] various punctuation tokens
  - [x] keyword/identifier tokens
  - [x] number literals
  - [x] char literals
  - [x] 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] number literals
    - [x] char literals
    - [ ] string literals
    - [x] boolean literals
    - [ ] struct literals
    - [x] identifiers
    - [x] function calls 
    - [x] if expressions
- [ ] import/module system:
  - [x] dumb ignore (merge ast-s without any way to avoid redefiniton)
  - [ ] actual module system
- [ ] type system:
  - [x] signed and unsigned integers
  - [x] booleans
  - [x] 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
    - [ ] struct definitions
  - [x] expressions:
    - [x] logical operators ('not', 'and', 'or')
    - [x] comparison operators
    - [x] +, - operators
    - [x] *, / operators
    - [x] negation operator
    - [x] number literals
    - [x] char literals
    - [ ] string literals
    - [x] boolean literals
    - [ ] struct literals
    - [x] identifiers
    - [x] function calls 
    - [x] if expressions
- [ ] QBE IR generation:
  - [x] primitives and literals:
    - [x] map integer types to QBE types
    - [x] boolean literals
    - [x] char literals
  - [x] variable management
  - [x] expression translation:
    - [x] arithmetic operators
    - [x] comparison operators
    - [x] logical operator
    - [x] if-expression codegen
    - [x] function call argument handling
  - [x] control flow:
    - [x] basic block management for control structures
    - [x] if statements
    - [x] for loops with break/continue support
    - [x] return statement implementation
  - [x] functions:  
    - [x] basic function scaffolding (prologue/epilogue)
    - [x] parameter passing
    - [x] return value 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
  - [ ] debug
    - [ ] line number annotations for debugging