# Generate Gleam
Gleam code generator in Gleam.
See tests for examples of usage.
## Maturity
Not generally usable.
Yet, used this code (with a few usages of `direct(String)`) to generate Gleam Code to solve the [Dec 19, 2023 puzzles of Advent of Code](https://adventofcode.com/2023/day/19), some 3000 resp. 4000 lines of Gleam for the 523 rules in my input.
# TODO
- [ ] extract some `OuterStatement` for imports, type defs and function defs, so we can generate a whole file, and eventually, multiple files
- [ ] define types/functions for imports, so usage can, in principle, be type-checked
- [ ] add functionality for `use`
- [ ] add functionality for operators
- [ ] add functionality for @external
- [ ] add functionality for private types and functions
- [ ] support for base types: string, tuple, ...
- [ ] support for proper, nested pattern matching, e.g. `VariantPattern("Ok", [VariablePattern("x")])` even better if we get a `VariableStatement("x")` returned (prolly in hierarchy), that we can use in the subsequent statements.
- [ ] add helpers prelude types and functions
- [ ] add helpers stdlib types and functions
- [ ] add functionality for ...
## Done
- [x] Construct a basic AST, supporting type definitions, case statements and function definitions
- [x] generate Gleam code from that AST
### Types
- [x] Nil
- [x] Int
- [x] Variant type
- [x] Parametrized type e.g. `a` in `List(a)`
- [x] Function type
### Pattern matching
- [x] literal constants (bit blunt)
- [x] let array
- [x] let tuple
### Statements
- [x] instances of nil, int, variants, tuples
- [x] case
- [x] function
### Prelude
- [x] Boolean
- [x] Result
### StdLib
- [x] Dict