MetaBorgCube / declare-your-language

a book about declarative language definition
23 stars 7 forks source link

BNFC to/from SDF? #1

Closed nobeh closed 9 years ago

nobeh commented 9 years ago

Spoofax development requires one to provide the language syntax through one of the versions of SDF (the latest SDF3). Is there any tool or support to be able to have conversion between BNFC to SDF3 or vice versa? The argument is that if a community has built tooling around a different of syntax specification, it would be very convenient if Spoofax or other tools could support converting current existing syntax definitions to/from SDF. I understand there might be limitations/compatibility issues between different types of syntax definitions.

Specifically, I am interested to see if we can have conversion from/to BNFC and SDF.

eelcovisser commented 9 years ago

Here you go http://eelcovisser.org/post/284; that's a conversion from LBNF to SDF3.

nobeh commented 9 years ago

Thank you for the work on this. I just worked out of the box. A little bit of more context of what I am trying to achieve here ...

In the context of http://www.envisage-project.eu we're working with ABS language which is a modelling language for concurrent objects and systems. As part of our tooling and development, we have developed a LBNF grammar for ABS which is used by different community members and means we cannot easily move/migrate one-time to SDF.

Now, regarding your example project, is there a way I can run the conversion using a Maven module/ANT build without having the whole-stack Spoofax IDE?

The intention is to separate a module that just converts our LBNF grammar to SDF. And, then we use SDF grammar to develop our tool suite based on Spoofax.

Thanks.

eelcovisser commented 9 years ago

I don't quite understand what you are looking for. Can you clarify?

If your intention is to convert your LBNF grammar to SDF3 in order to then use Spoofax to develop tooling for your language, why is it a problem if the LBNF convertor is an Eclipse project?

nobeh commented 9 years ago

I did not mean that there's a problem with having an eclipse project to do the conversion. The original concern was that there might be different IDE/tooling for ABS for different target languages (e.g. Haskell / Java) and not all of them might build the same IDE (which is questionable). That's why I was thinking of having a standalone tool to do the conversion. I think I will hold this back for a while until otherwise we are able to have clearer requirements. Thanks.

eelcovisser commented 9 years ago

Right. But the conversion from BNFC to SDF3 is just a starting point for converting a language project to use Spoofax. The resulting grammar will probably need to be massaged to make it into prettier SDF3. And then the rest of the language implementation should be developed with Spoofax' other meta-languages. So, it will not be a conversion that you would automatically apply in a build farm.