# @luvio/compiler

## Purpose

The Luvio Compiler package is the main code generator for API clients. It uses a two-phased approach to code generation.

1. Parsing
   - We take a RAML file and [parse it](./src/parser/main.ts) using [AMF](https://a.ml/docs/amf/using-amf/amf_parsing/) and our own custom annotations into an intermediate representation called [ModelInfo](./src/intermediate/model-info.ts);
2. Code Generation
   - We take the `ModelInfo` and we use it to inform generation of Typescript Api Clients. The code generator is designed to be somewhat composable, so the caller can decide which pieces of the `ModelInfo` they'd like to have generated by providing different "Source Writers" to the compiler. This is all coordinated by the [LuvioRamlCompiler](./src/compiler/raml-compiler.ts).
   - The main transformation from pieces of `ModelInfo` to the actual Typescript code happens in [codegen](./src/codegen/).
