see the title. For a small tool I am writing I wanted to introduce a simple boolean filter language and decided to do that "properly" and use a parser-generator. After playing around with grako a bit I found I like it and got the filter-language done fairly quick (which is also nice :))
The problem is now, if I want to use the tool on other computers or give it to other people I first have to somehow make grako available there, which is a bit bothersome, because everything else is standard python3 stuff.
I guess it is possible by co-packaging the necessary grako-classes, but that seems a bit messy (licensing would be mentioned in any way). Maybe I have overlooked some built-in method.
The short answer is No.
Grako-generated parsers do require the
grakolibrary.For example:
All the
self._xyz()come from eithergrako.contexts.ParseContextorgrako.parsing.Parser. The backtracking, caching, and the book-keeping required are all hidden behind context managers and decorators.Having generated parsers depend on
grakowas a design choice aimed at making the parsers smaller and easier to understand, which was one of the primary objectives of the project (as there are many otherwise-great parser generators that produce obfuscated code).The other option was to copy the code that the generated parsers could depend on onto each parser, but that seemed a bit unpythonic.