Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSTA: small inconsistency wrt to yacc behaviour #18

Open
rofl0r opened this issue Nov 29, 2019 · 1 comment
Open

MSTA: small inconsistency wrt to yacc behaviour #18

rofl0r opened this issue Nov 29, 2019 · 1 comment

Comments

@rofl0r
Copy link
Contributor

rofl0r commented Nov 29, 2019

bison and byacc both assign default action { $$ = $1; } to expression as below:

mnemonic: MN_JMP
 | MN_JZ
 | MN_JNZ
 ;

so that the result is identical to

mnemonic: MN_JMP { $$ = $1; }
 | MN_JZ   { $$ = $1; }
 | MN_JNZ   { $$ = $1; }
 ;

MSTA instead (even in yacc mode) creates different, incompatible (and quite big) piece of code for every line in the expression.
i'm not sure whether this is documented behaviour, but it'd be nice to have it supported when using MSTA as yacc replacement.

@vnmakarov
Copy link
Member

OK. Thanks for reporting this. I designed this code 30 years ago and there are a lot of optimizations in the parser, especially for rule reductions and attribute passing. So the code you see might be an optimized version of the code for parsing by several rules. I'll investigate this when I have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants