lives-group / APEG

2 stars 0 forks source link

The base parser as a state machine. #9

Closed emcardoso closed 6 years ago

emcardoso commented 6 years ago

Hello, guys ! Just an observation: We developed a descent recursive parser that is most close to the strategy of mouse. If we see a "too much complex" expression we create helper functions to deal with sub-expressions and then we build the parser to the whole expression on top of those. We could attempt a strategy more close to a state machine. So whenever a we a expression like e1 (e2/ e3)* e4 we could do something like this: e1(); do{ e2(); if(try_alternate()){ e3(); } }while(last_result_is_true); e4();

The main difference will be noticed on the number and size of functions generated. I don't know if there will be any impact on efficiency, but think it is worth to try ! Att. Elton M. Cardoso