Small refactoring of the general code and significantly reducing and simplifying of the example.
Change Log
- Rename types:
lexer::exception_group:- rename it to
type_group; - update the example;
- rename it to
parser::optional_offset:- rename it to
offset_optional.
- rename it to
- In the
parsermodule:- Add the list parser:
- implement it;
- cover it with tests;
- use it in the example.
- Remove the
empty_parserclass:- remove it;
- remove its tests.
- Unifying header for all parsers:
- implement it;
- use it in the example.
- In the tests:
- Improve tests:
- of the
repetition_parserclass; - of the
parse()function; - of the
parse_all()function.
- of the
- Refactor tests:
- of the
repetition_parserclass; - of the
parse_all()function.
- of the
- Improve tests:
- Add the list parser:
- In the
transformersmodule:- Add the
default_ast_node_handlersconstant:- implement it;
- use it:
- in the
parser::parse()function; - in the
parser::parse_all()function.
- in the
- Add the
transform()function for few handlers:- implement it;
- cover it with tests;
- use it in the
parser::parse()function.
- Add the
- In the example:
- Refactor:
- reduce a list of included headers;
- remove types:
constant_group;function_group;
- lexemes:
- fix a code style;
- built-in functions:
- use the
std::fmod()function for computing a division remainder; - fix a code style;
- fix the explanatory comment;
- use the
evaluate_ast_node()function:- make some functions local for it:
inspect_sequence()function;
- fix a code style;
- make some functions local for it:
main()function:- make some functions local for it:
stop()function;enrich_exception()function;
- fix a code style.
- make some functions local for it:
- Extend tests of errors:
- check unexpected entities:
- constants;
- functions;
- split tests to short and verbose:
- mark existing tests as a short version;
- add a verbose version of tests.
- check unexpected entities:
- Refactor:
Возможности
- лексинг ASCII-текста:
- задание лексем посредством регулярных выражений;
- возможность исключения токенов из результирующего списка;
- парсинг ASCII-текста:
- описание грамматики на EBNF непосредственно в коде программы (посредством DSL);
- результат:
- представление в виде:
- CST;
- AST;
- задание имени ноды в дереве;
- представление в виде:
- парсеры:
- терминальные:
- определённые:
- текст;
- лексема;
- определённые:
- комбинаторы:
- альтернатива (упорядоченная);
- объединяющие:
- следование;
- повторение:
- 0 или 1 раз (опциональность);
- 0 или больше раз;
- 1 или больше раз;
- любое число раз в указанном диапазоне;
- список с разделителем;
- проверяющие:
- исключение;
- просмотр вперёд:
- позитивный;
- негативный.
- терминальные:
Скриншоты
Лексический анализ
Синтаксический анализ

