uCalc API Version: 5.7.0-preview.1 Released: 7/30/2026
Warning
uCalc API Preview Release Notice:This preview documentation describes the intended behavior of the API. It is not fully accurate or complete.The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.Use of the preview version in your production code is not recommended.
Product:
Compares uCalc's dynamic, runtime approach to language creation with the static, compile-time workflow of traditional parser generators like ANTLR.
For developers needing to build a parser for a custom language, traditional tools like ANTLR, Yacc/Bison, and Boost.Spirit are the industry standard. These are incredibly powerful parser generators that can create highly efficient parsers for virtually any language.
uCalc, while also a parser, operates on a fundamentally different philosophy. It is not a parser generator but an embeddable, dynamic parsing engine. This distinction has profound implications for workflow, flexibility, and use case.
This is the single most important difference:
Parser Generators (ANTLR, etc.): You define a language's grammar in a separate file (e.g., a .g4 file). An external tool processes this file to generate source code for a lexer and parser in your target language (C#, C++, etc.). You then compile this generated code into your application. The grammar is static and fixed at compile-time.
uCalc Engine: You interact with an existing parsing engine through a programmatic API. You define and modify the grammar—including tokens, functions, and operators—by calling methods at runtime. The grammar is dynamic and can be changed while your application is running.
| Feature | Parser Generators (ANTLR, etc.) | uCalc Engine |
|---|---|---|
| Workflow | Define grammar → Generate code → Compile | Write code that calls the uCalc API. |
| Extensibility | 🔴 Static. Changes require modifying the grammar file and recompiling. | 🟢 Dynamic. Define new syntax at runtime with API calls. |
| Integration | 🟡 Complex. Involves an external toolchain and managing generated files. | 🟢 Simple. It's just a library/dependency. No build steps. |
| Use Case | Building full compilers or parsers for complex, static languages. | Embedded expression evaluation, dynamic DSLs, user-configurable syntax. |
| Performance | 🟢 Very High. Generates optimized, special-purpose parsers. | 🟢 High. Optimized for expression evaluation, especially with the parse-once model. |
| Learning Curve | 🔴 Steep. Requires learning grammar notation and the generator's specific workflow. | 🟡 Moderate. Requires learning the uCalc API. |
This is uCalc's most significant advantage. With a parser generator, the language's syntax is frozen at compile time. To add a new keyword or operator, you must go through the entire generate-and-compile cycle.
The uCalc Solution
uCalc's grammar is fully mutable at runtime. Your application can:
This allows an application to adapt its own syntax on the fly, based on user configuration, different file dialects, or plugins. For more details, see the Dynamic Syntax topic.
Using a parser generator introduces an external dependency into your build process. You need to configure your build system to run the generator tool, and you must manage the generated source files, which should not be edited by hand. This adds complexity to your project.
The uCalc Solution
uCalc is simply a library. You add it as a dependency (e.g., via NuGet or vcpkg), and you interact with it entirely through its API. There is no code generation step and no external toolchain to manage. This results in a cleaner, more streamlined development workflow.
For all its advantages in dynamism, uCalc is not designed to replace tools like ANTLR for every task. A parser generator is the superior choice when:
Choose uCalc when your primary need is for an embedded, runtime-configurable engine for expression evaluation or for creating a lightweight, Domain-Specific Language (DSL) where flexibility and ease of integration are paramount.
Choose a parser generator when you need to build a complete compiler or a high-performance parser for a complex, statically-defined language.