What is the mechanism in Spoofax w/ Core for accessing language properties such as language name, start symbol, file extension. The requirement appears for example when generated code embeds/depends on these properties.

Submitted by Vlad Vergu on 9 February 2016 at 10:14

On 9 February 2016 at 10:27 Gabriël Konat commented:

You can get these by querying Spoofax Core in Java (external) strategies. You get the Metaborg context as follows: https://github.com/metaborg/spt/blob/new-spoofax-plugin/org.metaborg.meta.lang.spt/editor/java/org/metaborg/meta/lang/spt/strategies/plugin_strategy_invoke_0_2.java#L37. From the context you can get to the current language which has the name of the language, and facets with other information. The start symbol can be retrieved from getting the SyntaxFacet of the language. The extension from the ResourceExtensionFacet facet.

On 12 February 2016 at 12:54 Gabriël Konat closed this issue.

Log in to post comments