Cookbook
Self-contained examples that put the reference pages to work. The first two build a complete language end to end — lexer, parser, and evaluation. The third is a focused recipe on top of BrainFuck>.
- Expression Evaluator — a math evaluator with arithmetic, exponentiation, unary minus, parentheses, constants, and functions. Focus: operator precedence and the
before/afterconflict-resolution DSL. - JSON Parser — objects, arrays, strings, numbers, booleans, and null. Focus: recursive rules, separator-delimited lists, backtick-quoted token names.
- Contextual Lexing — errors that point at their source: bracket depth and positions tracked by the lexer, reported by the parser. Focus: custom
LexerCtx/ParserCtxworking together. - Common Problems — the compile errors and surprises people hit most often, each with a fix.
New to Alpaca? Start with Getting Started, which walks through the BrainFuck interpreter step by step.
In this article
