-
Notifications
You must be signed in to change notification settings - Fork 1
Description
I favor a contract-first development approach for DumbQL. The query language grammar defines the parser, generated using the Pigeon tool. However, the generated parser code lacks readability and control. Therefore, I propose two alternative solutions to improve this aspect:
First, we could develop our own Parsing Expression Grammar (PEG) parser generator. This would give us complete control over the generated code's structure and functionality. A PEG parser is a type of parser that uses a recursive descent approach, allowing for a more concise and efficient parser compared to other methods like LL or LR parsers. This allows for significant flexibility in design and allows for optimizations that would not be available using the existing generated code.
Second, as a more hands-on approach, we could write a lexer and parser manually. This provides even finer control over the parsing process, but at the cost of flexibility and increased development time. A lexer (or lexical analyzer) breaks down the input text into a stream of tokens, representing individual words or symbols. The parser then uses these tokens to build a parse tree which can then be used to analyze and evaluate the DumbQL queries.