From 412bd679f1bf49aaa2f2b461aaacf634dcd8505a Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Tue, 15 Dec 2020 21:58:07 -0800 Subject: [PATCH] feat: Provide grammar producing aterms with signature matching Chap 4 example. --- .gitignore | 1 + editor/Syntax.esv | 2 +- prop.spl | 1 + syntax/Spoofax-Propositional-Language.sdf3 | 24 +++++++++++++++++++--- 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 prop.spl diff --git a/.gitignore b/.gitignore index d0d8774..0735fdd 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /.factorypath /.polyglot.metaborg.yaml +*.aterm diff --git a/editor/Syntax.esv b/editor/Syntax.esv index 38f1bc9..3d65405 100644 --- a/editor/Syntax.esv +++ b/editor/Syntax.esv @@ -8,7 +8,7 @@ imports language table : target/metaborg/sdf.tbl - start symbols : Start + start symbols : Prop line comment : "//" block comment : "/*" * "*/" diff --git a/prop.spl b/prop.spl new file mode 100644 index 0000000..b90535e --- /dev/null +++ b/prop.spl @@ -0,0 +1 @@ +(1 -> 0) & 0 = p & 0 \ No newline at end of file diff --git a/syntax/Spoofax-Propositional-Language.sdf3 b/syntax/Spoofax-Propositional-Language.sdf3 index 29f5b91..50859a4 100644 --- a/syntax/Spoofax-Propositional-Language.sdf3 +++ b/syntax/Spoofax-Propositional-Language.sdf3 @@ -6,12 +6,30 @@ imports context-free start-symbols - Start + Prop context-free sorts - Start + Prop String context-free syntax - Start.Empty = <> + 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 \ No newline at end of file