Closed lublak closed 1 year ago
Hello, I am the author of lexertl and parsertl which are the underlying C++ libraries that parle uses. See http://www.benhanson.net/lexertl.html and http://www.benhanson.net/parsertl.html
lexertl::rules rules;
lexertl::state_machine sm;
rules.insert_macro("a", "a");
rules.insert_macro("b", "{a}b");
rules.push("{b}", 1);
lexertl::generator::build(rules, sm);
lexertl::debug::dump(sm, std::cout);
Gives:
Lexer state: 0
State: 0
[a] -> 1
State: 1
[b] -> 2
State: 2
END STATE, Id = 1, User Id = 65535, dfa = 0
See https://www.gnu.org/software/bison/manual/bison.html#Precedence for an explanation of the precedence functions.
@BenHanson ah thank you :) there are also more information available in bison. It helps allot.
So actually only RLexer and RParser remain. Btw good work :) to lexertl and parsertl. I find it strange that such libraries have relatively little appeal. You can realise so many things easier and mostly more readable with them.
Thanks for keeping it up! :) I mostly found some libs for JavaScript.
I first learned about lex and yacc (as it was back then) back in 1990. The techniques always seemed impressive, but the generated C code messy (this was before C++ was mainstream, at least in the Microsoft world). You can track my interest in making the tech available in an easier to digest format back to then.
At the time I also wondered why grep was limited to regular expressions. See https://www.codeproject.com/Articles/1197135/gram-grep-grep-for-the-21st-Century for my search tool allowing searching using lexers/parsers.
From my point of view the work should speak for itself, but it seems like only a few other people agree! Thanks for your interest.
Currently i miss some information about:
RLexer/RParser R stands for? How can I use the: insertMacro inside other regex? A small example to precedence? I don't know how it works and what I can do with it. Parser::left, Parser::right okay but: Parser::token vs Parser::nonassoc how token works? Is nonassoc standard?
(Mostly useful for beginners)