Mirror of the Rel4tion website/wiki source, view at <http://rel4tion.org>
Clone
HTTPS:
git clone https://vervis.peers.community/repos/yEzqv
SSH:
git clone USERNAME@vervis.peers.community:yEzqv
Branches
Tags
parsing.mdwn
Purpose
Design the file parser architecture from the bottom up.
Plan
Assume I have an event-driven sequential access YAML parser, like the SAX parser for XML.
On top of that, I implement a wrapper specific for my language here, which works in the same way: sequential access and callbacks.
On top of that, I implement a parser which reads a file into an in-memory structure, like a DOM parser for XML. It is implemented using the SAX-like parser, with callbacks that I write which gradually fill the structure and build a graph.
One of the above two is also then used as a basis for a parser which reads a file and writes into a semantic database.
The SAX-like process can be implemented in three levels:
- A class template, where callbacks are template parameters (can be lambdas, functors, function pointers, etc.)
- Callbacks are std::function (like slots in gtkmm/sigc++), can be an instantiation of the above template
- OOP wrapper where callbacks are virtual functions, like the SAX parser in libxml++
Summary
SAX-like parser for YAML
SAX-like parser for Idan
Template with callbacks as parameters
Callbacks are std::function slots
OOP wrapper with callbacks as virtual functions
DOM-like parser which reads into in-memory model
Parser which reads file definitions into semantic database