izuzak / noam

JavaScript library for working with automata and grammars for regular and context-free languages
http://ivanzuzak.info/noam/
Other
201 stars 32 forks source link

FSM Gym attempts to remove unbalanced parenthesis #26

Open mwberry opened 5 years ago

mwberry commented 5 years ago

Give the regex E((AT*S?)|(ST*A?))?T*Q to the Regex Gym and it reports the following simplification as the first step:

R1: E((AT*S?)|(ST*A?))?T*Q
Rule: ab(cd) => abcd
R2: E(AT*S?)|(ST*A?)?T*Q

I can't accurately represent the color coding it does on the page, but the colored parenthesis indicate it's trying to remove one of the first innermost left parenthesis and the outermost right parenthesis.

izuzak commented 5 years ago

Thanks for reporting this, @mwberry. Here's a screenshot of the behavior just to make it clearer what the problem is:

Screenshot 2019-03-25 at 20 40 57