Welcome to the documentation for OpenLanguage, a .NET library for parsing Microsoft Office document languages using GPLEX/GPPG-generated lexers and parsers.
- Formula Processing - SpreadsheetML formula parsing with AST generation
- Field Instructions - WordprocessingML field instruction parsing
- MergeField Processing - Mail merge field parsing
- Expression Processing - Expression parsing
- Build System - CMake build system with GPPG POSIX yacc parser generation and GPLEX POSIX lex lexer generation
- Grammar Files - Working with yacc and lex grammar files
- Testing - Unit test documentation
The API reference is generated from XML documentation comments in the source code.
| Component | Description | Documentation |
|---|---|---|
| Formula Parser | SpreadsheetML formula AST parsing | Formula.md |
| Field Instructions | WordprocessingML field instruction parsing | FieldInstruction.md |
| MergeField Parser | Mail merge field parsing | MergeField.md |
| Expression Parser | Expression parsing | Expression.md |
OpenLanguage consists of:
-
SpreadsheetML.Formula: SpreadsheetML formula parser using GPLEX/GPPG
- Formula.cs: Main API for parsing formulas into ASTs
- FormulaParser.cs: Static parser methods
- Lang/Lex/formula.lex: Lexical grammar for SpreadsheetML formulas
- Lang/Parse/formula.y: yacc grammar for SpreadsheetML formulas
-
WordprocessingML.FieldInstruction: WordprocessingML field instruction parser
- FieldInstruction.cs: Core field instruction and argument classes
- Typed/: Factory and base classes for strongly-typed instructions
- Parser.cs & Lexer.cs: Parser components
-
Other WordprocessingML Components:
- MergeField, Expression: Additional lexer components
The project uses CMake to process .y and .lex files with the C preprocessor (cpp) before compilation. Generated code is placed in the Generated/ directory.
Unit tests are located in OpenLanguage.Test/ and use xUnit framework. Tests cover:
- Formula parsing with various combinations of pattern cases
- Field instruction creation and manipulation
- Argument type validation
- AST reconstruction and round-trip testing
- 📖 View source code for implementation details
- 🐛 Issue Tracker
- 📧 Contact the maintainers through GitHub