module Spoofax-Propositional-Language /** md: Title: Concrete Syntax ## Concrete Syntax The current Spoofax/Eclipse IDE is oriented around individual language projects. Therefore in order to work with ASTs of the SPL [abstract syntax](../README.md#abstract-syntax) that we just saw, it's easiest to define a concrete syntax for SPL, with the following SDF3 definition: *[SPL]: Spoofax Propositional Language ```sdf3 **/ imports Common context-free sorts Prop String context-free start-symbols Prop /** md (include the following code in the documentation) */ context-free syntax Prop.True = <1> Prop.False = <0> Prop.Atom = String Prop.Not = > Prop.And = < & > Prop.Or = < | > Prop.Impl = [[Prop] -> [Prop]] Prop.Eq = < = > Prop = <()> {bracket} String = ID context-free priorities Prop.Not > Prop.And > Prop.Or > Prop.Impl > Prop.Eq /* [stop to avoid the open-comment in the extracted markdown] **/ /** md [conclusion of the documentation] ``` Thus, the first two example AST expressions `A: {! examples/sec4.1_A.aterm !}` and `B: {! examples/sec4.1_B.aterm !}` from {! ../docrefs/sec4.1.md !} can be generated by the following much more compact SPL expressions: `A: {! examples/sec4.1_A.spl !}` and `B: {! examples/sec4.1_B.spl !}`. (If you are following along in the repository, you can visit the file `syntax/examples/sec4.1_A.spl` (or ...`_B.spl`) and from the Spoofax menu select "Syntax > Show parsed AST" to see the AST generation in action.) This concrete syntax actually makes it easier to construct the example expressions used throughout the tutorial manual as examples for Stratego processing. **/