You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For me it is misleading. I think there are two problems with it:
it allows just for single production, whereas it should accept a start symbol (which can expand to multiple productions)
it is a part of parser constructor, whereas (in formal grammar definition) start symbol/production is a part of grammar specification.
So I propose moving start symbol/production parameter to Grammar constructor and forbidding to specify it in Parser constructor.
There is start_symbol parameter for Grammar constructor, but it seems unused. (I may be unfamiliar with code and missed something.) The only place it is used is around parglare/grammar.py:861 where based on it AUGSYMBOL rule is inserted as a first production. But then parser uses production of index 1 as a default starting production, so it makes no sense to me.
The text was updated successfully, but these errors were encountered:
Implementation around start_production indeed needs a cleanup. It is a left-over that was not reworked completely. The initial idea for specifying start_production on the parser was to enable user to instantiate a parser for the part of the language, but I haven't had that use-case yet so not sure that we should support it at all. After introduction of table serialization it only complicates matter.
If the use case for instantiating parser for part of the language is viable, then it can be satisfied with start_symbol in Grammar constructor. User could take existing grammar and change start_symbol. But it needs to be implemented before ;)
For me it is misleading. I think there are two problems with it:
So I propose moving start symbol/production parameter to
Grammar
constructor and forbidding to specify it inParser
constructor.There is
start_symbol
parameter forGrammar
constructor, but it seems unused. (I may be unfamiliar with code and missed something.) The only place it is used is aroundparglare/grammar.py:861
where based on it AUGSYMBOL rule is inserted as a first production. But then parser uses production of index 1 as a default starting production, so it makes no sense to me.The text was updated successfully, but these errors were encountered: