sybila / eBCSgen

eBCSgen - BioChemical Space Language support tool.
https://ebcsgen.readthedocs.io/
MIT License
2 stars 4 forks source link

Reverting to BCSL Original Syntax: Implementing "::" #99

Closed mopichalova closed 5 months ago

mopichalova commented 5 months ago

To align with the original BCSL syntax, I replaced : with :: in the abstract syntax.

This also required switching the parser from LALR to Earley to handle the introduced ambiguity. This change comes with a trade-off resulting in slower parsing speeds. Adjustments were also made to tests and models to accommodate this change.

Close #98

xtrojak commented 5 months ago

Can you try to somehow quantify the slower parsing speeds?

mopichalova commented 5 months ago

Can you try to somehow quantify the slower parsing speeds?

I reviewed the last tests and the difference in parsing speeds is minimal. Unfortunately I cannot quantify the difference precisely. But I believe that in our case the difference does not have to be so severe. The grammar was initially designed for LALR parser so there was no ambiguity. By switching to the Earley parser to manage the :: ambiguity, I introduced only one ambiguity and the grammar remained otherwise unchanged so the Earley's performance should remain close to that of the LALR parser. Earley accepts ambiguity by exploring multiple parsing paths and the sole change should result in minimal increase in potential parse trees, therefore result in only a slight overhead with the Earley parser.