top of page

Lexical Analysis and Parsing

By combining a lexer that tokenizes raw text with a parser that applies a formal grammar, you can write your own JSON or XML parsing library rather than relying on a fixed, general-purpose implementation.


The provided JSON and XML examples are complete, working libraries that you can modify, extend, and optimize to match your data model, memory strategy, validation rules, and performance requirements.

Lexical Scanner Utility

Designed to support custom JSON and XML libraries, this scanner converts raw text into a stream of meaningful tokens for higher-level parsers.  It is compatible with Flex syntax and extends it with robust Unicode handling and escape-sequence support, making it well suited for writing modern, internationalized data-format parsers that you control end-to-end.

Parser Generator Utility

Designed for building custom JSON and XML libraries, this tool generates parsing code from formal grammar specifications, transforming token streams into structured representations defined by your data model.  It is compatible with Bison syntax, integrates cleanly with the lexical scanner, and supports clear, maintainable grammars that you can modify to implement your own validation rules, error handling, and parse-tree structures.

JSON Library

This JSON library is built from a formal grammar and generated parsing code, illustrating how to implement a custom JSON parser in C.  It is fully functional as a standalone library and can be adapted to support different memory models, validation strategies, and application-specific extensions.

XML Library

This XML library is built from a complete XML grammar and generated parsing code, illustrating how to implement a custom XML parser in C. It provides a compact, standards-compliant foundation that can be extended or specialized for application-specific document models and performance requirements.

bottom of page