Hi there,

I am looking at SDF for creating a new DSL like mobl. I have gone through all the documentation of SDF but haven’t found any docs explaining these kind of keywords.

Here is the cons used in the syntax:

"configuration" Setting* -> Start {cons("Configuration")}

Thank you in advance.
Bhushan

Submitted by Bhushan Firake on 19 June 2014 at 09:58

On 19 June 2014 at 10:24 Guido Wachsmuth commented:

Hi,

make sure to have a look at the documentation of SDF3.

"configuration" Setting* -> Start {cons("Configuration")}

is old SDF2 syntax. In SDF3, you should write this instead:

Start.Configuration = "configuration" Setting*

Essentially, the cons keyword specifies the constructor used in the abstract syntax.


On 19 June 2014 at 10:51 Bhushan Firake commented:

Hi Guido,

As far as I know, you have just made my statement to productive form. Previously, it was in reductive form.

Thank you for the explanation of cons. How and where will it be used as a constructor?


On 19 June 2014 at 11:34 Guido Wachsmuth commented:

Constructors are used in abstract syntax trees. Given a SDF grammar

Exp.Add = Exp "+" Exp {left}
Exp.Int = INT
Exp.Var = ID

parsing 3+x will result in Add(Int("3"), Var("x")).


On 13 July 2014 at 23:13 Guido Wachsmuth closed this issue.

Log in to post comments