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

Minor syntax extensibility enhancement #117

Open
tedinski opened this issue Aug 21, 2018 · 2 comments
Open

Minor syntax extensibility enhancement #117

tedinski opened this issue Aug 21, 2018 · 2 comments

Comments

@tedinski
Copy link
Member

I was trying a small experiment, and please note I haven't thought this all the way through, that looks like this:

marking_terminal {
  custom_extension_syntax here;
  Declaration_c;
  etc etc;
}

Basically, extension syntax that allows its own declarations syntax to be along side plain C host declarations. This doesn't work, but only just.

I think we could make it work by moving the semicolon:

closed nonterminal Declaration_c with location, ast<ast:Decl>;
concrete productions top::Declaration_c
| ds::DeclarationSpecifiers_c  idcl::InitDeclaratorList_c  ';'
| ds::DeclarationSpecifiers_c  ';'


closed nonterminal ExternalDeclaration_c with location, ast<ast:Decl>; 
concrete productions top::ExternalDeclaration_c
| d::Declaration_c 
| d::FunctionDefinition_c 

If we put that semi-colon outside of Declaration_c (and so adding it wherever that nonterminal is used, like in ExternalDeclaration_c above), I think it works fine. Basically, the problem is right now we're spilling into the follow set of Declaration_c, but if we move the semicolon out, we avoid that. I don't think any of the other MDA restrictions would upset this scheme.

Any thoughts?

@krame505
Copy link
Member

Hmm, seems like a reasonable thing to want to do. I am fine with this change, although this will probably break a few of the tutorials and extensions.

@tedinski
Copy link
Member Author

Another thing to maybe do, if this works, is write up a very short bit of documentation for melt-website about "things to do to make syntax more extensible under the MDA." I think we've only ever written about this stuff in papers, and this sort of thing might be another item to add to the list. I don't recall having to do something like this before.

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

No branches or pull requests

2 participants