+++ title = "Getting Started" description = "Install MLF and write your first lexicon" weight = 1 +++ ## Installation Clone and build from source: ```bash git clone https://tangled.org/@stavola.xyz/mlf cd mlf cargo build --release ``` The binary will be at `target/release/mlf`. Optionally, install to your PATH: ```bash # Option 1: Use cargo install cargo install --path mlf-cli # Option 2: Manually copy the binary cp target/release/mlf /usr/local/bin/ ``` ## Your First Lexicon Create a file `thread.mlf`: ```mlf /// A forum thread record thread { /// Thread title title!: string constrained { maxLength: 200, minLength: 1, }, /// Thread body body!: string constrained { maxLength: 10000, }, /// Thread creation timestamp createdAt!: Datetime, } ``` ## Generate JSON Lexicon ```bash mlf generate lexicon -i thread.mlf -o lexicons/ ``` This creates `lexicons/com/example/thread.json` with the ATProto JSON lexicon. ## Validate MLF Files ```bash mlf check thread.mlf ``` This checks your MLF file for syntax and validation errors. ## Validate Records Given a JSON record file `record.json`: ```json { "title": "Welcome to the forums!", "body": "This is my first thread. Looking forward to discussions!", "createdAt": "2024-01-15T10:30:00Z" } ``` Validate it against your lexicon: ```bash mlf validate thread.mlf record.json ``` ## Convert JSON Lexicons to MLF Already have ATProto JSON lexicons? Convert them to MLF format: ```bash mlf generate mlf -i my-lexicon.json -o ./ ``` This is useful for: - Migrating existing lexicons to MLF - Learning MLF syntax by seeing JSON conversions - Working with lexicons from other sources ## Next Steps - Read the [Language Guide](./language-guide/) to learn the MLF language - Check out the [CLI Reference](./cli.md) for all commands - Try the [WASM API](./wasm.md) to use MLF in the browser