Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfjouault2013-12-18 17:23:55 +0000
committerfjouault2013-12-18 17:23:55 +0000
commit65b0671d4f5d0907029e1974c39e5dad4ffad691 (patch)
tree0de5dbf66d69f19c467de658fbb468031a3e5ec3 /syntaxes
downloadorg.eclipse.atl.tcs-65b0671d4f5d0907029e1974c39e5dad4ffad691.tar.gz
org.eclipse.atl.tcs-65b0671d4f5d0907029e1974c39e5dad4ffad691.tar.xz
org.eclipse.atl.tcs-65b0671d4f5d0907029e1974c39e5dad4ffad691.zip
initial commit of approved contribution (see bug 417707)
This version needs refactoring (notably package names) as well as porting to current version of ATL
Diffstat (limited to 'syntaxes')
-rw-r--r--syntaxes/FIACRE/.externalToolBuilders/FIACRE DSL Builder.launch30
-rw-r--r--syntaxes/FIACRE/Compiler/FIACRE2LOTOS.atl920
-rw-r--r--syntaxes/FIACRE/Compiler/FIACRE2LOTOS.xml79
-rw-r--r--syntaxes/FIACRE/Compiler/FIACRE2LOTOS.xml.launch16
-rw-r--r--syntaxes/FIACRE/Metamodel/FIACRE.ann2
-rw-r--r--syntaxes/FIACRE/Metamodel/FIACRE.km3331
-rw-r--r--syntaxes/FIACRE/Samples/Simple_array.fcr1
-rw-r--r--syntaxes/FIACRE/Samples/Simple_enum.fcr1
-rw-r--r--syntaxes/FIACRE/Samples/Simple_interval.fcr1
-rw-r--r--syntaxes/FIACRE/Samples/Simple_record.fcr1
-rw-r--r--syntaxes/FIACRE/Syntax/FIACRE.tcs542
-rw-r--r--syntaxes/FIACRE/build.properties2
-rw-r--r--syntaxes/FPath/.project22
-rw-r--r--syntaxes/FPath/Metamodel/FPath.km394
-rw-r--r--syntaxes/FPath/Samples/README.txt1
-rw-r--r--syntaxes/FPath/Samples/Test1.fp1
-rw-r--r--syntaxes/FPath/Samples/Test2.fp1
-rw-r--r--syntaxes/FPath/Samples/Test3.fp1
-rw-r--r--syntaxes/FPath/Samples/Test4.fp1
-rw-r--r--syntaxes/FPath/Samples/Test5.fp1
-rw-r--r--syntaxes/FPath/Syntax/FPath.tcs304
-rw-r--r--syntaxes/FPath/build.properties2
-rw-r--r--syntaxes/FScript/.project22
-rw-r--r--syntaxes/FScript/Metamodel/FScript.km3150
-rw-r--r--syntaxes/FScript/Samples/README.txt1
-rw-r--r--syntaxes/FScript/Samples/Test1.fs13
-rw-r--r--syntaxes/FScript/Syntax/FScript.tcs349
-rw-r--r--syntaxes/FScript/build.properties2
-rw-r--r--syntaxes/Kmelia/.project22
-rw-r--r--syntaxes/Kmelia/Metamodel/Kmelia.km397
-rw-r--r--syntaxes/Kmelia/Syntax/Kmelia.tcs292
-rw-r--r--syntaxes/Kmelia/build.properties2
-rw-r--r--syntaxes/LOTOS/.project22
-rw-r--r--syntaxes/LOTOS/Metamodel/LOTOS.ann2
-rw-r--r--syntaxes/LOTOS/Metamodel/LOTOS.km3224
-rw-r--r--syntaxes/LOTOS/Samples/README.txt2
-rw-r--r--syntaxes/LOTOS/Syntax/LOTOS.tcs425
-rw-r--r--syntaxes/LOTOS/build.properties2
-rw-r--r--syntaxes/MSRT/.project22
-rw-r--r--syntaxes/MSRT/Metamodel/MSRT.km340
-rw-r--r--syntaxes/MSRT/Sample/sample.msrt11
-rw-r--r--syntaxes/MSRT/Syntax/MSRT.tcs239
-rw-r--r--syntaxes/MSRT/build.properties2
-rw-r--r--syntaxes/Program/.project22
-rw-r--r--syntaxes/Program/Metamodel/Program.ann2
-rw-r--r--syntaxes/Program/Metamodel/Program.km3134
-rw-r--r--syntaxes/Program/Samples/AlarmClock/AlarmClock.pgrm25
-rw-r--r--syntaxes/Program/Samples/IOStream/IOStream.pgrm28
-rw-r--r--syntaxes/Program/Samples/ReadersAndWriters/ReadersAndWriters.pgrm41
-rw-r--r--syntaxes/Program/Samples/SingleResource/SingleResource.pgrm20
-rw-r--r--syntaxes/Program/Syntax/Program.tcs320
-rw-r--r--syntaxes/Program/build.properties2
-rw-r--r--syntaxes/SPL/.project22
-rw-r--r--syntaxes/SPL/Metamodel/SPL.ann2
-rw-r--r--syntaxes/SPL/Metamodel/SPL.km3534
-rw-r--r--syntaxes/SPL/Samples/SimpleForward.spl11
-rw-r--r--syntaxes/SPL/Syntax/SPL.tcs704
-rw-r--r--syntaxes/SPL/build.properties2
-rw-r--r--syntaxes/SQLDDL/.externalToolBuilders/SQLDDL Language Builder.launch32
-rw-r--r--syntaxes/SQLDDL/.project27
-rw-r--r--syntaxes/SQLDDL/Metamodel/SQLDDL.ann2
-rw-r--r--syntaxes/SQLDDL/Metamodel/SQLDDL.km3101
-rw-r--r--syntaxes/SQLDDL/Samples/SPL.sql622
-rw-r--r--syntaxes/SQLDDL/Syntax/SQLDDL.tcs235
-rw-r--r--syntaxes/SQLDDL/build.properties2
-rw-r--r--syntaxes/Scatter/.project22
-rw-r--r--syntaxes/Scatter/Metamodel/Scatter.ann2
-rw-r--r--syntaxes/Scatter/Metamodel/Scatter.km398
-rw-r--r--syntaxes/Scatter/Samples/Car.refresh23
-rw-r--r--syntaxes/Scatter/Syntax/Scatter.tcs275
-rw-r--r--syntaxes/Scatter/build.properties2
-rw-r--r--syntaxes/XML2/.externalToolBuilders/XML2 Language Builder.launch32
-rw-r--r--syntaxes/XML2/.project27
-rw-r--r--syntaxes/XML2/Metamodel/XML2.ann2
-rw-r--r--syntaxes/XML2/Metamodel/XML2.km344
-rw-r--r--syntaxes/XML2/Samples/Test.xml29
-rw-r--r--syntaxes/XML2/Samples/XML2.xml233
-rw-r--r--syntaxes/XML2/Syntax/XML2.tcs204
-rw-r--r--syntaxes/XML2/build.properties2
-rw-r--r--syntaxes/XPath/.externalToolBuilders/XPath Language Builder.launch32
-rw-r--r--syntaxes/XPath/.project27
-rw-r--r--syntaxes/XPath/Interpreter/XPathEvaluator.atl177
-rw-r--r--syntaxes/XPath/Metamodel/XPath.ann2
-rw-r--r--syntaxes/XPath/Metamodel/XPath.km3177
-rw-r--r--syntaxes/XPath/Samples/README.txt3
-rw-r--r--syntaxes/XPath/Samples/Test1.xpath1
-rw-r--r--syntaxes/XPath/Samples/Test2.xpath2
-rw-r--r--syntaxes/XPath/Samples/Test22.xpath2
-rw-r--r--syntaxes/XPath/Samples/Test23.xpath2
-rw-r--r--syntaxes/XPath/Samples/Test24.xpath2
-rw-r--r--syntaxes/XPath/Samples/Test3.xpath1
-rw-r--r--syntaxes/XPath/Samples/Test32.xpath1
-rw-r--r--syntaxes/XPath/Samples/Test4.xpath1
-rw-r--r--syntaxes/XPath/Samples/Test5.xpath1
-rw-r--r--syntaxes/XPath/Samples/Test6.xpath1
-rw-r--r--syntaxes/XPath/Samples/Test7.xpath1
-rw-r--r--syntaxes/XPath/Samples/Test8.xpath1
-rw-r--r--syntaxes/XPath/Samples/Test9.xpath1
-rw-r--r--syntaxes/XPath/Syntax/XPath.tcs364
-rw-r--r--syntaxes/XPath/build.properties2
100 files changed, 8761 insertions, 0 deletions
diff --git a/syntaxes/FIACRE/.externalToolBuilders/FIACRE DSL Builder.launch b/syntaxes/FIACRE/.externalToolBuilders/FIACRE DSL Builder.launch
new file mode 100644
index 0000000..675e93a
--- /dev/null
+++ b/syntaxes/FIACRE/.externalToolBuilders/FIACRE DSL Builder.launch
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/AMMAScripts/build.dsl.xml"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,clean"/>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="AMMAScripts"/>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_CLEAN_TARGETS" value="clean,"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
+<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/FIACRE}"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.ant.ui.classpathentry.antHome&quot;&gt;&#13;&#10;&lt;memento default=&quot;true&quot;/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.ant.ui.classpathentry.extraClasspathEntries&quot;&gt;&#13;&#10;&lt;memento/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/AMMAScripts/libs/antlr.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/AMMAScripts/libs/antlr-3.0.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/AMMAScripts/libs/antlr3-ant.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/AMMAScripts/libs/stringtemplate-3.0.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/AMMAScripts/build.dsl.xml}"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+</launchConfiguration>
diff --git a/syntaxes/FIACRE/Compiler/FIACRE2LOTOS.atl b/syntaxes/FIACRE/Compiler/FIACRE2LOTOS.atl
new file mode 100644
index 0000000..c0fe5c7
--- /dev/null
+++ b/syntaxes/FIACRE/Compiler/FIACRE2LOTOS.atl
@@ -0,0 +1,920 @@
+-- @atlcompiler atl2006
+module FIACRE2LOTOS;
+create OUT : LOTOS from IN : FIACRE;
+
+rule Program2Specification {
+ from
+ s : FIACRE!Program
+ to
+ t : LOTOS!Specification (
+ name <- 'unnamed',
+ types <- s.elements->select(e |
+ e.oclIsKindOf(FIACRE!TypeDeclaration)
+ ),
+ definition <- definition,
+ commentsBefore <- Sequence {
+ '(* ---------------------------------------------------------------------------- *)',
+ '(* Author: FIACRE2LOTOS.atl *)',
+ '(* Automatically generated code *)',
+ '(* ---------------------------------------------------------------------------- *)'
+ }
+ ),
+ definition : LOTOS!Definition (
+ declarations <- s.elements->select(e |
+ e.oclIsKindOf(FIACRE!ProcessDeclaration) or
+ e.oclIsKindOf(FIACRE!ComponentDeclaration)
+ )
+ )
+}
+
+rule Process {
+ from
+ s : FIACRE!ProcessDeclaration
+ to
+ t : LOTOS!Process (
+ name <- s.name,
+ commentsBefore <- Sequence {'(* TODO: implement Process translation rules *)'}
+ )
+}
+
+rule Component {
+ from
+ s : FIACRE!ComponentDeclaration
+ to
+ t : LOTOS!Process (
+ name <- s.name,
+ commentsBefore <- Sequence {'(* TODO: implement Component translation rules *)'}
+ )
+}
+
+
+abstract rule TypeTranslation {
+ from
+ s : FIACRE!TypeDeclaration
+ to
+ t : LOTOS!TypeDefinition (
+ name <- s.name,
+ sorts <- Sequence {s.name} -- TODO: implementedby
+ ),
+
+ ops : LOTOS!Operations (
+ declarations <- Sequence {eqOp, neqOp},
+ parameterTypes <- Sequence {s.name, s.name},
+ returnType <- 'Bool'
+ ),
+ eqOp : LOTOS!OperationDeclaration (
+ name <- '_eq_'
+ ),
+ neqOp : LOTOS!OperationDeclaration (
+ name <- '_neq_'
+ ),
+
+
+ xAndYDecl : LOTOS!VariableDeclarations (
+ declarations <- Sequence {x, y},
+ type <- s.name
+ ),
+ x : LOTOS!VariableDeclaration (
+ name <- 'x'
+ ),
+ y : LOTOS!VariableDeclaration (
+ name <- 'y'
+ ),
+
+
+ opsEq : LOTOS!OfSort (
+ name <- 'Bool',
+ equations <- Sequence {opsEq1, opsEq2, opsEq3}
+ ),
+ opsGuard : LOTOS!EqualityTestGuardExp (
+ left <- opsGuardX,
+ right <- opsGuardY
+ ),
+ opsGuardX : LOTOS!Variable (
+ declaration <- x
+ ),
+ opsGuardY : LOTOS!Variable (
+ declaration <- y
+ ),
+
+ opsEq1 : LOTOS!GuardedEquation (
+ guard <- opsGuard,
+ equation <- opsEq1SE
+ ),
+ opsEq1SE : LOTOS!SimpleEquation (
+ left <- opsEq1OC,
+ right <- opsEq1T
+ ),
+ opsEq1OC : LOTOS!OperatorCall (
+ operatorName <- 'eq',
+ left <- opsEq1OCX,
+ right <- opsEq1OCY
+ ),
+ opsEq1OCX : LOTOS!Variable (
+ declaration <- x
+ ),
+ opsEq1OCY : LOTOS!Variable (
+ declaration <- y
+ ),
+ opsEq1T : LOTOS!BooleanVal (
+ value <- true
+ ),
+
+ opsEq2 : LOTOS!SimpleEquation (
+ left <- opsEq2OC,
+ right <- opsEq2F
+ ),
+ opsEq2OC : LOTOS!OperatorCall (
+ operatorName <- 'eq',
+ left <- opsEq2OCX,
+ right <- opsEq2OCY
+ ),
+ opsEq2OCX : LOTOS!Variable (
+ declaration <- x
+ ),
+ opsEq2OCY : LOTOS!Variable (
+ declaration <- y
+ ),
+ opsEq2F : LOTOS!BooleanVal (
+ value <- false
+ ),
+
+ opsEq3 : LOTOS!SimpleEquation (
+ left <- opsEq3OC,
+ right <- opsEq3N
+ ),
+ opsEq3OC : LOTOS!OperatorCall (
+ operatorName <- 'neq',
+ left <- opsEq3OCX,
+ right <- opsEq3OCY
+ ),
+ opsEq3OCX : LOTOS!Variable (
+ declaration <- x
+ ),
+ opsEq3OCY : LOTOS!Variable (
+ declaration <- y
+ ),
+ opsEq3N : LOTOS!OperationCall (
+ operationName <- 'not',
+ arguments <- Sequence {opsEq3NOC}
+ ),
+ opsEq3NOC : LOTOS!OperatorCall (
+ operatorName <- 'eq',
+ left <- opsEq3NOCX,
+ right <- opsEq3NOCY
+ ),
+ opsEq3NOCX : LOTOS!Variable (
+ declaration <- x
+ ),
+ opsEq3NOCY : LOTOS!Variable (
+ declaration <- y
+ )
+}
+
+rule Interval extends TypeTranslation {
+ from
+ s : FIACRE!TypeDeclaration (
+ s.type.oclIsKindOf(FIACRE!IntervalType)
+ )
+ to
+ t : LOTOS!TypeDefinition (
+ types <- Sequence {'Boolean', 'IntegerNumber'},
+ operations <- Sequence {cons, checkBounds, toInt, fromInt, error, ops},
+ equations <- Sequence {eqns}
+ ),
+
+-- @begin Operations
+ cons : LOTOS!Operations (
+ declarations <- Sequence {consDecl},
+ parameterTypes <- Sequence {'Int'},
+ returnType <- s.name
+ ),
+ consDecl : LOTOS!OperationDeclaration (
+ name <- s.name,
+ commentsAfter <- Sequence {'(*! constructor *)'}
+ ),
+
+ checkBounds : LOTOS!Operations (
+ declarations <- Sequence {checkBoundsDecl},
+ parameterTypes <- Sequence {'Int'},
+ returnType <- 'Bool'
+ ),
+ checkBoundsDecl : LOTOS!OperationDeclaration (
+ name <- 'In' + s.name
+ ),
+
+ toInt : LOTOS!Operations (
+ declarations <- Sequence {toIntDecl},
+ parameterTypes <- Sequence {s.name},
+ returnType <- 'Int'
+ ),
+ toIntDecl : LOTOS!OperationDeclaration (
+ name <- s.name + 'ToInt'
+ ),
+
+ fromInt : LOTOS!Operations (
+ declarations <- Sequence {fromIntDecl},
+ parameterTypes <- Sequence {'Int'},
+ returnType <- s.name
+ ),
+ fromIntDecl : LOTOS!OperationDeclaration (
+ name <- 'IntTo' + s.name
+ ),
+
+ error : LOTOS!Operations (
+ declarations <- Sequence {errorDecl},
+ parameterTypes <- Sequence {},
+ returnType <- s.name
+ ),
+ errorDecl : LOTOS!OperationDeclaration (
+ name <- 'Error' + s.name,
+ commentsAfter <- Sequence {'(*! implementedby Error' + s.name + ' external *)'}
+ ),
+-- @end Operations
+
+-- @begin Equations
+ eqns : LOTOS!Equations (
+ declarations <- Sequence {xAndYDecl, zDecl},
+ ofSorts <- Sequence {checkBoundsEq, toIntEq, fromIntEq, opsEq}
+ ),
+ zDecl : LOTOS!VariableDeclarations (
+ declarations <- Sequence {z},
+ type <- 'Int'
+ ),
+ z : LOTOS!VariableDeclaration (
+ name <- 'z'
+ ),
+
+ checkBoundsEq : LOTOS!OfSort (
+ name <- 'Bool',
+ equations <- Sequence {cbEq1, cbEq2}
+ ),
+ cbGuard : LOTOS!EqualityTestGuardExp (
+ left <- cbGuardAnd,
+ right <- cbGuardT
+ ),
+ cbGuardAnd : LOTOS!OperatorCall (
+ operatorName <- 'and',
+ left <- cbGuardInf,
+ right <- cbGuardSup
+ ),
+ cbGuardInf : LOTOS!OperatorCall (
+ operatorName <- '>=',
+ left <- cbGuardInfV,
+ right <- cbGuardInfCB
+ ),
+ cbGuardInfV : LOTOS!Variable (
+ declaration <- z
+ ),
+ cbGuardInfCB : LOTOS!CastVal (
+ value <- cbGuardInfB,
+ toType <- 'Int'
+ ),
+ cbGuardInfB : LOTOS!IntegerVal (
+ value <- s.type.lower
+ ),
+ cbGuardSup : LOTOS!OperatorCall (
+ operatorName <- '<=',
+ left <- cbGuardSupV,
+ right <- cbGuardSupCB
+ ),
+ cbGuardSupV : LOTOS!Variable (
+ declaration <- z
+ ),
+ cbGuardSupCB : LOTOS!CastVal (
+ value <- cbGuardSupB,
+ toType <- 'Int'
+ ),
+ cbGuardSupB : LOTOS!IntegerVal (
+ value <- s.type.upper
+ ),
+
+ cbGuardT : LOTOS!BooleanVal (
+ value <- true
+ ),
+
+ cbEq1 : LOTOS!GuardedEquation (
+ guard <- cbGuard,
+ equation <- cbEq1SE
+ ),
+ cbEq1SE : LOTOS!SimpleEquation (
+ left <- cbEq1OpCall,
+ right <- cbEq1T
+ ),
+ cbEq1OpCall : LOTOS!OperationCall (
+ operationName <- 'In' + s.name,
+ arguments <- Sequence {cbEq1OpCallArg}
+ ),
+ cbEq1OpCallArg : LOTOS!Variable (
+ declaration <- z
+ ),
+
+ cbEq1T : LOTOS!BooleanVal (
+ value <- true
+ ),
+
+ cbEq2 : LOTOS!SimpleEquation (
+ left <- cbEq2OpCall,
+ right <- cbEq2F
+ ),
+ cbEq2OpCall : LOTOS!OperationCall (
+ operationName <- 'In' + s.name,
+ arguments <- Sequence {cbEq2OpCallArg}
+ ),
+ cbEq2OpCallArg : LOTOS!Variable (
+ declaration <- z
+ ),
+
+ cbEq2F : LOTOS!BooleanVal (
+ value <- false
+ ),
+
+ toIntEq : LOTOS!OfSort (
+ name <- 'Int',
+ equations <- Sequence {tiEq}
+ ),
+ tiEq : LOTOS!SimpleEquation (
+ left <- tiEqOpCall,
+ right <- tiEqZ
+ ),
+ tiEqOpCall : LOTOS!OperationCall (
+ operationName <- s.name + 'ToInt',
+ arguments <- Sequence {tiEqOpCall2}
+ ),
+ tiEqOpCall2 : LOTOS!OperationCall (
+ operationName <- s.name,
+ arguments <- Sequence {tiEqOpCall2Z}
+ ),
+ tiEqOpCall2Z : LOTOS!Variable (
+ declaration <- z
+ ),
+ tiEqZ : LOTOS!Variable (
+ declaration <- z
+ ),
+
+ fromIntEq : LOTOS!OfSort (
+ name <- s.name,
+ equations <- Sequence {fiEq1, fiEq2}
+ ),
+ fiGuard : LOTOS!EqualityTestGuardExp (
+ left <- fiGuardOC,
+ right <- fiGuardT
+ ),
+ fiGuardOC : LOTOS!OperationCall (
+ operationName <- 'In' + s.name,
+ arguments <- Sequence {fiGuardV}
+ ),
+ fiGuardV : LOTOS!Variable (
+ declaration <- z
+ ),
+
+ fiGuardT : LOTOS!BooleanVal (
+ value <- true
+ ),
+
+ fiEq1 : LOTOS!GuardedEquation (
+ guard <- fiGuard,
+ equation <- fiEq1SE
+ ),
+ fiEq1SE : LOTOS!SimpleEquation (
+ left <- fiEq1OCL,
+ right <- fiEq1OCR
+ ),
+ fiEq1OCL : LOTOS!OperationCall (
+ operationName <- 'IntTo' + s.name,
+ arguments <- Sequence {fiEq1OCLArg}
+ ),
+ fiEq1OCLArg : LOTOS!Variable (
+ declaration <- z
+ ),
+
+ fiEq1OCR : LOTOS!OperationCall (
+ operationName <- s.name,
+ arguments <- Sequence {fiEq1OCRArg}
+ ),
+ fiEq1OCRArg : LOTOS!Variable (
+ declaration <- z
+ ),
+
+ fiEq2 : LOTOS!SimpleEquation (
+ left <- fiEq2OpCall,
+ right <- fiEq2V
+ ),
+ fiEq2OpCall : LOTOS!OperationCall (
+ operationName <- 'IntTo' + s.name,
+ arguments <- Sequence {fiEq2OpCallZ}
+ ),
+ fiEq2OpCallZ : LOTOS!Variable (
+ declaration <- z
+ ),
+ fiEq2V : LOTOS!Variable (
+ declaration <- errorDecl
+ )
+-- @end Equations
+}
+
+rule Enumeration extends TypeTranslation {
+ from
+ s : FIACRE!TypeDeclaration (
+ s.type.oclIsKindOf(FIACRE!EnumerationType)
+ )
+ to
+ t : LOTOS!TypeDefinition (
+ types <- Sequence {'Boolean'},
+ operations <- Sequence {cons, ops},
+ equations <- Sequence {eqns}
+ ),
+
+ cons : LOTOS!Operations (
+ declarations <- s.type.literals,
+ parameterTypes <- Sequence {},
+ returnType <- s.name
+ ),
+
+ eqns : LOTOS!Equations (
+ declarations <- Sequence {xAndYDecl},
+ ofSorts <- Sequence {opsEq}
+ )
+}
+
+rule EnumLiteral {
+ from
+ s : FIACRE!EnumLiteral
+ to
+ t : LOTOS!OperationDeclaration (
+ name <- s.name,
+ commentsAfter <- Sequence {'(*! constructor *)'}
+ )
+}
+
+helper context FIACRE!RecordType def: allFields : Sequence(FIACRE!RecordField) =
+ self.fields->iterate(e; acc : Sequence(FIACRE!RecordField) = Sequence {} |
+ acc->union(e.fields)
+ );
+
+helper context FIACRE!RecordField def: type : FIACRE!Type =
+ self.refImmediateComposite().type;
+
+helper context FIACRE!RecordType def: types : Sequence(String) =
+ self.allFields->collect(e | e.type.toStringH());
+
+rule Record extends TypeTranslation {
+ from
+ s : FIACRE!TypeDeclaration (
+ s.type.oclIsKindOf(FIACRE!RecordType)
+ )
+ to
+ t : LOTOS!TypeDefinition (
+ types <- s.type.types->append('Boolean'),
+ operations <- s.type.allFields->collect(e |
+ thisModule.RecordField2GetOperations(e)
+ )->union(
+ s.type.allFields->collect(e |
+ thisModule.RecordField2SetOperations(e)
+ )
+ )->prepend(cons)->append(ops),
+ equations <- Sequence {eqns}
+ ),
+
+ cons : LOTOS!Operations (
+ declarations <- consDecl,
+ parameterTypes <- s.type.types,
+ returnType <- s.name
+ ),
+ consDecl : LOTOS!OperationDeclaration (
+ name <- s.name,
+ commentsAfter <- Sequence {'(*! constructor *)'}
+ ),
+
+ eqns : LOTOS!Equations (
+ declarations <- s.type.allFields->collect(e |
+ thisModule.RecordField2VariableDeclarations(e)
+ )->append(xAndYDecl),
+ ofSorts <- s.type.allFields->collect(e |
+ thisModule.RecordField2GetEqn(e)
+ )->union(Sequence {setEq, opsEq})
+ ),
+ setEq : LOTOS!OfSort (
+ name <- s.name,
+ equations <- s.type.allFields->collect(e |
+ thisModule.RecordField2SetEqn(e)
+ )
+ )
+}
+
+helper context FIACRE!RecordField def: typeDecl : FIACRE!TypeDeclaration =
+ self.recordType.refImmediateComposite();
+
+helper context FIACRE!RecordField def: recordType : FIACRE!RecordType =
+ self.refImmediateComposite().refImmediateComposite();
+
+helper context FIACRE!RecordField def: typeDeclName : String =
+ self.typeDecl.name;
+
+helper context FIACRE!RecordField def: opSuffix : String =
+ self.typeDeclName + '_' + self.name;
+
+unique lazy rule RecordField2GetOperations {
+ from
+ s : FIACRE!RecordField
+ to
+ t : LOTOS!Operations (
+ declarations <- Sequence {decl},
+ parameterTypes <- Sequence {s.typeDeclName},
+ returnType <- s.type.toString()
+ ),
+ decl : LOTOS!OperationDeclaration (
+ name <- 'Get' + s.opSuffix
+ )
+}
+
+unique lazy rule RecordField2SetOperations {
+ from
+ s : FIACRE!RecordField
+ to
+ t : LOTOS!Operations (
+ declarations <- Sequence {decl},
+ parameterTypes <- Sequence {s.typeDeclName, s.type.toString()},
+ returnType <- s.typeDeclName
+ ),
+ decl : LOTOS!OperationDeclaration (
+ name <- 'Set' + s.typeDeclName + '_' + s.name
+ )
+}
+
+helper context FIACRE!RecordField def: index : String =
+ self.recordType.allFields->indexOf(self).toString();
+
+unique lazy rule RecordField2VariableDeclarations {
+ from
+ s : FIACRE!RecordField
+ to
+ t : LOTOS!VariableDeclarations (
+ declarations <- Sequence {
+ thisModule.RecordField2X(s),
+ thisModule.RecordField2Y(s)
+ },
+ type <- s.type.toString()
+ )
+}
+
+unique lazy rule RecordField2X {
+ from
+ s : FIACRE!RecordField
+ to
+ x : LOTOS!VariableDeclaration (
+ name <- 'x' + s.index
+ )
+}
+
+unique lazy rule RecordField2Y {
+ from
+ s : FIACRE!RecordField
+ to
+ x : LOTOS!VariableDeclaration (
+ name <- 'y' + s.index
+ )
+}
+
+unique lazy rule RecordField2GetEqn {
+ from
+ s : FIACRE!RecordField
+ to
+ t : LOTOS!OfSort (
+ name <- s.type.toString(),
+ equations <- eq
+ ),
+ eq : LOTOS!SimpleEquation (
+ left <- oc,
+ right <- thisModule.RecordField2XVariable(s)
+ ),
+ oc : LOTOS!OperationCall (
+ operationName <- 'Get' + s.opSuffix,
+ arguments <- Sequence {cc}
+ ),
+ cc : LOTOS!OperationCall (
+ operationName <- s.typeDeclName,
+ arguments <- s.recordType.allFields->collect(e |
+ thisModule.RecordField2XVariable(e)
+ )
+ )
+}
+
+unique lazy rule RecordField2SetEqn {
+ from
+ s : FIACRE!RecordField
+ to
+ t : LOTOS!SimpleEquation (
+ left <- oc,
+ right <- right
+ ),
+ oc : LOTOS!OperationCall (
+ operationName <- 'Set' + s.opSuffix,
+ arguments <- Sequence {cc, thisModule.RecordField2YVariable(s)}
+ ),
+ cc : LOTOS!OperationCall (
+ operationName <- s.typeDeclName,
+ arguments <- s.recordType.allFields->collect(e |
+ thisModule.RecordField2XVariable(e)
+ )
+ ),
+ right : LOTOS!OperationCall (
+ operationName <- s.typeDeclName,
+ arguments <- s.recordType.allFields->collect(e |
+ if e = s then
+ thisModule.RecordField2YVariable(e)
+ else
+ thisModule.RecordField2XVariable(e)
+ endif
+ )
+ )
+}
+
+-- not unique because called several times
+lazy rule RecordField2XVariable {
+ from
+ s : FIACRE!RecordField
+ to
+ t : LOTOS!Variable (
+ declaration <- thisModule.RecordField2X(s)
+ )
+}
+
+-- not unique because called several times
+lazy rule RecordField2YVariable {
+ from
+ s : FIACRE!RecordField
+ to
+ t : LOTOS!Variable (
+ declaration <- thisModule.RecordField2Y(s)
+ )
+}
+
+helper context FIACRE!IntegerType def: toString() : String =
+ 'Int';
+
+helper context FIACRE!BooleanType def: toString() : String =
+ 'Bool';
+
+helper context FIACRE!TypeRef def: toString() : String =
+ self.declaration.name;
+
+helper context FIACRE!IntegerType def: toStringH() : String =
+ 'IntegerNumber';
+
+helper context FIACRE!BooleanType def: toStringH() : String =
+ 'Boolean';
+
+helper context FIACRE!TypeRef def: toStringH() : String =
+ self.declaration.name;
+
+helper context Integer def: sequenceTo(other : Integer) : Sequence(Integer) =
+ if self > other then
+ Sequence {}
+ else
+ Sequence {self}->union((self + 1).sequenceTo(other))
+ endif;
+
+rule Array extends TypeTranslation {
+ from
+ s : FIACRE!TypeDeclaration (
+ s.type.oclIsKindOf(FIACRE!ArrayType)
+ )
+ using {
+ indices : Sequence(Integer) = 1 .sequenceTo(s.type.size);
+ xs : Sequence(LOTOS!VariableDeclaration) = OclUndefined;
+ }
+ to
+ t : LOTOS!TypeDefinition (
+ types <- Sequence {s.type.elementType.toStringH(), 'Boolean', 'Natural'},
+ operations <- Sequence {cons, get, set, error1, error2, ops},
+ equations <- Sequence {eqns}
+ ),
+
+ cons : LOTOS!Operations (
+ declarations <- consDecl,
+ parameterTypes <- indices->collect(e |
+ s.type.elementType.toString()
+ ),
+ returnType <- s.name
+ ),
+ consDecl : LOTOS!OperationDeclaration (
+ name <- s.name,
+ commentsAfter <- Sequence {'(*! constructor *)'}
+ ),
+
+ get : LOTOS!Operations (
+ declarations <- Sequence {getDecl},
+ parameterTypes <- Sequence {s.name, 'Nat'},
+ returnType <- s.type.elementType.toString()
+ ),
+ getDecl : LOTOS!OperationDeclaration (
+ name <- 'Get' + s.name
+ ),
+
+ set : LOTOS!Operations (
+ declarations <- Sequence {setDecl},
+ parameterTypes <- Sequence {s.name, 'Nat', s.type.elementType.toString()},
+ returnType <- s.name
+ ),
+ setDecl : LOTOS!OperationDeclaration (
+ name <- 'Set' + s.name
+ ),
+
+ error1 : LOTOS!Operations (
+ declarations <- Sequence {error1Decl},
+ parameterTypes <- Sequence {},
+ returnType <- s.type.elementType.toString()
+ ),
+ error1Decl : LOTOS!OperationDeclaration (
+ name <- 'Error' + s.name + '_1',
+ commentsAfter <- Sequence {'(*! implementedby Error' + s.name + '_1 external *)'}
+ ),
+
+ error2 : LOTOS!Operations (
+ declarations <- Sequence {error2Decl},
+ parameterTypes <- Sequence {},
+ returnType <- s.name
+ ),
+ error2Decl : LOTOS!OperationDeclaration (
+ name <- 'Error' + s.name + '_2',
+ commentsAfter <- Sequence {'(*! implementedby Error' + s.name + '_2 external *)'}
+ ),
+
+
+ eqns : LOTOS!Equations (
+ declarations <- Sequence {xsAndZDecl, xAndYDecl, pDecl},
+ ofSorts <- Sequence {getEq, setEq, opsEq}
+ ),
+ xsAndZDecl : LOTOS!VariableDeclarations (
+ type <- s.type.elementType.toString()
+ ),
+ z : LOTOS!VariableDeclaration (
+ name <- 'z'
+ ),
+ pDecl : LOTOS!VariableDeclarations (
+ declarations <- Sequence {p},
+ type <- 'Nat'
+ ),
+ p : LOTOS!VariableDeclaration (
+ name <- 'p'
+ ),
+
+ getEq : LOTOS!OfSort (
+ name <- s.type.elementType.toString()
+ ),
+ setEq : LOTOS!OfSort (
+ name <- s.name
+ )
+ do {
+ xs <- indices->collect(e |
+ LOTOS!VariableDeclaration
+ .newInstance()
+ .refSetValue('name', 'x' + e.toString())
+ );
+ xsAndZDecl.declarations <- xs->append(z);
+
+ -- Get equations
+ for(i in indices) {
+ getEq.equations <- thisModule.CreateIndexedGetEquation(p, i, xs, s.name);
+ }
+ getEq.equations <- thisModule.CreateErrorGetEquation(p, error1Decl, xs, s.name);
+
+ -- Set equations
+ for(i in indices) {
+ setEq.equations <- thisModule.CreateIndexedSetEquation(z, p, i, xs, s.name);
+ }
+ setEq.equations <- thisModule.CreateErrorSetEquation(z, p, error2Decl, xs, s.name);
+ }
+}
+
+rule CreateIndexedGetEquation(p : LOTOS!VariableDeclaration, index : Integer, xs : Sequence(LOTOS!VariableDeclaration), typeName : String) {
+ to
+ t : LOTOS!GuardedEquation (
+ guard <- guard
+ ),
+ guard : LOTOS!EqualityTestGuardExp (
+ left <- pv,
+ right <- idx
+ ),
+ pv : LOTOS!Variable (
+ declaration <- p
+ ),
+ idx : LOTOS!IntegerVal (
+ value <- index
+ )
+ do {
+ t.equation <- thisModule.CreateGetEquation(p, xs->at(index), xs, typeName);
+ t;
+ }
+}
+
+rule CreateErrorGetEquation(p : LOTOS!VariableDeclaration, error : LOTOS!Declaration, xs : Sequence(LOTOS!VariableDeclaration), typeName : String) {
+ do {
+ thisModule.CreateGetEquation(p, error, xs, typeName);
+ }
+}
+
+rule CreateGetEquation(p : LOTOS!VariableDeclaration, resultDecl : LOTOS!VariableDeclaration, xs : Sequence(LOTOS!VariableDeclaration), typeName : String) {
+ to
+ t : LOTOS!SimpleEquation (
+ left <- oc,
+ right <- xi
+ ),
+ oc : LOTOS!OperationCall (
+ operationName <- 'Get' + typeName,
+ arguments <- Sequence {consCall, idx}
+ ),
+ consCall : LOTOS!OperationCall (
+ operationName <- typeName
+ ),
+ xi : LOTOS!Variable (
+ declaration <- resultDecl
+ ),
+ idx : LOTOS!Variable (
+ declaration <- p
+ )
+ do {
+ consCall.arguments <- xs->collect(e |
+ LOTOS!Variable
+ .newInstance()
+ .refSetValue('declaration', e)
+ );
+ t;
+ }
+}
+
+rule CreateIndexedSetEquation(z : LOTOS!VariableDeclaration, p : LOTOS!VariableDeclaration, index : Integer, xs : Sequence(LOTOS!VariableDeclaration), typeName : String) {
+ to
+ t : LOTOS!GuardedEquation (
+ guard <- guard
+ ),
+ guard : LOTOS!EqualityTestGuardExp (
+ left <- pv,
+ right <- idx
+ ),
+ pv : LOTOS!Variable (
+ declaration <- p
+ ),
+ idx : LOTOS!IntegerVal (
+ value <- index
+ ),
+ right : LOTOS!OperationCall (
+ operationName <- typeName
+ ),
+ zv : LOTOS!Variable (
+ declaration <- z
+ )
+ do {
+ right.arguments <- xs->collect(e |
+ if e.name = 'x' + index.toString() then
+ zv
+ else
+ LOTOS!Variable
+ .newInstance()
+ .refSetValue('declaration', e)
+ endif
+ );
+ t.equation <- thisModule.CreateSetEquation(p, z, right, xs, typeName);
+ t;
+ }
+}
+
+rule CreateErrorSetEquation(z : LOTOS!VariableDeclaration, p : LOTOS!VariableDeclaration, error : LOTOS!Declaration, xs : Sequence(LOTOS!VariableDeclaration), typeName : String) {
+ to
+ errorVal : LOTOS!Variable (
+ declaration <- error
+ )
+ do {
+ thisModule.CreateSetEquation(p, z, errorVal, xs, typeName);
+ }
+}
+
+rule CreateSetEquation(p : LOTOS!VariableDeclaration, z : LOTOS!VariableDeclaration, right : LOTOS!Value, xs : Sequence(LOTOS!VariableDeclaration), typeName : String) {
+ to
+ t : LOTOS!SimpleEquation (
+ left <- oc,
+ right <- right
+ ),
+ oc : LOTOS!OperationCall (
+ operationName <- 'Set' + typeName,
+ arguments <- Sequence {consCall, idx, zv}
+ ),
+ consCall : LOTOS!OperationCall (
+ operationName <- typeName
+ ),
+ zv : LOTOS!Variable (
+ declaration <- z
+ ),
+ idx : LOTOS!Variable (
+ declaration <- p
+ )
+ do {
+ consCall.arguments <- xs->collect(e |
+ LOTOS!Variable
+ .newInstance()
+ .refSetValue('declaration', e)
+ );
+ t;
+ }
+}
diff --git a/syntaxes/FIACRE/Compiler/FIACRE2LOTOS.xml b/syntaxes/FIACRE/Compiler/FIACRE2LOTOS.xml
new file mode 100644
index 0000000..cc2d8bc
--- /dev/null
+++ b/syntaxes/FIACRE/Compiler/FIACRE2LOTOS.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0"?>
+<!-- ======================================================================
+ FIACRE/FIACRE2LOTOS
+
+ jouault
+ ====================================================================== -->
+<project name="FIACRE2LOTOS" default="main">
+
+ <eclipse.convertPath resourcepath="/FIACRE" property="fiacre.absolute.dir"/>
+
+ <target name="main">
+ <antcall target="transform" inheritall="true" inheritrefs="true">
+ <param name="sample" value="/FIACRE/Samples/Simple_array.fcr"/>
+ </antcall>
+ <antcall target="transform" inheritall="true" inheritrefs="true">
+ <param name="sample" value="/FIACRE/Samples/Simple_enum.fcr"/>
+ </antcall>
+ <antcall target="transform" inheritall="true" inheritrefs="true">
+ <param name="sample" value="/FIACRE/Samples/Simple_interval.fcr"/>
+ </antcall>
+ <antcall target="transform" inheritall="true" inheritrefs="true">
+ <param name="sample" value="/FIACRE/Samples/Simple_record.fcr"/>
+ </antcall>
+ </target>
+
+ <target name="transform" depends="loadModels">
+ <basename property="sample.name" file="${sample}" suffix=".fcr"/>
+ <dirname property="sample.dir" file="${sample}"/>
+
+ <property name="fiacre.path" value="${sample}"/>
+ <property name="lotos.path" value="${sample.dir}/${sample.name}.lotos"/>
+
+ <am3.loadModel modelHandler="EMF" name="myFIACRE" metamodel="FIACRE" path="${fiacre.path}">
+ <injector name="ebnf">
+ <param name="name" value="FIACRE"/>
+ <classpath>
+ <!-- location must be relative !! -->
+ <pathelement location="${fiacre.absolute.dir}/Syntax/FIACRE-parser.jar"/>
+ </classpath>
+ </injector>
+ </am3.loadModel>
+
+ <!-- Transform FIACRE model into LOTOS model -->
+ <am3.atl path="/FIACRE/Compiler/FIACRE2LOTOS.atl">
+ <inModel name="IN" model="myFIACRE"/>
+ <inModel name="FIACRE" model="FIACRE"/>
+ <inModel name="LOTOS" model="LOTOS"/>
+ <outModel name="OUT" model="myLOTOS" metamodel="LOTOS"/>
+ </am3.atl>
+
+ <!-- Serialize LOTOS model into .lotos file -->
+ <am3.saveModel model="myLOTOS" path="${lotos.path}">
+ <extractor name="ebnf">
+ <param name="format" value="LOTOS.tcs"/>
+ <param name="stringDelim" value="&quot;"/>
+ <param name="serializeComments" value="true"/>
+ <param name="indentString" value="&#9;"/>
+ </extractor>
+ </am3.saveModel>
+ </target>
+
+ <target name="loadModels">
+ <!-- Load FIACRE metamodel -->
+ <am3.loadModel modelHandler="EMF" name="FIACRE" metamodel="MOF" path="/FIACRE/Metamodel/FIACRE.ecore"/>
+
+ <!-- Load LOTOS metamodel -->
+ <am3.loadModel modelHandler="EMF" name="LOTOS" metamodel="MOF" path="/LOTOS/Metamodel/LOTOS.ecore" />
+
+ <!-- Load TCS metamodel -->
+ <am3.loadModel modelHandler="EMF" name="TCS" metamodel="MOF" path="/AMMACore/TCS/Metamodel/TCS.ecore" />
+
+ <!-- Load LOTOS model for TCS -->
+ <am3.loadModel modelHandler="EMF" name="LOTOS.tcs" metamodel="TCS" path="/LOTOS/Syntax/LOTOS.tcs">
+ <injector name="ebnf">
+ <param name="name" value="TCS"/>
+ </injector>
+ </am3.loadModel>
+ </target>
+</project>
diff --git a/syntaxes/FIACRE/Compiler/FIACRE2LOTOS.xml.launch b/syntaxes/FIACRE/Compiler/FIACRE2LOTOS.xml.launch
new file mode 100644
index 0000000..7605372
--- /dev/null
+++ b/syntaxes/FIACRE/Compiler/FIACRE2LOTOS.xml.launch
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ant.AntLaunchConfigurationType">
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/FIACRE/Compiler/FIACRE2LOTOS.xml"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="FIACRE"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/FIACRE/Compiler/FIACRE2LOTOS.xml}"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/>
+</launchConfiguration>
diff --git a/syntaxes/FIACRE/Metamodel/FIACRE.ann b/syntaxes/FIACRE/Metamodel/FIACRE.ann
new file mode 100644
index 0000000..099f488
--- /dev/null
+++ b/syntaxes/FIACRE/Metamodel/FIACRE.ann
@@ -0,0 +1,2 @@
+annotate FIACRE {
+} \ No newline at end of file
diff --git a/syntaxes/FIACRE/Metamodel/FIACRE.km3 b/syntaxes/FIACRE/Metamodel/FIACRE.km3
new file mode 100644
index 0000000..42d069d
--- /dev/null
+++ b/syntaxes/FIACRE/Metamodel/FIACRE.km3
@@ -0,0 +1,331 @@
+-- @name FIACRE
+-- @version 1.0
+-- @domains Formal specification
+-- @authors Frédéric Jouault
+-- @date 2007/07/11
+-- @description FIACRE metamodel.
+-- @see http://www-sop.inria.fr/oasis/fiacre/
+package FIACRE {
+
+ abstract class LocatedElement {
+ attribute location[0-1] : String;
+ attribute commentsBefore[*] ordered : String;
+ attribute commentsAfter[*] ordered : String;
+ }
+
+ abstract class NamedElement extends LocatedElement {
+ attribute name : String;
+ }
+
+ class Program extends LocatedElement {
+ reference elements[*] ordered container : Declaration;
+ }
+
+ abstract class Declaration extends NamedElement {}
+
+ class TypeDeclaration extends Declaration {
+ reference type container : Type;
+ }
+
+ class ChannelDeclaration extends Declaration {
+ reference channel container : Channel;
+ }
+
+ class ComponentDeclaration extends Declaration {
+ reference ports[*] ordered container : PortsDeclaration;
+ reference parameters[*] ordered container : Parameters;
+ reference variables[*] ordered container : VariablesDeclaration;
+ reference localPorts[*] ordered container : PortsDeclaration;
+ reference composition container : Composition;
+ }
+
+-- @begin Composition
+ abstract class Composition extends LocatedElement {}
+
+ class ShuffleComp extends Composition {
+ reference compositions[1-*] ordered container : Composition;
+ }
+
+ class SyncComp extends Composition {
+ reference compositions[1-*] ordered container : Composition;
+ }
+
+ class ParComp extends Composition {
+ reference elements[1-*] ordered container : ParallelElement;
+ }
+
+ class ParallelElement extends LocatedElement {
+ reference ports[*] ordered : PortDeclaration;
+ reference composition container : Composition;
+ }
+
+ class Instance extends Composition {
+ -- TODO: or ComponentDeclaration
+ reference process : ProcessDeclaration;
+ reference ports[*] ordered : PortDeclaration;
+ reference arguments[*] ordered container : Expression;
+ }
+-- @end Composition
+
+-- @begin Process
+ class ProcessDeclaration extends Declaration {
+ reference ports[*] ordered container : PortsDeclaration;
+ reference parameters[*] ordered container : Parameters;
+ reference states[*] ordered container : State;
+ reference initialState : State;
+ reference variables[*] ordered container : VariablesDeclaration;
+ reference transitions[1-*] ordered container : Transition;
+ }
+
+ class PortsDeclaration extends LocatedElement {
+ reference ports[1-*] ordered container : PortDeclaration oppositeOf list;
+ reference channel container : Channel;
+ }
+
+ class PortDeclaration extends NamedElement {
+ reference list : PortsDeclaration oppositeOf ports;
+ attribute isIn : Boolean;
+ attribute isOut : Boolean;
+ }
+
+ class Parameters extends LocatedElement {
+ reference parameters[1-*] ordered container : Parameter oppositeOf list;
+ reference type container : Type;
+ }
+
+ class Parameter extends NamedElement {
+ reference list : Parameters oppositeOf parameters;
+ attribute isRead : Boolean;
+ attribute isWrite : Boolean;
+ }
+
+ class State extends NamedElement {}
+
+ class VariablesDeclaration extends LocatedElement {
+ reference variables[1-*] ordered container : VariableDeclaration oppositeOf list;
+ reference type container : Type;
+ reference initializer[0-1] container : Initializer;
+ }
+
+ class VariableDeclaration extends NamedElement {
+ reference list[0-1] : VariablesDeclaration oppositeOf variables;
+ }
+
+ class Transition extends LocatedElement {
+ reference from : State;
+ reference statements[*] ordered container : Statement;
+ }
+-- @end Process
+
+-- @begin Statements
+ abstract class Statement extends LocatedElement {}
+
+ class AssignStat extends Statement {
+-- reference target container : AccessExp;
+-- reference target container : VariableExp;
+-- TODO: target AccessExp, or at least write a WFR to check that
+-- we have a BinaryOperatorExp with operator = ":="
+ reference target container : Expression;
+ reference value container : Expression;
+ reference where[0-1] container : Expression;
+ }
+
+ class CommunicationStat extends Statement {
+ reference port : PortDeclaration;
+ attribute isIn : Boolean;
+-- reference types[0-*] ordered container : Type;
+
+ -- only for in
+ reference variables[1-*] ordered container : VariableExp;
+ -- only for out
+ reference expressions[1-*] ordered container : Expression;
+
+ reference where[0-1] container : Expression;
+ }
+
+ class WhileStat extends Statement {
+ reference condition container : Expression;
+ reference statements[1-*] ordered container : Statement;
+ }
+
+ class IfStat extends Statement {
+ reference condition container : Expression;
+ reference thenStatements[1-*] ordered container : Statement;
+ reference elsIfs[*] ordered container : ElsIf;
+ reference elseStatements[*] ordered container : Statement;
+ }
+
+ class ElsIf extends LocatedElement {
+ reference condition container : Expression;
+ reference statements[1-*] ordered container : Statement;
+ }
+
+ class SelectStat extends Statement {
+ reference blocks[1-*] ordered container : StatBlock;
+ }
+
+ class StatBlock extends LocatedElement {
+ reference statements[1-*] ordered container : Statement;
+ }
+
+ class ToStat extends Statement {
+ reference to : State;
+ }
+-- @end Statements
+
+-- @begin Types
+ abstract class Type extends LocatedElement {}
+
+ class BooleanType extends Type {}
+
+ class NaturalType extends Type {}
+
+ class IntegerType extends Type {}
+
+ class IntervalType extends Type {
+ attribute lower : Integer;
+ attribute upper : Integer;
+ }
+
+ class EnumerationType extends Type {
+ reference literals[1-*] ordered container : EnumLiteral;
+ }
+
+ class EnumLiteral extends VariableDeclaration {}
+
+ class RecordType extends Type {
+ reference fields[1-*] ordered container : RecordFields;
+ }
+
+ class RecordFields extends NamedElement {
+ reference fields[1-*] ordered container : RecordField;
+ reference type container : Type;
+ }
+
+ class RecordField extends NamedElement {}
+
+ class ArrayType extends Type {
+ attribute size : Integer;
+ reference elementType container : Type;
+ }
+
+ class QueueType extends Type {
+ attribute size : Integer;
+ reference elementType container : Type;
+ }
+
+ class TypeRef extends Type {
+ reference declaration : TypeDeclaration;
+ }
+-- @end Types
+
+-- @begin Channels
+ abstract class Channel extends LocatedElement {}
+
+ class MultiProfileChannel extends Channel {
+ reference channels[1-*] container : SimpleChannel;
+ }
+
+ abstract class SimpleChannel extends LocatedElement {}
+
+-- class ChannelRef extends SimpleChannel {
+-- reference declaration : ChannelDeclaration;
+-- }
+
+ class Profile extends SimpleChannel {
+ reference types[*] container : Type;
+ }
+-- @end Channels
+
+
+-- @begin Expressions
+ abstract class Expression extends LocatedElement {}
+
+ class LiteralExp extends Expression {
+ reference value container : Literal;
+ }
+
+ class AnyExp extends Expression {}
+
+ class BinaryOperatorExp extends Expression {
+ attribute operator : String;
+ reference left container : Expression;
+ reference right container : Expression;
+ }
+
+ class UnaryOperatorExp extends Expression {
+ attribute operator : String;
+ reference operand container : Expression;
+ }
+
+ class EnqueueExp extends Expression {
+ reference target container : Expression;
+ reference source container : Expression;
+ }
+
+ abstract class AccessExp extends Expression {}
+
+ class VariableExp extends AccessExp {
+-- class VariableExp extends Expression {
+ reference declaration : VariableDeclaration;
+ }
+
+ class ArrayAccessExp extends AccessExp {
+-- reference source container : AccessExp;
+ reference source container : Expression;
+ reference index container : Expression;
+ }
+
+ class NavigationExp extends AccessExp {
+-- reference source container : AccessExp;
+ reference source container : Expression;
+ attribute property : String;
+ }
+-- @end Expressions
+
+ abstract class Literal extends LocatedElement {}
+
+ class BooleanVal extends Literal {
+ attribute value : Boolean;
+ }
+
+ class NaturalVal extends Literal {
+ attribute value : Integer;
+ }
+
+ class IntegerVal extends NaturalVal {
+ attribute isPositive : Boolean;
+ }
+
+ class QueueVal extends Literal {
+ attribute size : Integer;
+ reference type container : Type;
+ }
+
+-- @begin Initializers
+ abstract class Initializer extends LocatedElement {}
+
+ class LiteralInit extends Initializer {
+ reference value container : Literal;
+ }
+
+ class ArrayInit extends Initializer {
+ reference elements[*] ordered container : Initializer;
+ }
+
+ class RecordInit extends Initializer {
+ reference fieldInits[1-*] ordered container : FieldInit;
+ }
+
+ class FieldInit extends LocatedElement {
+ attribute field : String;
+ reference initializer container : Initializer;
+ }
+-- @end Initializers
+}
+
+package PrimitiveTypes {
+ datatype Boolean;
+ datatype Integer;
+ datatype String;
+}
diff --git a/syntaxes/FIACRE/Samples/Simple_array.fcr b/syntaxes/FIACRE/Samples/Simple_array.fcr
new file mode 100644
index 0000000..9787326
--- /dev/null
+++ b/syntaxes/FIACRE/Samples/Simple_array.fcr
@@ -0,0 +1 @@
+type test is array of 2 int \ No newline at end of file
diff --git a/syntaxes/FIACRE/Samples/Simple_enum.fcr b/syntaxes/FIACRE/Samples/Simple_enum.fcr
new file mode 100644
index 0000000..84aa016
--- /dev/null
+++ b/syntaxes/FIACRE/Samples/Simple_enum.fcr
@@ -0,0 +1 @@
+type test is enum a, b, c end \ No newline at end of file
diff --git a/syntaxes/FIACRE/Samples/Simple_interval.fcr b/syntaxes/FIACRE/Samples/Simple_interval.fcr
new file mode 100644
index 0000000..b35c7d9
--- /dev/null
+++ b/syntaxes/FIACRE/Samples/Simple_interval.fcr
@@ -0,0 +1 @@
+type test is interval 5..10 \ No newline at end of file
diff --git a/syntaxes/FIACRE/Samples/Simple_record.fcr b/syntaxes/FIACRE/Samples/Simple_record.fcr
new file mode 100644
index 0000000..7240d0d
--- /dev/null
+++ b/syntaxes/FIACRE/Samples/Simple_record.fcr
@@ -0,0 +1 @@
+type test is record a : int, b : bool end \ No newline at end of file
diff --git a/syntaxes/FIACRE/Syntax/FIACRE.tcs b/syntaxes/FIACRE/Syntax/FIACRE.tcs
new file mode 100644
index 0000000..4673c4f
--- /dev/null
+++ b/syntaxes/FIACRE/Syntax/FIACRE.tcs
@@ -0,0 +1,542 @@
+-- @authors Frédéric Jouault
+-- @date 2007/05/21
+-- @description This TCS model defines the syntax of the LOTOS language.
+syntax FIACRE {
+
+ primitiveTemplate identifier for String default using NAME:
+ value = "%token%";
+
+ primitiveTemplate identifierOrKeyword for String using NAME orKeyword:
+ value = "%token%";
+
+ primitiveTemplate stringSymbol for String using STRING:
+ value = "%token%",
+ serializer="'\'' + %value%.toCString() + '\''";
+
+ primitiveTemplate integerSymbol for Integer default using INT:
+ value = "Integer.valueOf(%token%)";
+
+ template Program main context
+ : [ elements ] {indentIncr = 0, startNL = false, nbNL = 2}
+ ;
+
+ template Declaration abstract;
+
+ template TypeDeclaration addToContext
+ : "type" name "is" [ type ] {endNL = false}
+ ;
+
+ template ChannelDeclaration addToContext
+ : "channel" name "is" channel
+ ;
+
+ template ComponentDeclaration context addToContext
+ : "component" name
+ (isDefined(ports) ? "[" ports{separator = ","} "]")
+ (isDefined(parameters) ? "(" parameters{separator = ","} ")")
+ "is" [
+ (isDefined(variables) ? "vars" [ variables{separator = ",", forcedLower = 1} ])
+ (isDefined(localPorts) ? "port" [ localPorts{separator = ",", forcedLower = 1} ])
+ composition
+ ]
+ ;
+
+-- @begin Composition
+ template Composition abstract;
+
+ template ShuffleComp
+ : "shuffle" compositions "end"
+ ;
+
+ template SyncComp
+ : "sync" compositions "end"
+ ;
+
+ template ParComp
+ : "par" [ elements ] "end"
+ ;
+
+ template ParallelElement
+ : (isDefined(ports) ? ports{separator = ",", refersTo = name, forcedLower = 1} "->")
+ composition
+ ;
+
+ template Instance
+ : process{refersTo = name}
+ (isDefined(ports) ? "[" ports{refersTo = name, separator = ","} "]")
+ (isDefined(arguments) ? "(" arguments{separator = ","} ")")
+ ;
+-- @end Composition
+
+
+-- @begin Process
+ template ProcessDeclaration context addToContext
+ : "process" name
+ (isDefined(ports) ? "[" ports{separator = ","} "]")
+ (isDefined(parameters) ? "(" parameters{separator = ","} ")")
+ "is" [
+ "states" [ states{separator = ","} ]
+ "init" [ initialState{refersTo = name} ]
+ -- REMARK: "var" in spec
+ (isDefined(variables) ? "vars" [ variables{separator = ","} ])
+ ]
+ [
+ transitions
+ ] {nbNL = 2, endNL = false}
+ ;
+
+ template PortsDeclaration
+ : ports{separator = ","} ":" channel
+ ;
+
+ template PortDeclaration addToContext
+ : (isIn ? "in") (isOut ? "out") name
+ ;
+
+ template Parameters
+ : parameters{separator = ","} ":" type
+ ;
+
+ template Parameter
+ : (isRead ? "read") (isWrite ? "write") name
+ ;
+
+ template State addToContext
+ : name
+ ;
+
+ template VariablesDeclaration
+ : variables{separator = ","} ":" type
+ (isDefined(initializer) ? ":=" initializer)
+ ;
+
+ template VariableDeclaration addToContext
+ : name
+ ;
+
+ template Transition
+ : "from" from{refersTo = name} [
+ statements{separator = ";"}
+ ] {endNL = false}
+ ;
+-- @end Process
+
+
+-- @begin Statements
+ template Statement abstract;
+
+ -- TODO: do not consider ":=" as an operator
+ template AssignStat
+ : target --":=" value
+ (isDefined(where) ? "where" where)
+ ;
+
+ template CommunicationStat
+ : port{refersTo = name} (isIn ?
+ "?" variables{separator = ","}
+ (isDefined(where) ? "where" where)
+ :
+ "!" expressions{separator = ","}
+ )
+ ;
+
+ template WhileStat
+ : "while" condition "do" [
+ statements{separator = ";"}
+ ] "end"
+ ;
+
+ template IfStat
+ : "if" condition "then" [
+ thenStatements{separator = ";"}
+ ]
+ elsIfs
+ (isDefined(elseStatements) ? "else" [
+ elseStatements{separator = ";", forcedLower = 1}
+ ])
+ "end"
+ ;
+
+ template ElsIf
+ : "elsif" condition "then" [
+ statements{separator = ";"}
+ ]
+ ;
+
+ template SelectStat
+ : "select" [ blocks{separator = "[]"} ] {nbNL = 2, startNbNL = 1} "end"
+ ;
+
+ template StatBlock
+ : [ statements{separator = ";"} ] {indentIncr = 0, startNL = false, endNL = false}
+ ;
+
+ template ToStat
+ : "to" to{refersTo = name}
+ ;
+-- @end Statements
+
+
+-- @begin Types
+ template Type abstract;
+
+ template BooleanType
+ : "bool"
+ ;
+
+ template NaturalType
+ : "nat"
+ ;
+
+ template IntegerType
+ : "int"
+ ;
+
+ template IntervalType
+ : "interval" lower ".." upper
+ ;
+
+ template EnumerationType
+ : "enum" literals{separator = ","} "end"
+ ;
+
+ template EnumLiteral addToContext
+ : name
+ ;
+
+ template RecordType
+ : "record" [
+ fields{separator = ","}
+ ] "end"
+ ;
+
+ template RecordFields
+ : fields{separator = ","} ":" type
+ ;
+
+ template RecordField
+ : name
+ ;
+
+ template ArrayType
+ : "array" "of" size elementType
+ ;
+
+ template QueueType
+ : "queue" "of" size elementType
+ ;
+
+ template TypeRef
+ : declaration{refersTo = name}
+ ;
+-- @end Types
+
+
+-- @begin Channels
+ template Channel abstract;
+
+ template MultiProfileChannel
+ : channels{separator = "|"}
+ ;
+
+ template SimpleChannel abstract;
+
+-- template ChannelRef
+-- : declaration{refersTo = name}
+-- ;
+
+ template Profile
+ : (isDefined(types) ? types{separator = "*", forcedLower = 1} : "none")
+ ;
+-- @end Channels
+
+
+-- @begin Expressions
+ template Expression abstract operatored;
+
+ template LiteralExp
+ : value
+ ;
+
+ -- TODO: do not consider "any" as an Expression because it is only used in AssignStat
+ template AnyExp
+ : "any"
+ ;
+
+ operatorTemplate BinaryOperatorExp(operators =
+ opStar opSlash opPercent
+ opPlus opMinus2
+ opLt opGt opLe opGe opEq opNe
+ opAnd opOr
+ opAssign,
+ source = 'left', storeOpTo = operator, storeRightTo = 'right');
+
+ operatorTemplate UnaryOperatorExp(operators =
+ opNot opFull opEmpty opFirst opDequeue,
+ source = operand, storeOpTo = operator);
+
+ template EnqueueExp
+ : "enqueue" "(" target "," source ")"
+ ;
+
+ template AccessExp abstract;
+
+ template VariableExp
+ : declaration{refersTo = name}
+ ;
+
+ operatorTemplate ArrayAccessExp(operators = opLsquare, source = 'source')
+ : index "]"
+ ;
+
+ operatorTemplate NavigationExp(operators = opPoint, source = 'source')
+ : property
+ ;
+-- @end Expressions
+
+ template Literal abstract;
+
+ template BooleanVal
+ : (value ? "true" : "false")
+ ;
+
+ template NaturalVal
+ : value
+ ;
+
+ template IntegerVal
+ : (isPositive ? "+" : "-") value
+ ;
+
+ template QueueVal
+ : "new" size type
+ ;
+
+-- @begin Initializers
+ template Initializer abstract;
+
+ template LiteralInit
+ : value
+ ;
+
+ template ArrayInit
+ : "[" elements{separator = ","} "]"
+ ;
+
+ template RecordInit
+ : "{" fieldInits{separator = ","} "}"
+ ;
+
+ template FieldInit
+ : field "=" initializer
+ ;
+-- @end Initializers
+
+
+ symbols {
+ lsquarersquare = "[]";
+ lsquare = "[";
+ rsquare = "]" : rightSpace;
+ excl = "!";
+ coma = "," : leftNone, rightSpace;
+ lparen = "(";
+ rparen = ")" : leftNone, rightSpace;
+ lcurly = "{" : leftSpace;
+ rcurly = "}" : leftNone, rightSpace;
+ semi = ";" : leftNone, rightSpace;
+ colon = ":" : leftSpace, rightSpace; -- except after def where it is leftNone, rightSpace
+ pipe = "|" : leftSpace, rightSpace;
+ sharp = "#" : leftSpace;
+ qmark = "?";
+ coloncolon = "::" : leftNone, rightNone;
+ pipe3 = "|||";
+ pipelsquare = "|[";
+ rsquarepipe = "]|";
+ coloneq = ":=" : leftSpace, rightSpace;
+ pointpoint = ".." : leftNone, rightNone;
+ percent = "\\%" : leftSpace, rightSpace;
+
+ -- operator symbols
+ point = "." : leftNone;
+ rarrow = "->" : leftNone;
+ minus = "-" : leftSpace, rightSpace;
+ star = "*" : leftSpace, rightSpace;
+ slash = "/" : leftSpace, rightSpace;
+ plus = "+" : leftSpace, rightSpace;
+ eq = "=" : leftSpace, rightSpace;
+ gt = ">" : leftSpace, rightSpace;
+ lt = "<" : leftSpace, rightSpace;
+ ge = ">=" : leftSpace, rightSpace;
+ le = "<=" : leftSpace, rightSpace;
+ ne = "<>" : leftSpace, rightSpace;
+ larrow = "<-" : leftSpace, rightSpace;
+ }
+
+ operators {
+ priority 0 { -- hghest priority
+ opLsquare = lsquare, 2;
+ opPoint = point, 2;
+ }
+
+ priority 1 {
+ opNot = "not", 1;
+ opFull = "full", 1;
+ opEmpty = "empty", 1;
+ opFirst = "first", 1;
+ opDequeue = "dequeue", 1;
+ }
+
+ priority 2 {
+ opStar = star, 2;
+ opSlash = slash, 2;
+ opPercent = percent, 2;
+ }
+
+ priority 3 {
+ opPlus = plus, 2;
+ opMinus2 = minus, 2;
+ }
+
+ priority 4 {
+ opLt = lt, 2;
+ opGt = gt, 2;
+ opLe = le, 2;
+ opGe = ge, 2;
+ opEq = eq, 2;
+ opNe = ne, 2;
+ }
+
+ priority 5 {
+ opAnd = "and", 2;
+ opOr = "or", 2;
+ }
+
+ priority 6 {
+ opAssign = coloneq, 2;
+ }
+ }
+
+ token COMMENT : multiLine(start = "/*", end = "*/");
+
+ lexer = "
+%options testLiterals = false;
+
+NL
+ : ( '\\r' '\\n'
+ | '\\n' '\\r' //Improbable
+ | '\\r'
+ | '\\n'
+ )
+ {newline();}
+ ;
+
+WS
+ : ( ' '
+ | '\\t'
+ )
+ ;
+
+%protected
+DIGIT
+ : '0'..'9'
+ ;
+
+%protected
+ALPHA
+ : 'a'..'z'
+ | 'A'..'Z'
+ | '_'
+ //For Unicode compatibility (from 0000 to 00ff)
+ | '\\u00C0' .. '\\u00D6'
+ | '\\u00D8' .. '\\u00F6'
+ | '\\u00F8' .. '\\u00FF'
+ ;
+
+%protected
+SNAME
+%v2 options {
+%v2 testLiterals = true;
+%v2 }
+ : (ALPHA) (ALPHA | DIGIT)*
+;
+
+NAME
+ : (
+%v3 SNAME
+%v2 s:SNAME {if(s.getType() != SNAME) $setType(s.getType());}
+ | '\"'!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\\"'|'\\n')
+ )*
+ '\"'!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ )
+ ;
+
+INT
+ : (DIGIT)+
+//%v2 (('.' DIGIT)=> '.' (DIGIT)+ {$setType(FLOAT);})?
+ ;
+
+//%v3 FLOAT : DIGIT+ '.' DIGIT* ;
+
+%protected
+ESC
+ : '\\\\'!
+ ( 'n' %v2{%setText(\"\\n\");}
+ | 'r' %v2{%setText(\"\\r\");}
+ | 't' %v2{%setText(\"\\t\");}
+ | 'b' %v2{%setText(\"\\b\");}
+ | 'f' %v2{%setText(\"\\f\");}
+ | '\"' %v2{%setText(\"\\\"\");}
+ | '\\'' %v2{%setText(\"\\'\");}
+ | '\\\\' %v2{%setText(\"\\\\\");}
+ | (
+ ('0'..'3')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : '0'..'7'
+ )?
+ )?
+ | ('4'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ )?
+ )
+ {
+%v2 String s = %getText;
+%v2 int i;
+%v2 int ret = 0;
+%v2 String ans;
+%v2 for (i=0; i<s.length(); ++i)
+%v2 ret = ret*8 + s.charAt(i) - '0';
+%v2 ans = String.valueOf((char) ret);
+%v2 %setText(ans);
+ }
+ )
+ ;
+
+STRING
+ : '\\''!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\''|'\\n')
+ )*
+ '\\''!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ ;
+
+ ";
+
+}
diff --git a/syntaxes/FIACRE/build.properties b/syntaxes/FIACRE/build.properties
new file mode 100644
index 0000000..3028451
--- /dev/null
+++ b/syntaxes/FIACRE/build.properties
@@ -0,0 +1,2 @@
+dsl.name=FIACRE
+dsl.ext=fcr \ No newline at end of file
diff --git a/syntaxes/FPath/.project b/syntaxes/FPath/.project
new file mode 100644
index 0000000..601deda
--- /dev/null
+++ b/syntaxes/FPath/.project
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>FPath</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.gmt.tcs.builder.Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2m.atl.adt.builder.atlBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2m.atl.adt.builder.atlNature</nature>
+ </natures>
+</projectDescription>
diff --git a/syntaxes/FPath/Metamodel/FPath.km3 b/syntaxes/FPath/Metamodel/FPath.km3
new file mode 100644
index 0000000..f0d98a3
--- /dev/null
+++ b/syntaxes/FPath/Metamodel/FPath.km3
@@ -0,0 +1,94 @@
+-- @name FPath
+-- @version 1.0
+-- @authors Frédéric Jouault
+-- @date 20080124
+-- @description Metamodel of the FPath Fractal navigation language.
+-- @see http://fractal.objectweb.org/fscript/fscript_manual.pdf
+package FPath {
+
+ -- Every class should extend LocatedElement, directly or indirectly.
+ -- This is a technical constraint to support text-to-model traceability.
+ abstract class LocatedElement {
+ attribute location[0-1] : String;
+ attribute commentsBefore[*] ordered : String;
+ attribute commentsAfter[*] ordered : String;
+ }
+
+-- BEGIN DSL-specific classes (replace sample contents)
+ abstract class Expression extends LocatedElement {}
+
+ class ContextExp extends Expression {}
+
+ class VariableExp extends Expression {
+ attribute name : String;
+ }
+
+ class FunctionCallExp extends Expression {
+ attribute name : String;
+ reference arguments[*] ordered container : Expression;
+ }
+
+ class NumberExp extends Expression {
+ attribute value : Double;
+ }
+
+ class StringExp extends Expression {
+ attribute value : String;
+ }
+
+ class PathExp extends Expression {
+ reference initialNodeSet container : Expression;
+ reference steps[1-*] ordered container : Step;
+ }
+
+ abstract class OperatorExp extends Expression {
+ attribute operator : String;
+ }
+
+ class BinaryOperatorExp extends OperatorExp {
+ reference left container : Expression;
+ reference right container : Expression;
+ }
+
+ class UnaryOperatorExp extends OperatorExp {
+ reference operand container : Expression;
+ }
+
+ class Step extends LocatedElement {
+ attribute axis : Axis;
+ reference test container : Test;
+ reference predicates[*] ordered container : Expression;
+ }
+
+ abstract class Test extends LocatedElement {}
+
+ class WildcardTest extends Test {}
+
+ class NameTest extends Test {
+ attribute name : String;
+ }
+
+ enumeration Axis {
+ literal component;
+ literal "internal-interface";
+ literal interface;
+ literal "attribute";
+ literal binding;
+ literal child;
+ literal parent;
+ literal descendant;
+ literal ancestor;
+ literal sibling;
+ literal "descendant-or-self";
+ literal "ancestor-or-self";
+ literal "sibling-or-self";
+ }
+-- END DSL-specific classes
+}
+
+package PrimitiveTypes {
+ datatype Boolean;
+ datatype Double;
+ datatype Integer;
+ datatype String;
+}
diff --git a/syntaxes/FPath/Samples/README.txt b/syntaxes/FPath/Samples/README.txt
new file mode 100644
index 0000000..9383f93
--- /dev/null
+++ b/syntaxes/FPath/Samples/README.txt
@@ -0,0 +1 @@
+Samples from: http://fractal.objectweb.org/tutorials/fscript/index.html \ No newline at end of file
diff --git a/syntaxes/FPath/Samples/Test1.fp b/syntaxes/FPath/Samples/Test1.fp
new file mode 100644
index 0000000..93b6bd7
--- /dev/null
+++ b/syntaxes/FPath/Samples/Test1.fp
@@ -0,0 +1 @@
+$root/child::client/interface::server/binding::*/parent::* \ No newline at end of file
diff --git a/syntaxes/FPath/Samples/Test2.fp b/syntaxes/FPath/Samples/Test2.fp
new file mode 100644
index 0000000..c943261
--- /dev/null
+++ b/syntaxes/FPath/Samples/Test2.fp
@@ -0,0 +1 @@
+size($c/interface::*[required(.) and not(bound(.))]) > 0 \ No newline at end of file
diff --git a/syntaxes/FPath/Samples/Test3.fp b/syntaxes/FPath/Samples/Test3.fp
new file mode 100644
index 0000000..93a32b6
--- /dev/null
+++ b/syntaxes/FPath/Samples/Test3.fp
@@ -0,0 +1 @@
+$itf/sibling::*/interface::*[provided(.)][subtype(., $itf)] \ No newline at end of file
diff --git a/syntaxes/FPath/Samples/Test4.fp b/syntaxes/FPath/Samples/Test4.fp
new file mode 100644
index 0000000..be91985
--- /dev/null
+++ b/syntaxes/FPath/Samples/Test4.fp
@@ -0,0 +1 @@
+$root/descendant-or-self::*[size(./parent::*) > 1] \ No newline at end of file
diff --git a/syntaxes/FPath/Samples/Test5.fp b/syntaxes/FPath/Samples/Test5.fp
new file mode 100644
index 0000000..24d8999
--- /dev/null
+++ b/syntaxes/FPath/Samples/Test5.fp
@@ -0,0 +1 @@
+$root/child::client/interface::s/binding::*/attribute::header \ No newline at end of file
diff --git a/syntaxes/FPath/Syntax/FPath.tcs b/syntaxes/FPath/Syntax/FPath.tcs
new file mode 100644
index 0000000..406d0f8
--- /dev/null
+++ b/syntaxes/FPath/Syntax/FPath.tcs
@@ -0,0 +1,304 @@
+-- @name FPath
+-- @version 1.0
+-- @authors Frédéric Jouault
+-- @date 20080124
+-- @description Concrete syntax of the FPath Fractal navigation language.
+
+-- The different sections of a TCS model have been enclosed between BEGIN and END
+-- comments below. Additional information is provided below each BEGIN comment.
+-- The main sections of interest are "Class templates", and
+-- "Operator table" (the latter only for DSLs using operators).
+syntax FPath {
+
+-- BEGIN Primitive templates
+-- Specifies representation of primitive types.
+-- Only needs modification when default lexer is not satisfactory.
+-- Generally modified along with the lexer.
+ primitiveTemplate identifier for String default using NAME:
+ value = "%token%";
+
+ primitiveTemplate stringSymbol for String using STRING:
+ value = "%token%",
+ serializer="'\'' + %value%.toCString() + '\''";
+
+ primitiveTemplate floatSymbol for Double default using FLOAT:
+ value = "Double.valueOf(%token%)";
+-- END Primitive templates
+
+-- BEGIN Class templates
+-- Specifies representation of classes.
+-- This is the main section to work on.
+ template Expression main abstract operatored;
+
+ template ContextExp
+ : "."
+ ;
+
+ template VariableExp
+ : "$" name
+ ;
+
+ template FunctionCallExp
+ : name "(" arguments{separator = ","} ")"
+ ;
+
+ template NumberExp
+ : 'value'
+ ;
+
+ template StringExp
+ : 'value'{as = stringSymbol}
+ ;
+
+ operatorTemplate PathExp(operators = opSlash, source = initialNodeSet)
+ : steps{separator = "/"}
+ ;
+
+ operatorTemplate BinaryOperatorExp(operators =
+ opMul opDiv
+ opPlus opMinus2
+ opLt opGt opLe opGe opEq opNe
+ opAnd opOr
+ , source = 'left', storeOpTo = operator, storeRightTo = 'right'
+ );
+
+ operatorTemplate UnaryOperatorExp(operators =
+ opNot opMinus1
+ , source = operand, storeOpTo = operator
+ );
+
+ template Step
+ : axis "::" test (isDefined(predicates) ? "[" predicates{separator = "]" "["} "]")
+ ;
+
+ template Test abstract;
+
+ template WildcardTest
+ : "*"
+ ;
+
+ template NameTest
+ : name
+ ;
+
+ enumerationTemplate Axis
+ : #component = "component",
+ #'internal-interface' = "internal-interface",
+ #interface = "interface",
+ #attribute = "attribute",
+ #binding = "binding",
+ #child = "child",
+ #parent = "parent",
+ #descendant = "descendant",
+ #ancestor = "ancestor",
+ #sibling = "sibling",
+ #'descendant-or-self' = "descendant-or-self",
+ #'ancestor-or-self' = "ancestor-or-self",
+ #'sibling-or-self' = "sibling-or-self"
+ ;
+-- END Class templates
+
+-- BEGIN Special symbols
+-- Possible modifications:
+-- - Addition of new symbols.
+-- - Modification of spaces information.
+-- - Removal of unused symbols so that using these symbols results in lexical
+-- error rather than parsing error.
+ symbols {
+ lsquare = "[";
+ rsquare = "]" : rightSpace;
+ excl = "!";
+ coma = "," : leftNone, rightSpace;
+ lparen = "(";
+ rparen = ")" : leftNone, rightSpace;
+ lcurly = "{" : leftSpace;
+ rcurly = "}" : leftNone, rightSpace;
+ semi = ";" : leftNone, rightSpace;
+ colon = ":" : leftSpace, rightSpace;
+ coloncolon = "::" : leftNone, rightNone;
+ pipe = "|" : leftSpace, rightSpace;
+ sharp = "#" : leftSpace;
+ qmark = "?";
+
+ -- operator symbols
+ point = "." : leftNone;
+ rarrow = "->" : leftNone;
+ minus = "-" : leftSpace, rightSpace;
+ star = "*" : leftSpace, rightSpace;
+ slash = "/" : leftSpace, rightSpace;
+ plus = "+" : leftSpace, rightSpace;
+ eq = "=" : leftSpace, rightSpace;
+ eqeq = "==" : leftSpace, rightSpace;
+ gt = ">" : leftSpace, rightSpace;
+ lt = "<" : leftSpace, rightSpace;
+ ge = ">=" : leftSpace, rightSpace;
+ le = "<=" : leftSpace, rightSpace;
+ ne = "<>" : leftSpace, rightSpace;
+ larrow = "<-" : leftSpace, rightSpace;
+ }
+-- END Special symbols
+
+-- BEGIN Operator table
+-- Defines all operators with their priority, arity, and associativity.
+-- All defined operators must be used in operator templates.
+ operators {
+ priority 0 { -- highest priority
+ opSlash = slash, 2;
+ }
+
+ priority 1 {
+ opNot = "not", 1;
+ opMinus1 = minus, 1;
+ }
+
+ priority 2 {
+ opMul = star, 2;
+ opDiv = "div", 2;
+ }
+
+ priority 3 {
+ opPlus = plus, 2;
+ opMinus2 = minus, 2;
+ }
+
+ priority 4 {
+ opLt = lt, 2;
+ opGt = gt, 2;
+ opLe = le, 2;
+ opGe = ge, 2;
+ opEq = eqeq, 2;
+ opNe = ne, 2;
+ }
+
+ priority 5 {
+ opAnd = "and", 2;
+ opOr = "or", 2;
+ }
+ }
+-- END Operator table
+
+
+-- BEGIN Lexer
+-- Specifies the lexical entities.
+-- Only needs modification when default lexer is not satisfactory.
+-- Generally modified along with Primitive templates.
+ token COMMENT : endOfLine(start = "--");
+
+ lexer = "
+%options testLiterals = false;
+
+NL
+ : ( '\\r' '\\n'
+ | '\\n' '\\r' //Improbable
+ | '\\r'
+ | '\\n'
+ )
+ {newline();}
+ ;
+
+WS
+ : ( ' '
+ | '\\t'
+ )
+ ;
+
+%protected
+DIGIT
+ : '0'..'9'
+ ;
+
+%protected
+ALPHA
+ : 'a'..'z'
+ | 'A'..'Z'
+ | '_'
+ //For Unicode compatibility (from 0000 to 00ff)
+ | '\\u00C0' .. '\\u00D6'
+ | '\\u00D8' .. '\\u00F6'
+ | '\\u00F8' .. '\\u00FF'
+ ;
+
+%protected
+SNAME
+%v2 options {
+%v2 testLiterals = true;
+%v2 }
+ : (ALPHA) (ALPHA | DIGIT)*
+;
+
+NAME
+ : (
+%v3 SNAME
+%v2 s:SNAME {if(s.getType() != SNAME) $setType(s.getType());}
+ | '\"'!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\\"'|'\\n')
+ )*
+ '\"'!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ )
+ ;
+
+%v3 FLOAT : DIGIT+ ('.' DIGIT*)? ;
+
+%protected
+ESC
+ : '\\\\'!
+ ( 'n' %v2{%setText(\"\\n\");}
+ | 'r' %v2{%setText(\"\\r\");}
+ | 't' %v2{%setText(\"\\t\");}
+ | 'b' %v2{%setText(\"\\b\");}
+ | 'f' %v2{%setText(\"\\f\");}
+ | '\"' %v2{%setText(\"\\\"\");}
+ | '\\'' %v2{%setText(\"\\'\");}
+ | '\\\\' %v2{%setText(\"\\\\\");}
+ | (
+ ('0'..'3')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : '0'..'7'
+ )?
+ )?
+ | ('4'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ )?
+ )
+ {
+%v2 String s = %getText;
+%v2 int i;
+%v2 int ret = 0;
+%v2 String ans;
+%v2 for (i=0; i<s.length(); ++i)
+%v2 ret = ret*8 + s.charAt(i) - '0';
+%v2 ans = String.valueOf((char) ret);
+%v2 %setText(ans);
+ }
+ )
+ ;
+
+STRING
+ : '\\''!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\''|'\\n')
+ )*
+ '\\''!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ ;
+
+ ";
+-- END Lexer
+
+}
diff --git a/syntaxes/FPath/build.properties b/syntaxes/FPath/build.properties
new file mode 100644
index 0000000..8afeffd
--- /dev/null
+++ b/syntaxes/FPath/build.properties
@@ -0,0 +1,2 @@
+dsl.name=FPath
+dsl.ext=fp
diff --git a/syntaxes/FScript/.project b/syntaxes/FScript/.project
new file mode 100644
index 0000000..790495b
--- /dev/null
+++ b/syntaxes/FScript/.project
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>FScript</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.gmt.tcs.builder.Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2m.atl.adt.builder.atlBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2m.atl.adt.builder.atlNature</nature>
+ </natures>
+</projectDescription>
diff --git a/syntaxes/FScript/Metamodel/FScript.km3 b/syntaxes/FScript/Metamodel/FScript.km3
new file mode 100644
index 0000000..8292d4a
--- /dev/null
+++ b/syntaxes/FScript/Metamodel/FScript.km3
@@ -0,0 +1,150 @@
+-- @name FScript
+-- @version 1.0
+-- @authors Frédéric Jouault
+-- @date 20080205
+-- @description Metamodel of the FScript Fractal action language. This metamodel includes the FPath metamodel.
+-- @see http://fractal.objectweb.org/fscript/fscript_manual.pdf
+package FScript {
+
+ -- Every class should extend LocatedElement, directly or indirectly.
+ -- This is a technical constraint to support text-to-model traceability.
+ abstract class LocatedElement {
+ attribute location[0-1] : String;
+ attribute commentsBefore[*] ordered : String;
+ attribute commentsAfter[*] ordered : String;
+ }
+
+-- BEGIN DSL-specific classes (replace sample contents)
+ abstract class Procedure extends LocatedElement {
+ attribute name : String;
+ reference parameters[*] ordered container : VariableDefinition;
+ reference body container : Block;
+ }
+
+ class Function extends Procedure {}
+
+ class Action extends Procedure {}
+
+ class VariableDefinition extends LocatedElement {
+ attribute name : String;
+ }
+
+ class Block extends LocatedElement {
+ reference statements[*] ordered container : ControlStructure;
+ reference freeVariables[*] ordered container : VariableDefinition;
+ }
+-- @begin Control Structures
+ abstract class ControlStructure extends LocatedElement {}
+
+ class VariableAssignment extends ControlStructure {
+ reference variable : VariableDefinition;
+ reference value container : Expression;
+ }
+
+ class Conditional extends ControlStructure {
+ reference condition container : Expression;
+ reference then container : Block;
+ reference else[0-1] container : Block;
+ }
+
+ class Iteration extends ControlStructure {
+ reference variable container : VariableDefinition;
+ reference source container : Expression;
+ reference body container : Block;
+ }
+
+ class ReturnStat extends ControlStructure {
+ reference expression[0-1] container : Expression;
+ }
+
+ abstract class PrimitiveAction extends ControlStructure {}
+
+ class BindAction extends PrimitiveAction {
+ reference clientInterface container : Expression;
+ reference serverInterface container : Expression;
+ }
+-- @end Control Structures
+-- END DSL-specific classes
+}
+
+-- FPath metamodel elements copied from the FPath Language Project.
+package FPath {
+
+-- BEGIN DSL-specific classes (replace sample contents)
+ abstract class Expression extends LocatedElement {}
+
+ class ContextExp extends Expression {}
+
+ class VariableExp extends Expression {
+ reference definition : VariableDefinition;
+ }
+
+ class FunctionCallExp extends Expression {
+ attribute name : String;
+ reference arguments[*] ordered container : Expression;
+ }
+
+ class NumberExp extends Expression {
+ attribute value : Double;
+ }
+
+ class StringExp extends Expression {
+ attribute value : String;
+ }
+
+ class PathExp extends Expression {
+ reference initialNodeSet container : Expression;
+ reference steps[1-*] ordered container : Step;
+ }
+
+ abstract class OperatorExp extends Expression {
+ attribute operator : String;
+ }
+
+ class BinaryOperatorExp extends OperatorExp {
+ reference left container : Expression;
+ reference right container : Expression;
+ }
+
+ class UnaryOperatorExp extends OperatorExp {
+ reference operand container : Expression;
+ }
+
+ class Step extends LocatedElement {
+ attribute axis : Axis;
+ reference test container : Test;
+ reference predicates[*] ordered container : Expression;
+ }
+
+ abstract class Test extends LocatedElement {}
+
+ class WildcardTest extends Test {}
+
+ class NameTest extends Test {
+ attribute name : String;
+ }
+
+ enumeration Axis {
+ literal component;
+ literal "internal-interface";
+ literal interface;
+ literal "attribute";
+ literal binding;
+ literal child;
+ literal parent;
+ literal descendant;
+ literal ancestor;
+ literal sibling;
+ literal "descendant-or-self";
+ literal "ancestor-or-self";
+ literal "sibling-or-self";
+ }
+-- END DSL-specific classes
+}
+
+package PrimitiveTypes {
+ datatype Boolean;
+ datatype Double;
+ datatype Integer;
+ datatype String;
+}
diff --git a/syntaxes/FScript/Samples/README.txt b/syntaxes/FScript/Samples/README.txt
new file mode 100644
index 0000000..9383f93
--- /dev/null
+++ b/syntaxes/FScript/Samples/README.txt
@@ -0,0 +1 @@
+Samples from: http://fractal.objectweb.org/tutorials/fscript/index.html \ No newline at end of file
diff --git a/syntaxes/FScript/Samples/Test1.fs b/syntaxes/FScript/Samples/Test1.fs
new file mode 100644
index 0000000..91bce7a
--- /dev/null
+++ b/syntaxes/FScript/Samples/Test1.fs
@@ -0,0 +1,13 @@
+action auto-bind(comp) {
+ // Selects the interfaces to connect
+ clients = $comp/interface::*[required(.)][not(bound(.))];
+ for itf : $clients {
+ // Search for candidates compatible interfaces
+ candidates = $comp/sibling::*/interface::*[compatible($itf, .)];
+ if (not(empty($candidates))) {
+ // Connect one of these candidates
+ bind($itf, one-of($candidates));
+ }
+ }
+ return size($comp/interface::*[required(.)][not(bound(.))]) == 0;
+} \ No newline at end of file
diff --git a/syntaxes/FScript/Syntax/FScript.tcs b/syntaxes/FScript/Syntax/FScript.tcs
new file mode 100644
index 0000000..c34382b
--- /dev/null
+++ b/syntaxes/FScript/Syntax/FScript.tcs
@@ -0,0 +1,349 @@
+-- @name FScript
+-- @version 1.0
+-- @authors Frédéric Jouault
+-- @date 20080205
+-- @description Concrete syntax of the FScript Fractal action language.
+
+-- The different sections of a TCS model have been enclosed between BEGIN and END
+-- comments below. Additional information is provided below each BEGIN comment.
+-- The main sections of interest are "Class templates", and
+-- "Operator table" (the latter only for DSLs using operators).
+syntax FScript {
+
+-- BEGIN Primitive templates
+-- Specifies representation of primitive types.
+-- Only needs modification when default lexer is not satisfactory.
+-- Generally modified along with the lexer.
+ primitiveTemplate identifier for String default using NAME:
+ value = "%token%";
+
+ primitiveTemplate stringSymbol for String using STRING:
+ value = "%token%",
+ serializer="'\'' + %value%.toCString() + '\''";
+
+ primitiveTemplate floatSymbol for Double default using FLOAT:
+ value = "Double.valueOf(%token%)";
+-- END Primitive templates
+
+-- BEGIN Class templates
+-- Specifies representation of classes.
+-- This is the main section to work on.
+ template Procedure main abstract;
+
+ template Action context
+ : "action" name "(" parameters{separator = ","} ")" body
+ ;
+
+ template VariableDefinition addToContext
+ : name
+ ;
+
+ template Block context
+ : "{" [
+ statements
+ ] "}"
+ ;
+
+-- @begin Control Structures
+ template ControlStructure abstract;
+
+ template VariableAssignment
+ : variable{refersTo = name, autoCreate = ifmissing, createIn = '#context'.freeVariables} "=" value ";"
+ ;
+
+ template Conditional
+ : "if" "(" condition ")" then
+ (isDefined(else) ? "else" else)
+ ;
+
+ template Iteration
+ : "for" variable ":" source body
+ ;
+
+ template ReturnStat
+ : "return" (isDefined(expression) ? expression) ";"
+ ;
+
+ template PrimitiveAction abstract;
+
+ template BindAction
+ : "bind" "(" clientInterface "," serverInterface ")" ";"
+ ;
+-- @end Control Structures
+
+-- @begin FPath (copied from FPath.tcs in the FPath Language Project)
+ template Expression abstract operatored;
+
+ template ContextExp
+ : "."
+ ;
+
+ template VariableExp
+ : "$" definition{refersTo = name}
+ ;
+
+ template FunctionCallExp
+ : name "(" arguments{separator = ","} ")"
+ ;
+
+ template NumberExp
+ : 'value'
+ ;
+
+ template StringExp
+ : 'value'{as = stringSymbol}
+ ;
+
+ operatorTemplate PathExp(operators = opSlash, source = initialNodeSet)
+ : steps{separator = "/"}
+ ;
+
+ operatorTemplate BinaryOperatorExp(operators =
+ opMul opDiv
+ opPlus opMinus2
+ opLt opGt opLe opGe opEq opNe
+ opAnd opOr
+ , source = 'left', storeOpTo = operator, storeRightTo = 'right'
+ );
+
+ operatorTemplate UnaryOperatorExp(operators =
+ opNot opMinus1
+ , source = operand, storeOpTo = operator
+ );
+
+ template Step
+ : axis "::" test (isDefined(predicates) ? "[" predicates{separator = "]" "["} "]")
+ ;
+
+ template Test abstract;
+
+ template WildcardTest
+ : "*"
+ ;
+
+ template NameTest
+ : name
+ ;
+
+ enumerationTemplate Axis
+ : #component = "component",
+ #'internal-interface' = "internal-interface",
+ #interface = "interface",
+ #attribute = "attribute",
+ #binding = "binding",
+ #child = "child",
+ #parent = "parent",
+ #descendant = "descendant",
+ #ancestor = "ancestor",
+ #sibling = "sibling",
+ #'descendant-or-self' = "descendant-or-self",
+ #'ancestor-or-self' = "ancestor-or-self",
+ #'sibling-or-self' = "sibling-or-self"
+ ;
+-- @end FPath
+-- END Class templates
+
+-- BEGIN Special symbols
+-- Possible modifications:
+-- - Addition of new symbols.
+-- - Modification of spaces information.
+-- - Removal of unused symbols so that using these symbols results in lexical
+-- error rather than parsing error.
+ symbols {
+ lsquare = "[";
+ rsquare = "]" : rightSpace;
+ excl = "!";
+ coma = "," : leftNone, rightSpace;
+ lparen = "(";
+ rparen = ")" : leftNone, rightSpace;
+ lcurly = "{" : leftSpace;
+ rcurly = "}" : leftNone, rightSpace;
+ semi = ";" : leftNone, rightSpace;
+ colon = ":" : leftSpace, rightSpace;
+ pipe = "|" : leftSpace, rightSpace;
+ sharp = "#" : leftSpace;
+ qmark = "?";
+ coloncolon = "::" : leftNone, rightNone;
+
+ -- operator symbols
+ point = "." : leftNone;
+ rarrow = "->" : leftNone;
+ minus = "-" : leftSpace, rightSpace;
+ star = "*" : leftSpace, rightSpace;
+ slash = "/" : leftSpace, rightSpace;
+ plus = "+" : leftSpace, rightSpace;
+ eq = "=" : leftSpace, rightSpace;
+ eqeq = "==" : leftSpace, rightSpace;
+ gt = ">" : leftSpace, rightSpace;
+ lt = "<" : leftSpace, rightSpace;
+ ge = ">=" : leftSpace, rightSpace;
+ le = "<=" : leftSpace, rightSpace;
+ ne = "<>" : leftSpace, rightSpace;
+ larrow = "<-" : leftSpace, rightSpace;
+ }
+-- END Special symbols
+
+-- BEGIN Operator table
+-- Defines all operators with their priority, arity, and associativity.
+-- All defined operators must be used in operator templates.
+ operators {
+ priority 0 { -- highest priority
+ opSlash = slash, 2;
+ }
+
+ priority 1 {
+ opNot = "not", 1;
+ opMinus1 = minus, 1;
+ }
+
+ priority 2 {
+ opMul = star, 2;
+ opDiv = "div", 2;
+ }
+
+ priority 3 {
+ opPlus = plus, 2;
+ opMinus2 = minus, 2;
+ }
+
+ priority 4 {
+ opLt = lt, 2;
+ opGt = gt, 2;
+ opLe = le, 2;
+ opGe = ge, 2;
+ opEq = eqeq, 2;
+ opNe = ne, 2;
+ }
+
+ priority 5 {
+ opAnd = "and", 2;
+ opOr = "or", 2;
+ }
+ }
+-- END Operator table
+
+
+-- BEGIN Lexer
+-- Specifies the lexical entities.
+-- Only needs modification when default lexer is not satisfactory.
+-- Generally modified along with Primitive templates.
+ token COMMENT : endOfLine(start = "//");
+
+ lexer = "
+%options testLiterals = false;
+
+NL
+ : ( '\\r' '\\n'
+ | '\\n' '\\r' //Improbable
+ | '\\r'
+ | '\\n'
+ )
+ {newline();}
+ ;
+
+WS
+ : ( ' '
+ | '\\t'
+ )
+ ;
+
+%protected
+DIGIT
+ : '0'..'9'
+ ;
+
+%protected
+ALPHA
+ : 'a'..'z'
+ | 'A'..'Z'
+ | '_'
+ //For Unicode compatibility (from 0000 to 00ff)
+ | '\\u00C0' .. '\\u00D6'
+ | '\\u00D8' .. '\\u00F6'
+ | '\\u00F8' .. '\\u00FF'
+ ;
+
+%protected
+SNAME
+%v2 options {
+%v2 testLiterals = true;
+%v2 }
+ : (ALPHA) (ALPHA | '-' | DIGIT)*
+;
+
+NAME
+ : (
+%v3 SNAME
+%v2 s:SNAME {if(s.getType() != SNAME) $setType(s.getType());}
+ | '\"'!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\\"'|'\\n')
+ )*
+ '\"'!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ )
+ ;
+
+%v3 FLOAT : DIGIT+ ('.' DIGIT*)? ;
+
+%protected
+ESC
+ : '\\\\'!
+ ( 'n' %v2{%setText(\"\\n\");}
+ | 'r' %v2{%setText(\"\\r\");}
+ | 't' %v2{%setText(\"\\t\");}
+ | 'b' %v2{%setText(\"\\b\");}
+ | 'f' %v2{%setText(\"\\f\");}
+ | '\"' %v2{%setText(\"\\\"\");}
+ | '\\'' %v2{%setText(\"\\'\");}
+ | '\\\\' %v2{%setText(\"\\\\\");}
+ | (
+ ('0'..'3')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : '0'..'7'
+ )?
+ )?
+ | ('4'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ )?
+ )
+ {
+%v2 String s = %getText;
+%v2 int i;
+%v2 int ret = 0;
+%v2 String ans;
+%v2 for (i=0; i<s.length(); ++i)
+%v2 ret = ret*8 + s.charAt(i) - '0';
+%v2 ans = String.valueOf((char) ret);
+%v2 %setText(ans);
+ }
+ )
+ ;
+
+STRING
+ : '\\''!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\''|'\\n')
+ )*
+ '\\''!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ ;
+
+ ";
+-- END Lexer
+
+}
diff --git a/syntaxes/FScript/build.properties b/syntaxes/FScript/build.properties
new file mode 100644
index 0000000..f7955f6
--- /dev/null
+++ b/syntaxes/FScript/build.properties
@@ -0,0 +1,2 @@
+dsl.name=FScript
+dsl.ext=fs
diff --git a/syntaxes/Kmelia/.project b/syntaxes/Kmelia/.project
new file mode 100644
index 0000000..2ff1fb9
--- /dev/null
+++ b/syntaxes/Kmelia/.project
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Kmelia</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.gmt.tcs.builder.Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2m.atl.adt.builder.atlBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2m.atl.adt.builder.atlNature</nature>
+ </natures>
+</projectDescription>
diff --git a/syntaxes/Kmelia/Metamodel/Kmelia.km3 b/syntaxes/Kmelia/Metamodel/Kmelia.km3
new file mode 100644
index 0000000..9ba463b
--- /dev/null
+++ b/syntaxes/Kmelia/Metamodel/Kmelia.km3
@@ -0,0 +1,97 @@
+-- @name Kmelia
+-- @version 1.0
+-- @authors Frédéric Jouault
+-- @date 2007/10/17
+-- @description Abstract syntax of a subset of the Kmelia component language.
+package Kmelia {
+
+ -- Every class should extend LocatedElement, directly or indirectly.
+ -- This is a technical constraint to support text-to-model traceability.
+ abstract class LocatedElement {
+ attribute location[0-1] : String;
+ attribute commentsBefore[*] ordered : String;
+ attribute commentsAfter[*] ordered : String;
+ }
+
+-- BEGIN DSL-specific classes (replace sample contents)
+ class Component extends LocatedElement {
+ attribute name : String;
+ reference provides[*] ordered : Service;
+ reference requires[*] ordered : Service;
+ reference services[*] ordered container : Service;
+ }
+
+ abstract class Service extends LocatedElement {
+ attribute name : String;
+ attribute isRequired : Boolean;
+ }
+
+ class ExternalService extends Service {}
+
+ class InternalService extends Service {
+ reference parameters[*] ordered container : Parameter;
+ attribute returnType[0-1] : String;
+ reference body[0-1] container : Body;
+ }
+
+ class Parameter extends LocatedElement {
+ attribute name : String;
+ attribute type : String;
+ }
+
+ class Body extends LocatedElement {
+ reference interface container : Interface;
+ reference behavior[0-1] container : Behavior;
+ }
+
+ class Interface extends LocatedElement {}
+
+ class Behavior extends LocatedElement {
+ reference initialState : State;
+ reference finalStates[1-*] ordered : State;
+ reference states[1-*] ordered container : State;
+ reference transitions[1-*] ordered container : Transition;
+ }
+
+ class State extends LocatedElement {
+ attribute name : String;
+ }
+
+ class Transition extends LocatedElement {
+ reference source : State;
+ reference target : State;
+ reference actions[*] ordered container : Action;
+ }
+
+-- @begin Actions
+ abstract class Action extends LocatedElement {}
+
+ class FunctionCall extends Action {
+ attribute name : String;
+ reference arguments[*] ordered container : Expression;
+ }
+
+ abstract class Communication extends Action {
+ attribute channel : String;
+ }
+
+ class ServiceCall extends Communication {
+ attribute name : String;
+ }
+-- @end Actions
+
+-- @begin Expressions
+ abstract class Expression extends LocatedElement {}
+
+ class StringExp extends Expression {
+ attribute value : String;
+ }
+-- @end Expressions
+-- END DSL-specific classes
+}
+
+package PrimitiveTypes {
+ datatype Boolean;
+ datatype Integer;
+ datatype String;
+}
diff --git a/syntaxes/Kmelia/Syntax/Kmelia.tcs b/syntaxes/Kmelia/Syntax/Kmelia.tcs
new file mode 100644
index 0000000..e133744
--- /dev/null
+++ b/syntaxes/Kmelia/Syntax/Kmelia.tcs
@@ -0,0 +1,292 @@
+-- @name Kmelia
+-- @version 1.0
+-- @authors Frédéric Jouault
+-- @date 2007/10/17
+-- @description Concrete syntax of the Kmelia language.
+
+-- The different sections of a TCS model have been enclosed between BEGIN and END
+-- comments below. Additional information is provided below each BEGIN comment.
+-- The main sections of interest are "Class templates", and
+-- "Operator table" (the latter only for DSLs using operators).
+syntax Kmelia {
+
+-- BEGIN Primitive templates
+-- Specifies representation of primitive types.
+-- Only needs modification when default lexer is not satisfactory.
+-- Generally modified along with the lexer.
+ primitiveTemplate identifier for String default using NAME:
+ value = "%token%";
+
+ primitiveTemplate stringSymbol for String using STRING:
+ value = "%token%",
+ serializer="'\'' + %value%.toCString() + '\''";
+
+ primitiveTemplate integerSymbol for Integer default using INT:
+ value = "Integer.valueOf(%token%)";
+
+ primitiveTemplate floatSymbol for Double default using FLOAT:
+ value = "Double.valueOf(%token%)";
+-- END Primitive templates
+
+-- BEGIN Class templates
+-- Specifies representation of classes.
+-- This is the main section to work on.
+ template Component main context
+ : "COMPONENT" name
+ "INTERFACE"
+ "provides" ":" "{" provides{refersTo = name, separator = ","} "}"
+ "requires" ":" "{" requires{refersTo = name, separator = ","} "}"
+ "SERVICES"
+ services
+ "END_SERVICES"
+ ;
+
+ template Service abstract;
+
+ template ExternalService addToContext
+ : (isRequired ? "required" : "provided") "external" name
+ ;
+
+ template InternalService addToContext
+ : (isRequired ? "required" : "provided") name
+ "(" parameters{separator = ","} ")"
+ (isDefined(returnType) ? ":" returnType)
+ (isDefined(body) ? body)
+ "end"
+ ;
+
+ template Parameter
+ : name ":" type
+ ;
+
+ template Body
+ : interface
+ (isDefined(behavior) ? "Behavior" behavior)
+ ;
+
+ template Interface
+ : "Interface"
+ ;
+
+ template Behavior context
+ : "init" initialState{refersTo = name, createIn = '#context'.states, autoCreate = ifmissing}
+ "final" finalStates{refersTo = name, createIn = '#context'.states, autoCreate = ifmissing, separator = ","}
+ "{"
+ transitions{separator = ","}
+ "}"
+ ;
+
+ template State addToContext
+ : name
+ ;
+
+ template Transition
+ : source{refersTo = name, createIn = '#context'.states, autoCreate = ifmissing} "--"
+ actions{separator = ","}
+ "-->" target{refersTo = name, createIn = '#context'.states, autoCreate = ifmissing}
+ ;
+
+-- @begin Actions
+ template Action abstract;
+
+ template FunctionCall
+ : name "(" arguments{separator = ","} ")"
+ ;
+
+ template Communication abstract;
+
+ template ServiceCall
+ : channel "!!" name "(" ")"
+ ;
+-- @end Actions
+
+-- @begin Expressions
+ template Expression abstract;
+
+ template StringExp
+ : value
+ ;
+-- @end Expressions
+-- END Class templates
+
+-- BEGIN Special symbols
+-- Possible modifications:
+-- - Addition of new symbols.
+-- - Modification of spaces information.
+-- - Removal of unused symbols so that using these symbols results in lexical
+-- error rather than parsing error.
+ symbols {
+ lsquare = "[";
+ rsquare = "]" : rightSpace;
+ excl = "!";
+ exclexcl = "!!";
+ coma = "," : leftNone, rightSpace;
+ lparen = "(";
+ rparen = ")" : leftNone, rightSpace;
+ lcurly = "{" : leftSpace;
+ rcurly = "}" : leftNone, rightSpace;
+ semi = ";" : leftNone, rightSpace;
+ colon = ":" : leftSpace, rightSpace;
+ pipe = "|" : leftSpace, rightSpace;
+ sharp = "#" : leftSpace;
+ qmark = "?";
+ coloncolon = "::" : leftNone, rightNone;
+
+ -- operator symbols
+ point = "." : leftNone;
+ minusminus = "--" : leftSpace, rightSpace;
+ rlarrow = "-->" : leftSpace, rightSpace;
+ rarrow = "->" : leftNone;
+ minus = "-" : leftSpace, rightSpace;
+ star = "*" : leftSpace, rightSpace;
+ slash = "/" : leftSpace, rightSpace;
+ plus = "+" : leftSpace, rightSpace;
+ eq = "=" : leftSpace, rightSpace;
+ gt = ">" : leftSpace, rightSpace;
+ lt = "<" : leftSpace, rightSpace;
+ ge = ">=" : leftSpace, rightSpace;
+ le = "<=" : leftSpace, rightSpace;
+ ne = "<>" : leftSpace, rightSpace;
+ larrow = "<-" : leftSpace, rightSpace;
+ }
+-- END Special symbols
+
+-- BEGIN Operator table
+-- Defines all operators with their priority, arity, and associativity.
+-- All defined operators must be used in operator templates.
+
+-- Specify operator table(s) here if necessary.
+
+-- END Operator table
+
+
+-- BEGIN Lexer
+-- Specifies the lexical entities.
+-- Only needs modification when default lexer is not satisfactory.
+-- Generally modified along with Primitive templates.
+ token COMMENT : endOfLine(start = "#") |
+ multiLine(start = "/*", end = "*/");
+
+ lexer = "
+%options testLiterals = false;
+
+NL
+ : ( '\\r' '\\n'
+ | '\\n' '\\r' //Improbable
+ | '\\r'
+ | '\\n'
+ )
+ {newline();}
+ ;
+
+WS
+ : ( ' '
+ | '\\t'
+ )
+ ;
+
+%protected
+DIGIT
+ : '0'..'9'
+ ;
+
+%protected
+ALPHA
+ : 'a'..'z'
+ | 'A'..'Z'
+ | '_'
+ //For Unicode compatibility (from 0000 to 00ff)
+ | '\\u00C0' .. '\\u00D6'
+ | '\\u00D8' .. '\\u00F6'
+ | '\\u00F8' .. '\\u00FF'
+ ;
+
+%protected
+SNAME
+%v2 options {
+%v2 testLiterals = true;
+%v2 }
+ : (ALPHA) (ALPHA | DIGIT)*
+;
+
+NAME
+ : (
+%v3 SNAME
+%v2 s:SNAME {if(s.getType() != SNAME) $setType(s.getType());}
+ | '\"'!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\\"'|'\\n')
+ )*
+ '\"'!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ )
+ ;
+
+INT
+ : (DIGIT)+
+%v2 (('.' DIGIT)=> '.' (DIGIT)+ {$setType(FLOAT);})?
+ ;
+
+%v3 FLOAT : DIGIT+ '.' DIGIT* ;
+
+%protected
+ESC
+ : '\\\\'!
+ ( 'n' %v2{%setText(\"\\n\");}
+ | 'r' %v2{%setText(\"\\r\");}
+ | 't' %v2{%setText(\"\\t\");}
+ | 'b' %v2{%setText(\"\\b\");}
+ | 'f' %v2{%setText(\"\\f\");}
+ | '\"' %v2{%setText(\"\\\"\");}
+ | '\\'' %v2{%setText(\"\\'\");}
+ | '\\\\' %v2{%setText(\"\\\\\");}
+ | (
+ ('0'..'3')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : '0'..'7'
+ )?
+ )?
+ | ('4'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ )?
+ )
+ {
+%v2 String s = %getText;
+%v2 int i;
+%v2 int ret = 0;
+%v2 String ans;
+%v2 for (i=0; i<s.length(); ++i)
+%v2 ret = ret*8 + s.charAt(i) - '0';
+%v2 ans = String.valueOf((char) ret);
+%v2 %setText(ans);
+ }
+ )
+ ;
+
+STRING
+ : '\\''!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\''|'\\n')
+ )*
+ '\\''!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ ;
+
+ ";
+-- END Lexer
+
+}
diff --git a/syntaxes/Kmelia/build.properties b/syntaxes/Kmelia/build.properties
new file mode 100644
index 0000000..3573a48
--- /dev/null
+++ b/syntaxes/Kmelia/build.properties
@@ -0,0 +1,2 @@
+dsl.name=Kmelia
+dsl.ext=cmp
diff --git a/syntaxes/LOTOS/.project b/syntaxes/LOTOS/.project
new file mode 100644
index 0000000..91dd6d8
--- /dev/null
+++ b/syntaxes/LOTOS/.project
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>LOTOS</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.m2m.atl.adt.builder.atlBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.gmt.tcs.builder.Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2m.atl.adt.builder.atlNature</nature>
+ </natures>
+</projectDescription>
diff --git a/syntaxes/LOTOS/Metamodel/LOTOS.ann b/syntaxes/LOTOS/Metamodel/LOTOS.ann
new file mode 100644
index 0000000..22441aa
--- /dev/null
+++ b/syntaxes/LOTOS/Metamodel/LOTOS.ann
@@ -0,0 +1,2 @@
+annotate LOTOS {
+} \ No newline at end of file
diff --git a/syntaxes/LOTOS/Metamodel/LOTOS.km3 b/syntaxes/LOTOS/Metamodel/LOTOS.km3
new file mode 100644
index 0000000..135332c
--- /dev/null
+++ b/syntaxes/LOTOS/Metamodel/LOTOS.km3
@@ -0,0 +1,224 @@
+-- @name LOTOS
+-- @version 1.0
+-- @domains Formal specification
+-- @authors Frédéric Jouault
+-- @date 2007/05/21
+-- @description This is a LOTOS (Language Of Temporal Ordering Specification, ISO 8807) metamodel.
+-- @see http://www.inrialpes.fr/vasy/cadp/
+package LOTOS {
+
+ abstract class LocatedElement {
+ attribute location[0-1] : String;
+ attribute commentsBefore[*] ordered : String;
+ attribute commentsAfter[*] ordered : String;
+ }
+
+ abstract class NamedElement extends LocatedElement {
+ attribute name : String;
+ }
+
+ class Specification extends NamedElement {
+ attribute gates[*] ordered : String;
+ reference parameters[*] ordered container : Parameter;
+ attribute isExit : Boolean;
+ reference types[*] ordered container : Type;
+ reference definition[0-1] container : Definition;
+ }
+
+ class Definition extends LocatedElement {
+ reference behaviour container : Behaviour;
+ reference declarations[*] ordered container : TypeOrProcessDeclaration;
+ }
+
+ abstract class TypeOrProcessDeclaration extends NamedElement {}
+
+ class Process extends TypeOrProcessDeclaration {
+ attribute gates[*] ordered : String;
+ reference variables[*] ordered container : VariableDeclarations;
+ reference parameters[*] ordered container : Parameter;
+ reference definition container : Definition;
+ attribute isExit : Boolean;
+ }
+
+-- @begin Behaviour
+ abstract class Behaviour extends LocatedElement {
+ }
+
+ class Let extends Behaviour {
+ reference variables container : VariableDeclarations;
+ reference value container : Value;
+ reference behaviour container : Behaviour;
+ }
+
+ class Choice extends Behaviour {
+ reference variables container : VariableDeclarations;
+ reference behaviour container : Behaviour;
+ }
+
+ class Hide extends Behaviour {
+ attribute gates[*] ordered : String;
+ reference behaviour container : Behaviour;
+ }
+
+ class ProcessCall extends Behaviour, NamedElement {
+ attribute gates[*] ordered : String;
+ reference arguments[*] ordered container : Value;
+ }
+
+ abstract class Parallel extends Behaviour {
+ reference left container : Behaviour;
+ reference right container : Behaviour;
+ }
+
+ class SimpleParallel extends Parallel {}
+
+ class GatedParallel extends Parallel {
+ attribute gates[*] ordered : String;
+ }
+
+ class GuardedBehaviour extends Behaviour {
+ reference guard container : GuardExpression;
+ reference behaviour container : Behaviour;
+ }
+
+ class ActionBehaviour extends Behaviour {
+ reference action container : Action;
+ reference behaviour container : Behaviour;
+ }
+
+ class Alternative extends Behaviour {
+ reference left container : Behaviour;
+ reference right container : Behaviour;
+ }
+-- @end Behaviour
+
+-- @begin Actions
+ abstract class Action extends LocatedElement {
+ }
+
+ class GateAction extends Action {
+ attribute gate : String;
+ reference communications[*] ordered container : Communication;
+ reference guard[0-1] container : GuardExpression;
+ }
+
+ abstract class Communication extends LocatedElement {}
+
+ class InComm extends Communication {
+ reference declarations container : VariableDeclarations;
+ }
+
+ class OutComm extends Communication {
+ reference value container : Value;
+ }
+-- @end Actions
+
+-- @begin Guards
+ abstract class GuardExpression extends LocatedElement {}
+
+ class EqualityTestGuardExp extends GuardExpression {
+ reference left container : Value;
+ reference right container : Value;
+ }
+
+ class BooleanGuardExp extends GuardExpression {
+ reference value container : Value;
+ }
+-- @end Guards
+
+-- @begin Values
+ abstract class Value extends LocatedElement {
+ }
+
+ class Variable extends Value {
+ reference declaration : Declaration;
+ }
+
+ class OperationCall extends Value {
+ attribute operationName : String;
+ reference arguments[*] ordered container : Value;
+ }
+
+ class OperatorCall extends Value {
+ attribute operatorName : String;
+ reference left container : Value;
+ reference right container : Value;
+ }
+
+ class IntegerVal extends Value {
+ attribute value : Integer;
+ }
+
+ class BooleanVal extends Value {
+ attribute value : Boolean;
+ }
+
+ class CastVal extends Value {
+-- TODO
+-- reference value container : Value;
+ reference value container : IntegerVal;
+ attribute toType : String;
+ }
+-- @end Values
+
+ abstract class Declaration extends NamedElement {}
+
+ class VariableDeclaration extends Declaration {}
+
+ class VariableDeclarations extends LocatedElement {
+ reference declarations[*] ordered container : VariableDeclaration;
+ attribute type : String;
+ }
+
+ class Parameter extends VariableDeclaration {}
+
+-- @begin Types
+ abstract class Type extends TypeOrProcessDeclaration {}
+
+ class LibraryList extends Type {
+ attribute names[*] ordered : String;
+ }
+
+ class TypeDefinition extends Type, NamedElement {
+ attribute types[1-*] ordered : String;
+ attribute sorts[*] ordered : String;
+ reference operations[*] ordered container : Operations;
+ reference equations[*] ordered container : Equations;
+ }
+
+ class Operations extends LocatedElement {
+ reference declarations[1-*] ordered container : OperationDeclaration;
+ attribute parameterTypes[*] ordered : String;
+ attribute returnType : String;
+ }
+
+ class OperationDeclaration extends Declaration {}
+
+ class Equations extends NamedElement {
+ reference declarations[1-*] ordered container : VariableDeclarations;
+ reference ofSorts[*] ordered container : OfSort;
+ }
+
+ class OfSort extends NamedElement {
+ reference equations[*] ordered container : Equation;
+ }
+
+ abstract class Equation extends LocatedElement {}
+
+ class SimpleEquation extends Equation {
+ reference left container : Value;
+ reference right container : Value;
+ }
+
+ class GuardedEquation extends Equation {
+ reference guard container : GuardExpression;
+ reference equation container : SimpleEquation;
+ }
+-- @end Types
+}
+
+package PrimitiveTypes {
+ datatype Boolean;
+ datatype Integer;
+ datatype String;
+}
diff --git a/syntaxes/LOTOS/Samples/README.txt b/syntaxes/LOTOS/Samples/README.txt
new file mode 100644
index 0000000..b774050
--- /dev/null
+++ b/syntaxes/LOTOS/Samples/README.txt
@@ -0,0 +1,2 @@
+A sample is available at:
+ftp://ftp.inrialpes.fr/pub/vasy/demos/demo_01/bitalt.lotos \ No newline at end of file
diff --git a/syntaxes/LOTOS/Syntax/LOTOS.tcs b/syntaxes/LOTOS/Syntax/LOTOS.tcs
new file mode 100644
index 0000000..5d689af
--- /dev/null
+++ b/syntaxes/LOTOS/Syntax/LOTOS.tcs
@@ -0,0 +1,425 @@
+-- @authors Frédéric Jouault
+-- @date 2007/05/21
+-- @description This TCS model defines the syntax of the LOTOS language.
+-- @see ftp://ftp.inrialpes.fr/pub/vasy/publications/others/Turner-96.pdf
+syntax LOTOS(k = 0) {
+
+ primitiveTemplate identifier for String default using NAME:
+ value = "%token%";
+
+ primitiveTemplate identifierOrKeyword for String using NAME orKeyword:
+ value = "%token%";
+
+ primitiveTemplate stringSymbol for String using STRING:
+ value = "%token%",
+ serializer="'\'' + %value%.toCString() + '\''";
+
+ primitiveTemplate integerSymbol for Integer default using INT:
+ value = "Integer.valueOf(%token%)";
+
+ primitiveTemplate floatSymbol for Double default using FLOAT:
+ value = "Double.valueOf(%token%)";
+
+ template Specification main context
+ : "specification" name
+ (isDefined(gates) ? "[" gates{separator = ","} "]")
+ ":" (isExit ? "exit" : "noexit")
+ [ types ] {nbNL = 2}
+ "behaviour" [
+ (isDefined(definition) ? definition)
+ ] "endspec"
+ ;
+
+ template Definition
+ : [
+ behaviour
+ ] (isDefined(declarations) ? "where" [
+ declarations
+ ] {nbNL = 2})
+ ;
+
+ template TypeOrProcessDeclaration abstract;
+
+ template Process context
+ : "process" name
+ (isDefined(gates) ? "[" gates{separator = ","} "]")
+ (isDefined(variables) ? "(" variables{separator = ","} ")")
+ ":" (isExit ? "exit" : "noexit") ":=" definition "endproc"
+ ;
+
+-- @begin Behaviour
+ template Behaviour abstract operatored(Behaviour);
+
+ template Let context nonPrimary
+ : "let" variables "=" value "in"
+ [ behaviour ]
+ ;
+
+ template Choice context nonPrimary
+ : "choice" variables "[]"
+ [ behaviour ]
+ ;
+
+ template Hide nonPrimary
+ : "hide" gates{separator = ","} "in"
+ [ behaviour ]
+ ;
+
+ template ProcessCall
+ : name "[" gates{separator = ","} "]"
+ (isDefined(arguments) ? "(" arguments{separator = ","} ")")
+ ;
+
+ operatorTemplate SimpleParallel(operators = parOp, source = 'left', storeRightTo = 'right');
+ operatorTemplate GatedParallel(operators = gatedParOp, source = 'left', storeRightTo = 'right')
+ : gates{separator = ","} "]|"
+ ;
+
+ operatorTemplate GuardedBehaviour(operators = guardedOp, source = behaviour)
+ : "[" guard "]" -- prefix to operator
+ ;
+
+ operatorTemplate ActionBehaviour(operators = semiOp, source = behaviour) context
+ : action -- prefix to operator
+ ;
+
+ operatorTemplate Alternative(operators = alternativeOp, source = 'left', storeRightTo = 'right');
+-- @end Behaviour
+
+-- @begin Actions
+ template Action abstract;
+
+ template GateAction context
+ : gate
+-- TODO: resolve ambiguity when guard is outside
+ (isDefined(communications) ? communications{forcedLower = 1}
+ (isDefined(guard) ? "[" guard "]")
+ )
+ ;
+
+ template Communication abstract;
+
+ template InComm
+ : "?" declarations
+ ;
+
+ template OutComm
+ : "!" value
+ ;
+-- @end Actions
+
+-- @begin Guards
+ template GuardExpression abstract;
+
+ template EqualityTestGuardExp(disambiguate = "value EQ")
+ : left "=" right
+ ;
+
+ template BooleanGuardExp
+ : value
+ ;
+-- @end Guards
+
+-- @begin Values
+ template Value abstract operatored(Value);
+
+ template Variable
+ : declaration{refersTo = name}
+ ;
+
+ template OperationCall
+ : operationName "(" arguments{separator = ","} ")"
+ ;
+
+ template IntegerVal
+ : value
+ ;
+
+ template BooleanVal
+ : (value ? "true" : "false")
+ ;
+
+ operatorTemplate CastVal(operators = opOf, source = 'value')
+ : toType
+ ;
+
+ operatorTemplate OperatorCall(operators =
+ opPlus
+ opEq opGe opGt opLe opLt opNe
+ opAnd opOr
+ , source = 'left', storeOpTo = operatorName, storeRightTo = 'right');
+-- @end Values
+
+ template VariableDeclaration addToContext
+ : name
+ ;
+
+ template VariableDeclarations
+ : declarations{separator = ","} ":" type
+ ;
+
+-- @begin Types
+ template Type abstract;
+
+ template LibraryList
+ : "library" names{separator = ","} "endlib"
+ ;
+
+ template TypeDefinition
+ : "type" name "is" types{separator = ","} [
+ "sorts" sorts{separator = ","}
+ "opns" [
+ operations
+ ]
+ "eqns" [
+ equations
+ ] {endNL = false}
+ ] "endtype"
+ ;
+
+ template Operations
+ : declarations{separator = ","}
+ ":" parameterTypes{separator = ","} "->" returnType
+ ;
+
+ template OperationDeclaration addToContext
+ : name
+ ;
+
+ template Equations context
+ : "forall" declarations{separator = ","} [
+ ofSorts
+ ] {indentIncr = 0, nbNL = 2, endNL = false}
+ ;
+
+ template OfSort
+ : "ofsort" name [
+ equations
+ ] {endNL = false}
+ ;
+
+ template Equation abstract;
+
+ template SimpleEquation
+ : left "=" right ";"
+ ;
+
+ template GuardedEquation(disambiguate = "guardExpression IMPLIES")
+ : guard "=>" equation
+ ;
+-- @end Types
+
+ symbols {
+ lsquarersquare = "[]";
+ lsquare = "[";
+ rsquare = "]" : rightSpace;
+ excl = "!";
+ coma = "," : leftNone, rightSpace;
+ lparen = "(";
+ rparen = ")" : leftNone, rightSpace;
+ lcurly = "{" : leftSpace;
+ rcurly = "}" : leftNone, rightSpace;
+ semi = ";" : leftNone, rightSpace;
+ colon = ":" : leftSpace, rightSpace; -- except after def where it is leftNone, rightSpace
+ pipe = "|" : leftSpace, rightSpace;
+ sharp = "#" : leftSpace;
+ qmark = "?";
+ coloncolon = "::" : leftNone, rightNone;
+ pipe3 = "|||";
+ pipelsquare = "|[";
+ rsquarepipe = "]|";
+ coloneq = ":=";
+ implies = "=>" : leftSpace, rightSpace;
+
+ -- operator symbols
+ point = "." : leftNone;
+ rarrow = "->" : leftSpace, rightSpace;
+ minus = "-" : leftSpace, rightSpace;
+ star = "*" : leftSpace, rightSpace;
+ slash = "/" : leftSpace, rightSpace;
+ plus = "+" : leftSpace, rightSpace;
+ eq = "=" : leftSpace, rightSpace;
+ gt = ">" : leftSpace, rightSpace;
+ lt = "<" : leftSpace, rightSpace;
+ ge = ">=" : leftSpace, rightSpace;
+ le = "<=" : leftSpace, rightSpace;
+ ne = "<>" : leftSpace, rightSpace;
+ larrow = "<-" : leftSpace, rightSpace;
+ }
+
+ operators Behaviour {
+ priority 0, right {
+ semiOp = ";", 1; -- prefix
+ }
+
+ priority 1 {
+ guardedOp = "->", 1; -- prefix
+ }
+
+ priority 2 {
+ alternativeOp = "[]", 2;
+ }
+
+ priority 3 {
+ parOp = "|||", 2;
+ gatedParOp = "|[", 2;
+ }
+
+-- priority 4 {
+-- disableOp = "|>", 2;
+-- }
+
+-- priority 5 {
+-- enableOp = ">>", 2;
+-- }
+ }
+
+ operators Value {
+ priority 0 {
+ opOf = "of", 2;
+ }
+
+ priority 1 {
+ opPlus = plus, 2;
+ }
+
+ priority 2 {
+ opEq = "eq", 2;
+ opGe = ge, 2;
+ opGt = gt, 2;
+ opLe = le, 2;
+ opLt = lt, 2;
+ opNe = "neq", 2;
+ }
+
+ priority 3 {
+ opAnd = "and", 2;
+ opOr = "or", 2;
+ }
+ }
+
+ token COMMENT : multiLine(start = "(*", end = "*)");
+
+ lexer = "
+%options testLiterals = false;
+
+NL
+ : ( '\\r' '\\n'
+ | '\\n' '\\r' //Improbable
+ | '\\r'
+ | '\\n'
+ )
+ {newline();}
+ ;
+
+WS
+ : ( ' '
+ | '\\t'
+ )
+ ;
+
+%protected
+DIGIT
+ : '0'..'9'
+ ;
+
+%protected
+ALPHA
+ : 'a'..'z'
+ | 'A'..'Z'
+ | '_'
+ //For Unicode compatibility (from 0000 to 00ff)
+ | '\\u00C0' .. '\\u00D6'
+ | '\\u00D8' .. '\\u00F6'
+ | '\\u00F8' .. '\\u00FF'
+ ;
+
+%protected
+SNAME
+%v2 options {
+%v2 testLiterals = true;
+%v2 }
+ : (ALPHA) (ALPHA | DIGIT)*
+;
+
+NAME
+ : (
+%v3 SNAME
+%v2 s:SNAME {if(s.getType() != SNAME) $setType(s.getType());}
+ | '\"'!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\\"'|'\\n')
+ )*
+ '\"'!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ )
+ ;
+
+INT
+ : (DIGIT)+
+%v2 (('.' DIGIT)=> '.' (DIGIT)+ {$setType(FLOAT);})?
+ ;
+
+%v3 FLOAT : DIGIT+ '.' DIGIT* ;
+
+%protected
+ESC
+ : '\\\\'!
+ ( 'n' %v2{%setText(\"\\n\");}
+ | 'r' %v2{%setText(\"\\r\");}
+ | 't' %v2{%setText(\"\\t\");}
+ | 'b' %v2{%setText(\"\\b\");}
+ | 'f' %v2{%setText(\"\\f\");}
+ | '\"' %v2{%setText(\"\\\"\");}
+ | '\\'' %v2{%setText(\"\\'\");}
+ | '\\\\' %v2{%setText(\"\\\\\");}
+ | (
+ ('0'..'3')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : '0'..'7'
+ )?
+ )?
+ | ('4'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ )?
+ )
+ {
+%v2 String s = %getText;
+%v2 int i;
+%v2 int ret = 0;
+%v2 String ans;
+%v2 for (i=0; i<s.length(); ++i)
+%v2 ret = ret*8 + s.charAt(i) - '0';
+%v2 ans = String.valueOf((char) ret);
+%v2 %setText(ans);
+ }
+ )
+ ;
+
+STRING
+ : '\\''!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\''|'\\n')
+ )*
+ '\\''!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ ;
+
+ ";
+
+}
+
diff --git a/syntaxes/LOTOS/build.properties b/syntaxes/LOTOS/build.properties
new file mode 100644
index 0000000..e475e0e
--- /dev/null
+++ b/syntaxes/LOTOS/build.properties
@@ -0,0 +1,2 @@
+dsl.name=LOTOS
+dsl.ext=lotos \ No newline at end of file
diff --git a/syntaxes/MSRT/.project b/syntaxes/MSRT/.project
new file mode 100644
index 0000000..54680f9
--- /dev/null
+++ b/syntaxes/MSRT/.project
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>MSRT</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.gmt.tcs.builder.Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2m.atl.adt.builder.atlBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2m.atl.adt.builder.atlNature</nature>
+ </natures>
+</projectDescription>
diff --git a/syntaxes/MSRT/Metamodel/MSRT.km3 b/syntaxes/MSRT/Metamodel/MSRT.km3
new file mode 100644
index 0000000..0a6ea76
--- /dev/null
+++ b/syntaxes/MSRT/Metamodel/MSRT.km3
@@ -0,0 +1,40 @@
+-- @name MSRT
+-- @version 1.0
+-- @authors Mikael Barbero
+-- @date 01/09/2008
+-- @description Simple metamodel to test MultiStep RefersTo resolution. Illustrate workaround of bug #214598 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=214598)
+package MSRT {
+ class Block {
+ attribute name : String;
+ reference subblocks[*] ordered container : Block;
+ reference statements[*] ordered container : Statement;
+ }
+
+ abstract class Statement {}
+
+ class VariableDef extends Statement {
+ attribute varName : String;
+ }
+
+ abstract class VariableRef {}
+
+ class SimpleVariableRef extends VariableRef {
+ reference varDef : VariableDef;
+ }
+
+ class ComplexVariableRef extends VariableRef {
+ reference varDef : VariableDef;
+ reference ownerblock : Block; -- This to support the path to sibling blocks
+ }
+
+ class Assignement extends Statement {
+ reference lhs container : SimpleVariableRef;
+ reference rhs container : VariableRef;
+ }
+}
+
+package PrimitiveTypes {
+ datatype Boolean;
+ datatype Integer;
+ datatype String;
+}
diff --git a/syntaxes/MSRT/Sample/sample.msrt b/syntaxes/MSRT/Sample/sample.msrt
new file mode 100644
index 0000000..392a7db
--- /dev/null
+++ b/syntaxes/MSRT/Sample/sample.msrt
@@ -0,0 +1,11 @@
+block0 {
+ block1 {
+ define v1;
+ define v3;
+ v1 = v3;
+ }
+ block2 {
+ define v2;
+ v2 = block1.v1;
+ }
+} \ No newline at end of file
diff --git a/syntaxes/MSRT/Syntax/MSRT.tcs b/syntaxes/MSRT/Syntax/MSRT.tcs
new file mode 100644
index 0000000..e52699f
--- /dev/null
+++ b/syntaxes/MSRT/Syntax/MSRT.tcs
@@ -0,0 +1,239 @@
+-- @name MSRT
+-- @version 1.0
+-- @authors Mikael Barbero
+-- @date 01/09/2008
+-- @description Simple TCS for testing MultiStep RefersTo resolution. Illustrate workaround of bug #214598
+
+-- The different sections of a TCS model have been enclosed between BEGIN and END
+-- comments below. Additional information is provided below each BEGIN comment.
+-- The main sections of interest are "Class templates", and
+-- "Operator table" (the latter only for DSLs using operators).
+syntax MSRT {
+
+-- BEGIN Primitive templates
+-- Specifies representation of primitive types.
+-- Only needs modification when default lexer is not satisfactory.
+-- Generally modified along with the lexer.
+ primitiveTemplate identifier for String default using NAME:
+ value = "%token%";
+
+ primitiveTemplate stringSymbol for String using STRING:
+ value = "%token%",
+ serializer="'\'' + %value%.toCString() + '\''";
+
+ primitiveTemplate integerSymbol for Integer default using INT:
+ value = "Integer.valueOf(%token%)";
+
+ primitiveTemplate floatSymbol for Double default using FLOAT:
+ value = "Double.valueOf(%token%)";
+-- END Primitive templates
+
+-- BEGIN Class templates
+-- Specifies representation of classes.
+-- This is the main section to work on.
+ template Block main context addToContext
+ : name "{"
+ subblocks
+ statements
+ "}"
+ ;
+
+ template Statement abstract;
+
+ template VariableDef addToContext
+ : "define" varName ";"
+ ;
+
+ template VariableRef abstract;
+
+ template ComplexVariableRef
+ : ownerblock {refersTo=name} "." varDef{refersTo=varName, lookIn=ownerblock}
+ ;
+
+ template SimpleVariableRef
+ : varDef {refersTo=varName}
+ ;
+
+ template Assignement
+ : lhs "=" rhs ";"
+ ;
+
+-- END Class templates
+
+-- BEGIN Special symbols
+-- Possible modifications:
+-- - Addition of new symbols.
+-- - Modification of spaces information.
+-- - Removal of unused symbols so that using these symbols results in lexical
+-- error rather than parsing error.
+ symbols {
+ lsquare = "[";
+ rsquare = "]" : rightSpace;
+ excl = "!";
+ coma = "," : leftNone, rightSpace;
+ lparen = "(";
+ rparen = ")" : leftNone, rightSpace;
+ lcurly = "{" : leftSpace;
+ rcurly = "}" : leftNone, rightSpace;
+ semi = ";" : leftNone, rightSpace;
+ colon = ":" : leftSpace, rightSpace;
+ pipe = "|" : leftSpace, rightSpace;
+ sharp = "#" : leftSpace;
+ qmark = "?";
+ coloncolon = "::" : leftNone, rightNone;
+
+ -- operator symbols
+ point = "." : leftNone;
+ rarrow = "->" : leftNone;
+ minus = "-" : leftSpace, rightSpace;
+ star = "*" : leftSpace, rightSpace;
+ slash = "/" : leftSpace, rightSpace;
+ plus = "+" : leftSpace, rightSpace;
+ eq = "=" : leftSpace, rightSpace;
+ gt = ">" : leftSpace, rightSpace;
+ lt = "<" : leftSpace, rightSpace;
+ ge = ">=" : leftSpace, rightSpace;
+ le = "<=" : leftSpace, rightSpace;
+ ne = "<>" : leftSpace, rightSpace;
+ larrow = "<-" : leftSpace, rightSpace;
+ }
+-- END Special symbols
+
+-- BEGIN Operator table
+-- Defines all operators with their priority, arity, and associativity.
+-- All defined operators must be used in operator templates.
+
+-- Specify operator table(s) here if necessary.
+
+-- END Operator table
+
+
+-- BEGIN Lexer
+-- Specifies the lexical entities.
+-- Only needs modification when default lexer is not satisfactory.
+-- Generally modified along with Primitive templates.
+ token COMMENT : endOfLine(start = "--");
+
+ lexer = "
+%options testLiterals = false;
+
+NL
+ : ( '\\r' '\\n'
+ | '\\n' '\\r' //Improbable
+ | '\\r'
+ | '\\n'
+ )
+ {newline();}
+ ;
+
+WS
+ : ( ' '
+ | '\\t'
+ )
+ ;
+
+%protected
+DIGIT
+ : '0'..'9'
+ ;
+
+%protected
+ALPHA
+ : 'a'..'z'
+ | 'A'..'Z'
+ | '_'
+ //For Unicode compatibility (from 0000 to 00ff)
+ | '\\u00C0' .. '\\u00D6'
+ | '\\u00D8' .. '\\u00F6'
+ | '\\u00F8' .. '\\u00FF'
+ ;
+
+%protected
+SNAME
+%v2 options {
+%v2 testLiterals = true;
+%v2 }
+ : (ALPHA) (ALPHA | DIGIT)*
+;
+
+NAME
+ : (
+%v3 SNAME
+%v2 s:SNAME {if(s.getType() != SNAME) $setType(s.getType());}
+ | '\"'!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\\"'|'\\n')
+ )*
+ '\"'!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ )
+ ;
+
+INT
+ : (DIGIT)+
+%v2 (('.' DIGIT)=> '.' (DIGIT)+ {$setType(FLOAT);})?
+ ;
+
+%v3 FLOAT : DIGIT+ '.' DIGIT* ;
+
+%protected
+ESC
+ : '\\\\'!
+ ( 'n' %v2{%setText(\"\\n\");}
+ | 'r' %v2{%setText(\"\\r\");}
+ | 't' %v2{%setText(\"\\t\");}
+ | 'b' %v2{%setText(\"\\b\");}
+ | 'f' %v2{%setText(\"\\f\");}
+ | '\"' %v2{%setText(\"\\\"\");}
+ | '\\'' %v2{%setText(\"\\'\");}
+ | '\\\\' %v2{%setText(\"\\\\\");}
+ | (
+ ('0'..'3')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : '0'..'7'
+ )?
+ )?
+ | ('4'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ )?
+ )
+ {
+%v2 String s = %getText;
+%v2 int i;
+%v2 int ret = 0;
+%v2 String ans;
+%v2 for (i=0; i<s.length(); ++i)
+%v2 ret = ret*8 + s.charAt(i) - '0';
+%v2 ans = String.valueOf((char) ret);
+%v2 %setText(ans);
+ }
+ )
+ ;
+
+STRING
+ : '\\''!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\''|'\\n')
+ )*
+ '\\''!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ ;
+
+ ";
+-- END Lexer
+
+}
diff --git a/syntaxes/MSRT/build.properties b/syntaxes/MSRT/build.properties
new file mode 100644
index 0000000..9384267
--- /dev/null
+++ b/syntaxes/MSRT/build.properties
@@ -0,0 +1,2 @@
+dsl.name=MSRT
+dsl.ext=msrt
diff --git a/syntaxes/Program/.project b/syntaxes/Program/.project
new file mode 100644
index 0000000..6bf5eda
--- /dev/null
+++ b/syntaxes/Program/.project
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Program</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.m2m.atl.adt.builder.atlBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.gmt.tcs.builder.Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2m.atl.adt.builder.atlNature</nature>
+ </natures>
+</projectDescription>
diff --git a/syntaxes/Program/Metamodel/Program.ann b/syntaxes/Program/Metamodel/Program.ann
new file mode 100644
index 0000000..1c651e6
--- /dev/null
+++ b/syntaxes/Program/Metamodel/Program.ann
@@ -0,0 +1,2 @@
+annotate Program {
+} \ No newline at end of file
diff --git a/syntaxes/Program/Metamodel/Program.km3 b/syntaxes/Program/Metamodel/Program.km3
new file mode 100644
index 0000000..650c329
--- /dev/null
+++ b/syntaxes/Program/Metamodel/Program.km3
@@ -0,0 +1,134 @@
+-- @name Program
+-- @version 0.1
+-- @domains programming
+-- @authors Frédéric Jouault
+-- @date 2007/03/07
+-- @description This metamodel describes programs. A Program inherits both from Structure and ProcContainerElement. A Progam can contain VariableDeclarations (as a Structure), Procedures (as a ProcContainerElement), and Monitors. A Monitor is also a Structure and a ProcContainerElement, and can therefore contain VariableDeclarations and Procedures. Besides Statements and Parameters, a Procedure, as a Structure, can also contain VariableDeclarations. Each VariableDeclaration is associated with a one and only Type. It may also contain an initial value that is represented by an Expression (see below). Parameters inherit from VariableDeclaration. They are characterized by a "direction" attribute ("in" or "out"). A Procedure contains a sequence of Statements. An AssignmentStat contains a "target" VariableExp and a "value" Expression. A WhileStat contains a "condition" Expression and several "doStats" Statements. A ConditionalStat contains a "condition" Expression, several "thenStats" Statements and, optionally, "elseStats" Statements. Finally, an ExpressionStat simply contains an Expression. Expression is an abstract entity from which the following elements inherit: IntegerExp and BooleanExp (which inherit from the abstract LiteralExp entity), VariableExp which is associated with a VariableDeclaration, PropertyCallExp (abstract) which is characterized by its "source" element (of type Expression). There exist three types of PropertyCallExp: the AttributeCallExp, the OperatorCallExp and the ProcedureCallExp. An OperatorCallExp contains a right element (of type Expression). A ProcedureCallExp can contain "argument" Expressions.
+package Program {
+
+ abstract class LocatedElement {
+ attribute location[0-1] : String;
+ attribute commentsBefore[*] ordered : String;
+ attribute commentsAfter[*] ordered : String;
+ }
+
+ abstract class NamedElement extends LocatedElement {
+ attribute name : String;
+ }
+
+ abstract class Structure extends NamedElement {
+ reference variables[*] ordered container : VariableDeclaration oppositeOf structure;
+ }
+
+ abstract class ProcContainerElement extends Structure {
+ reference procedures[*] ordered container : Procedure oppositeOf "container";
+ }
+
+ class Program extends ProcContainerElement {
+ reference monitors[*] ordered container : Monitor oppositeOf program;
+ }
+
+ class Monitor extends ProcContainerElement {
+ reference program : Program oppositeOf monitors;
+ }
+
+ -- Procedures
+ class Procedure extends Structure {
+ reference "container" : ProcContainerElement oppositeOf procedures;
+ reference parameters[*] ordered container : Parameter oppositeOf procedure;
+ reference statements[*] ordered container : Statement;
+ }
+
+ class VariableDeclaration extends NamedElement {
+ reference type : Type;
+ reference initialValue[0-1] container : Expression;
+ reference structure : Structure oppositeOf variables;
+ }
+
+ class Parameter extends VariableDeclaration {
+ attribute direction : Direction;
+ reference procedure : Procedure oppositeOf parameters;
+ }
+
+ enumeration Direction {
+ literal in;
+ literal out;
+ }
+ -- End Procedures
+
+ -- Types
+ class Type extends NamedElement {
+ }
+ -- End Types
+
+ -- Expressions
+ abstract class Expression extends LocatedElement {
+ }
+
+ class VariableExp extends Expression {
+ reference declaration : VariableDeclaration;
+ }
+
+ -- PropertyCalls
+ abstract class PropertyCallExp extends Expression {
+ reference source container : Expression;
+ attribute name : String;
+ }
+
+ class OperatorCallExp extends PropertyCallExp {
+ reference right container : Expression;
+ }
+
+ class AttributeCallExp extends PropertyCallExp {
+ }
+
+ class ProcedureCallExp extends PropertyCallExp {
+ reference arguments[*] ordered container : Expression;
+ }
+ -- End PropertyCalls
+
+ -- Literals
+ abstract class LiteralExp extends Expression {
+ }
+
+ class BooleanExp extends LiteralExp {
+ attribute symbol : Boolean;
+ }
+
+ class IntegerExp extends LiteralExp {
+ attribute symbol : Integer;
+ }
+ -- End Literals
+ -- End Expressions
+
+ -- Statements
+ abstract class Statement extends LocatedElement {
+ }
+
+ class AssignmentStat extends Statement {
+ reference target container : VariableExp;
+ reference value container : Expression;
+ }
+
+ class ConditionalStat extends Statement {
+ reference condition container : Expression;
+ reference thenStats[1-*] container : Statement;
+ reference elseStats[*] container : Statement;
+ }
+
+ class WhileStat extends Statement {
+ reference condition container : Expression;
+ reference doStats[1-*] container : Statement;
+ }
+
+ class ExpressionStat extends Statement {
+ reference expression container : Expression;
+ }
+ -- End Statements
+}
+
+package PrimitiveTypes {
+ datatype Boolean;
+ datatype Integer;
+ datatype String;
+}
diff --git a/syntaxes/Program/Samples/AlarmClock/AlarmClock.pgrm b/syntaxes/Program/Samples/AlarmClock/AlarmClock.pgrm
new file mode 100644
index 0000000..aad1bb2
--- /dev/null
+++ b/syntaxes/Program/Samples/AlarmClock/AlarmClock.pgrm
@@ -0,0 +1,25 @@
+program AlarmClockProgram {
+
+ monitor AlarmClock {
+ var now : integer := 0;
+ var wakeup : condition;
+
+ procedure wakeme(in n : integer) {
+ var alarmSetting : integer;
+
+ alarmSetting := now + n;
+ while now < alarmSetting do {
+ wakeup.wait(alarmSetting);
+ }
+ wakeup.signal();
+ -- In case the next process is due to wake up at the same time
+ }
+
+ procedure tick() {
+ now := now + 1;
+ wakeup.signal();
+ }
+
+ }
+}
+
diff --git a/syntaxes/Program/Samples/IOStream/IOStream.pgrm b/syntaxes/Program/Samples/IOStream/IOStream.pgrm
new file mode 100644
index 0000000..12507b1
--- /dev/null
+++ b/syntaxes/Program/Samples/IOStream/IOStream.pgrm
@@ -0,0 +1,28 @@
+program IOStreamProgram {
+
+ monitor IOStream {
+ var buffer : portion;
+ var count : integer := 0;
+ var nonEmpty : condition;
+ var nonFull : condition;
+
+ procedure append(in x : portion) {
+ if count = 1 then {
+ nonFull.wait();
+ }
+ buffer := x;
+ count := 1;
+ nonEmpty.signal();
+ }
+
+ procedure remove(out x : portion) {
+ if count = 0 then {
+ nonEmpty.wait();
+ }
+ x := buffer;
+ count := 0;
+ nonFull.signal();
+ }
+ }
+}
+
diff --git a/syntaxes/Program/Samples/ReadersAndWriters/ReadersAndWriters.pgrm b/syntaxes/Program/Samples/ReadersAndWriters/ReadersAndWriters.pgrm
new file mode 100644
index 0000000..cf9283d
--- /dev/null
+++ b/syntaxes/Program/Samples/ReadersAndWriters/ReadersAndWriters.pgrm
@@ -0,0 +1,41 @@
+program ReadersAndWritersProgram {
+ monitor ReadersAndWriters {
+ var readerCount : integer := 0;
+ var busy : boolean := false;
+ var OKToRead : condition;
+ var OKToWrite : condition;
+
+ procedure startRead() {
+ if busy or OKToWrite.queue then {
+ OKToRead.wait();
+ }
+ readerCount := readerCount + 1;
+ OKToRead.signal();
+ -- Once one reader can start, they all can
+ }
+
+ procedure endRead() {
+ readerCount := readerCount - 1;
+ if readerCount = 0 then {
+ OKToWrite.signal();
+ }
+ }
+
+ procedure startWrite() {
+ if readerCount <> 0 or busy then {
+ OKToWrite.wait();
+ }
+ busy := true;
+ }
+
+ procedure endWrite() {
+ busy := false;
+ if OKToRead.queue then {
+ OKToRead.signal();
+ } else {
+ OKToWrite.signal();
+ }
+ }
+ }
+}
+
diff --git a/syntaxes/Program/Samples/SingleResource/SingleResource.pgrm b/syntaxes/Program/Samples/SingleResource/SingleResource.pgrm
new file mode 100644
index 0000000..9be2fbe
--- /dev/null
+++ b/syntaxes/Program/Samples/SingleResource/SingleResource.pgrm
@@ -0,0 +1,20 @@
+program SingleResourceProgram {
+ monitor SingleResource {
+ var busy : boolean := false;
+ var nonBusy : condition;
+
+ procedure acquire() {
+ if busy then {
+ nonBusy.wait();
+ } else {
+ busy := true;
+ }
+ }
+
+ procedure release() {
+ busy := false;
+ nonBusy.signal();
+ }
+ }
+}
+
diff --git a/syntaxes/Program/Syntax/Program.tcs b/syntaxes/Program/Syntax/Program.tcs
new file mode 100644
index 0000000..2c48965
--- /dev/null
+++ b/syntaxes/Program/Syntax/Program.tcs
@@ -0,0 +1,320 @@
+-- @authors Frédéric Jouault
+-- @date 2005/04/07
+-- @description This TCS model defines the syntax of the Program language.
+syntax Program {
+
+ primitiveTemplate identifier for String default using NAME:
+ value = "%token%";
+
+ primitiveTemplate stringSymbol for String using STRING:
+ value = "%token%",
+ serializer="'\'' + %value%.toCString() + '\''";
+
+ primitiveTemplate integerSymbol for Integer default using INT:
+ value = "Integer.valueOf(%token%)";
+
+ primitiveTemplate floatSymbol for Double default using FLOAT:
+ value = "Double.valueOf(%token%)";
+
+ template Program main context
+ : "program" name "{" [
+ variables
+ procedures
+ monitors
+ ] {nbNL = 2} "}"
+ ;
+
+ template Monitor context
+ : "monitor" name "{" [
+ variables
+ procedures
+ ] {nbNL = 2} "}"
+ ;
+
+ template VariableDeclaration addToContext
+ : "var" name ":" type{refersTo = name, autoCreate = ifmissing, lookIn = #all}
+ (isDefined(initialValue) ? ":=" initialValue)
+ ";"
+ ;
+
+ template Procedure context
+ : "procedure" name "("
+ parameters{separator = ","}
+ ")"
+ "{" [
+ variables
+ statements
+ ] "}"
+ ;
+
+ template Parameter addToContext
+ :
+
+-- simple version
+ direction
+
+-- more complex version
+-- (direction = #in ? "in" :
+-- (direction = #out ? "out"))
+
+ name ":" type{refersTo = name, autoCreate = ifmissing, lookIn = #all}
+ ;
+
+ enumerationTemplate Direction
+ : #in = "in",
+ #out = "out"
+ ;
+
+-- Types
+ template Type
+ : name
+ ;
+-- End Types
+
+
+-- Expressions
+ template Expression abstract operatored;
+
+ template VariableExp
+ : declaration{refersTo = name}
+ ;
+
+ template LiteralExp abstract;
+
+ template BooleanExp
+ : (symbol ? "true" : "false")
+ ;
+
+ template IntegerExp
+ : symbol
+ ;
+
+ operatorTemplate ProcedureCallExp(operators = opPoint, source = 'source')
+ : name "(" arguments{separator = ","} ")"
+ ;
+
+ operatorTemplate AttributeCallExp(operators = opPoint, source = 'source')
+ : name
+ ;
+
+ operatorTemplate OperatorCallExp(operators = opAnd opOr opPlus opMinus2 opMinus1 opStar opDiv opSlash opMod opLt opLe opEq opNe opGe opGt, source = 'source', storeOpTo = name, storeRightTo = 'right');
+-- End Expressions
+
+
+-- Statements
+ template Statement abstract;
+
+ template AssignmentStat
+ : target ":=" 'value' ";"
+ ;
+
+ template ConditionalStat
+ : "if" condition "then" "{" [
+ thenStats
+ ] "}"
+ (isDefined(elseStats) ? "else" "{" [ elseStats ] "}")
+ ;
+
+ template WhileStat
+ : "while" condition "do" "{" [
+ doStats
+ ] "}"
+ ;
+
+ template ExpressionStat
+ : expression ";"
+ ;
+-- End Statements
+
+ symbols {
+ lsquare = "[";
+ rsquare = "]";
+ excl = "!";
+ coma = ",";
+ lparen = "(";
+ rparen = ")" : rightSpace;
+ lcurly = "{" : leftSpace;
+ rcurly = "}" : rightSpace;
+ semi = ";" : leftNone;
+ colon = ":" : leftSpace, rightSpace;
+ pipe = "|";
+ sharp = "#";
+ qmark = "?";
+
+ -- operator symbols
+ point = "." : leftNone;
+ rarrow = "->";
+ minus = "-" : leftSpace, rightSpace;
+ star = "*" : leftSpace, rightSpace;
+ slash = "/" : leftSpace, rightSpace;
+ plus = "+" : leftSpace, rightSpace;
+ eq = "=" : leftSpace, rightSpace;
+ gt = ">" : leftSpace, rightSpace;
+ lt = "<" : leftSpace, rightSpace;
+ ge = ">=" : leftSpace, rightSpace;
+ le = "<=" : leftSpace, rightSpace;
+ ne = "<>" : leftSpace, rightSpace;
+ larrow = "<-" : leftSpace, rightSpace;
+
+ assign = ":=" : leftSpace, rightSpace;
+ }
+
+ operators {
+ priority 0 {
+ opPoint = point, 2;
+ }
+
+ priority 1 {
+ opNot = "not", 1; -- no corresponding symbol => symbol is the keyword defined by the quoted string (which is also the name)
+ opMinus1 = minus, 1;
+ }
+
+ priority 2 {
+ opStar = star, 2;
+ opSlash = slash, 2;
+ opDiv = "div", 2;
+ opMod = "mod", 2;
+ }
+
+ priority 3 {
+ opPlus = plus, 2;
+ opMinus2 = minus, 2;
+ }
+
+ priority 4 {
+ opEq = eq, 2;
+ opGt = gt, 2;
+ opLt = lt, 2;
+ opGe = ge, 2;
+ opLe = le, 2;
+ opNe = ne, 2;
+ }
+
+ priority 5 {
+ opAnd = "and", 2;
+ opOr = "or", 2;
+ }
+ }
+
+ token COMMENT : endOfLine(start = "--");
+
+ lexer = "
+%options testLiterals = false;
+NL
+ : ( '\\r' '\\n'
+ | '\\n' '\\r' //Improbable
+ | '\\r'
+ | '\\n'
+ )
+ {newline();}
+ ;
+
+WS
+ : ( ' '
+ | '\\t'
+ )
+ ;
+
+%protected
+DIGIT
+ : '0'..'9'
+ ;
+
+%protected
+ALPHA
+ : 'a'..'z'
+ | 'A'..'Z'
+ | '_'
+ //For Unicode compatibility (from 0000 to 00ff)
+ | '\\u00C0' .. '\\u00D6'
+ | '\\u00D8' .. '\\u00F6'
+ | '\\u00F8' .. '\\u00FF'
+ ;
+
+%protected
+SNAME
+%v2 options {
+%v2 testLiterals = true;
+%v2 }
+ : (ALPHA) (ALPHA | DIGIT)*
+;
+
+NAME
+ : (
+%v3 SNAME
+%v2 s:SNAME {if(s.getType() != SNAME) $setType(s.getType());}
+ | '\"'!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\\"'|'\\n')
+ )*
+ '\"'!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ )
+ ;
+
+INT
+ : (DIGIT)+
+%v2 (('.' DIGIT)=> '.' (DIGIT)+ {$setType(FLOAT);})?
+ ;
+
+%v3 FLOAT : DIGIT+ (('.' DIGIT)=>'.' DIGIT+)? ; // cannot accept DIGIT '.' because it would conflict with Navigation
+
+%protected
+ESC
+ : '\\\\'!
+ ( 'n' %v2{%setText(\"\\n\");}
+ | 'r' %v2{%setText(\"\\r\");}
+ | 't' %v2{%setText(\"\\t\");}
+ | 'b' %v2{%setText(\"\\b\");}
+ | 'f' %v2{%setText(\"\\f\");}
+ | '\"' %v2{%setText(\"\\\"\");}
+ | '\\'' %v2{%setText(\"\\'\");}
+ | '\\\\' %v2{%setText(\"\\\\\");}
+ | (
+ ('0'..'3')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : '0'..'7'
+ )?
+ )?
+ | ('4'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ )?
+ )
+ {
+%v2 String s = %getText;
+%v2 int i;
+%v2 int ret = 0;
+%v2 String ans;
+%v2 for (i=0; i<s.length(); ++i)
+%v2 ret = ret*8 + s.charAt(i) - '0';
+%v2 ans = String.valueOf((char) ret);
+%v2 %setText(ans);
+ }
+ )
+ ;
+
+STRING
+ : '\\''!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\''|'\\n')
+ )*
+ '\\''!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ ;
+ ";
+}
+
diff --git a/syntaxes/Program/build.properties b/syntaxes/Program/build.properties
new file mode 100644
index 0000000..fd688d2
--- /dev/null
+++ b/syntaxes/Program/build.properties
@@ -0,0 +1,2 @@
+dsl.name=Program
+dsl.ext=pgrm \ No newline at end of file
diff --git a/syntaxes/SPL/.project b/syntaxes/SPL/.project
new file mode 100644
index 0000000..83910f2
--- /dev/null
+++ b/syntaxes/SPL/.project
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>SPL</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.m2m.atl.adt.builder.atlBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.gmt.tcs.builder.Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2m.atl.adt.builder.atlNature</nature>
+ </natures>
+</projectDescription>
diff --git a/syntaxes/SPL/Metamodel/SPL.ann b/syntaxes/SPL/Metamodel/SPL.ann
new file mode 100644
index 0000000..3542c32
--- /dev/null
+++ b/syntaxes/SPL/Metamodel/SPL.ann
@@ -0,0 +1,2 @@
+annotate SPL {
+} \ No newline at end of file
diff --git a/syntaxes/SPL/Metamodel/SPL.km3 b/syntaxes/SPL/Metamodel/SPL.km3
new file mode 100644
index 0000000..64f08ef
--- /dev/null
+++ b/syntaxes/SPL/Metamodel/SPL.km3
@@ -0,0 +1,534 @@
+-- @name SPL
+-- @version 1.0
+-- @domains
+-- @authors David Touzet (david.touzet@univ-nantes.fr)
+-- @date 2006/01/18
+-- @description This metamodel describes SPL (Session Processing Language). The goal of SPL is to ease the development of telephony services. SPL relies on a Service Logic Execution Environment for SIP (SIP-SLEE). SPL guaranties critical properties by introducing domain-specific concepts and semantic restrictions.
+-- @see http://phoenix.labri.fr/software/spl/
+package SPL {
+
+ abstract class LocatedElement {
+ attribute location : String;
+ attribute commentsBefore[*] ordered : String;
+ attribute commentsAfter[*] ordered : String;
+ }
+
+ class Program extends LocatedElement {
+ reference service container : Service;
+ }
+
+ class Service extends LocatedElement {
+ attribute name : String;
+ reference declarations[*] ordered container : Declaration;
+ reference sessions[*] ordered container : Session;
+ }
+
+-- @begin Sessions
+ abstract class Session extends LocatedElement {
+ }
+
+ class Registration extends Session {
+ reference declarations[*] ordered container : Declaration;
+ reference sessions[*] ordered container : Session;
+ }
+
+ class Dialog extends Session {
+ reference declarations[*] ordered container : Declaration;
+ reference methods[1-*] ordered container : Method;
+ }
+
+ class Event extends Session {
+ attribute eventId : String;
+ reference declarations[*] ordered container : Declaration;
+ reference methods[1-*] ordered container : Method;
+ }
+
+-- @begin Methods
+ class Method extends Session {
+ reference type container : TypeExpression;
+ attribute direction : Direction;
+ reference methodName container : MethodName;
+ reference arguments[*] ordered container : Argument;
+
+ -- Here instead of in SimpleMethod and ComposedMethod because TCS does not do left factoring yet
+ reference statements[1-*] ordered container : Statement;
+ reference branches[1-*] ordered container : Branch;
+ }
+
+-- class SimpleMethod extends Method {
+-- reference statements[1-*] ordered container : Statement;
+-- }
+--
+-- class ComposedMethod extends Method {
+-- reference branches[1-*] ordered container : DefaultBranch;
+-- }
+
+ -- no initExp allowed
+ class Argument extends VariableDeclaration {
+ }
+
+-- @begin Method Names
+ abstract class MethodName extends LocatedElement {
+ }
+
+ class SIPMethodName extends MethodName {
+ attribute name : SIPMethod;
+ }
+
+ class ControlMethodName extends MethodName {
+ attribute name : ControlMethod;
+ }
+-- @end Method Names
+-- @end Methods
+-- @end Sessions
+
+-- @begin Branches
+ class Branch extends LocatedElement {
+ reference statements[1-*] ordered container : Statement;
+ }
+
+ class DefaultBranch extends Branch {
+ }
+
+ class NamedBranch extends Branch {
+ attribute name[1-*] ordered : String;
+ }
+-- @end Branches
+
+
+-- @begin Types
+ abstract class TypeExpression extends LocatedElement {
+ }
+
+ class SimpleType extends TypeExpression {
+ attribute type : PrimitiveType;
+ }
+
+ class SequenceType extends TypeExpression {
+ attribute modifier[0-1] : Modifier;
+ reference type container : SimpleType;
+-- attribute type : PrimitiveType;
+ attribute size[0-1] : Integer;
+ }
+
+ class DefinedType extends TypeExpression {
+ attribute typeName : String;
+ }
+-- @end Types
+
+-- @begin Declarations
+ abstract class Declaration extends LocatedElement {
+ attribute name : String;
+ }
+
+ class VariableDeclaration extends Declaration {
+ reference type container : TypeExpression;
+ reference initExp[0-1] container : Expression;
+ }
+
+-- @begin FunctionDeclarations
+ abstract class FunctionDeclaration extends Declaration {
+ reference returnType container : TypeExpression;
+ reference arguments[*] ordered container : Argument;
+ }
+
+ class RemoteFunctionDeclaration extends FunctionDeclaration {
+ attribute functionLocation : FunctionLocation;
+ }
+
+ class LocalFunctionDeclaration extends FunctionDeclaration {
+ reference statements[1-*] ordered container : Statement;
+ }
+-- @end FunctionDeclarations
+
+-- @begin StructureDeclarations
+ class StructureDeclaration extends Declaration {
+ reference properties[1-*] ordered container : Argument;
+ }
+
+ class StructureProperty extends LocatedElement {
+ attribute name : String;
+ reference type container : TypeExpression;
+ }
+-- @end StructureDeclarations
+-- @end Declarations
+
+ class FunctionCall extends LocatedElement {
+ reference function : FunctionDeclaration;
+ reference parameters[*] ordered container : Expression;
+ }
+
+-- @begin Statements
+ abstract class Statement extends LocatedElement {
+ }
+
+ class CompoundStat extends Statement {
+ reference statements[1-*] container : Statement;
+ }
+
+ class SetStat extends Statement {
+ reference target container : Place;
+ reference setValue container : Expression;
+ }
+
+ class DeclarationStat extends Statement {
+ reference declaration container : Declaration;
+ }
+
+ class ReturnStat extends Statement {
+ reference returnedValue[0-1] container : Expression;
+ reference branch[0-1] : NamedBranch;
+ }
+
+ class IfStat extends Statement {
+ reference condition container : Expression;
+ reference thenStatement container : Statement;
+ reference elseStatement[0-1] container : Statement;
+ }
+
+ class WhenStat extends Statement {
+ reference idExp container : Variable;
+ reference whenHeaders[1-*] ordered container : WhenHeader;
+ reference statements[1-*] ordered container : Statement;
+ reference elseStatement[0-1] container : Statement;
+ }
+
+ class ForeachStat extends Statement {
+ reference iterator container : Iterator;
+ reference sequenceExp container : Expression;
+ reference statements[1-*] ordered container : Statement;
+ }
+
+ class Iterator extends VariableDeclaration {}
+
+ class SelectStat extends Statement {
+ reference matchedExp container : Expression;
+ reference selectCases[*] ordered container : SelectCase;
+ reference selectDefault[0-1] container : SelectDefault;
+ }
+
+ class FunctionCallStat extends Statement {
+ reference functionCall container : FunctionCall;
+ }
+
+ class ContinueStat extends Statement {
+ }
+
+ class BreakStat extends Statement {
+ }
+
+ class PushStat extends Statement {
+ reference target container : Place;
+ reference pushedValue container : Expression;
+ }
+-- @end Statements
+
+ -- no initExp allowed
+ class WhenHeader extends VariableDeclaration {
+ attribute headerId : String;
+ reference value[0-1] container : Constant;
+ }
+
+ abstract class SelectMember extends LocatedElement {
+ reference statements[*] ordered container : Statement;
+ }
+
+ class SelectDefault extends SelectMember {
+ }
+
+ class SelectCase extends SelectMember {
+ reference values[1-*] ordered container : Constant;
+ }
+
+-- @begin Expressions
+ abstract class Expression extends LocatedElement {
+ }
+
+ class ConstantExp extends Expression {
+ reference value container : Constant;
+ }
+
+ class OperatorExp extends Expression {
+ attribute opName : String;
+ reference leftExp container : Expression;
+ reference rightExp[0-1] container : Expression;
+ }
+
+ class ForwardExp extends Expression {
+ attribute isParallel : Boolean;
+ reference exp[0-1] container : Expression;
+ }
+
+ class WithExp extends Expression {
+ reference exp container : Expression;
+ reference msgFields[1-*] ordered container : MessageField;
+ }
+
+ class BlockExp extends Expression {
+ reference exp container : Expression;
+ }
+
+ class ReasonExp extends Expression {
+ }
+
+ class BODYExp extends Expression {
+ }
+
+ class RequestURIExp extends Expression {
+ }
+
+ class PopExp extends Expression {
+ reference source container : Place;
+ }
+
+ class FunctionCallExp extends Expression {
+ reference functionCall container : FunctionCall;
+ }
+
+-- @begin Places
+ abstract class Place extends Expression {
+ }
+
+ class SIPHeaderPlace extends Place {
+ attribute header : SIPHeader;
+ }
+
+ abstract class VariablePlace extends Place {
+ }
+
+ class PropertyCallPlace extends VariablePlace {
+ attribute propName : String;
+ reference source container : VariablePlace;
+ }
+
+ class Variable extends VariablePlace {
+ reference source : Declaration;
+ }
+-- @end Places
+
+ abstract class MessageField extends LocatedElement {
+ reference exp container : Expression;
+ }
+
+ class ReasonMessageField extends MessageField {
+ }
+
+ class HeadedMessageField extends MessageField {
+ attribute headerId : String;
+ }
+-- @end Expressions
+
+-- @begin Constants
+ abstract class Constant extends LocatedElement {
+ }
+
+ class BooleanConstant extends Constant {
+ attribute value : Boolean;
+ }
+
+ class IntegerConstant extends Constant {
+ attribute value : Integer;
+ }
+
+ class StringConstant extends Constant {
+ attribute value : String;
+ }
+
+ class URIConstant extends Constant {
+ attribute uri : String;
+ }
+
+ class SequenceConstant extends Constant {
+ reference values[*] ordered container : Constant;
+ }
+
+ class ResponseConstant extends Constant {
+ reference response container : Response;
+ }
+-- @end Constants
+
+-- @begin Responses
+ abstract class Response extends LocatedElement {
+ }
+
+ class SuccessResponse extends Response {
+ attribute successKind : SuccessKind;
+ }
+
+ class ErrorResponse extends Response {
+ }
+
+ class ClientErrorResponse extends ErrorResponse {
+ attribute errorKind[0-1] : ClientErrorKind;
+ }
+
+ class GlobalErrorResponse extends ErrorResponse {
+ attribute errorKind[0-1] : GlobalErrorKind;
+ }
+
+ class RedirectionErrorResponse extends ErrorResponse {
+ attribute errorKind[0-1] : RedirectionErrorKind;
+ }
+
+ class ServerErrorResponse extends ErrorResponse {
+ attribute errorKind[0-1] : ServerErrorKind;
+ }
+-- @end Responses
+}
+
+
+package Enum {
+
+ enumeration Direction {
+ literal inout;
+ literal in;
+ literal out;
+ }
+
+ enumeration SIPMethod {
+ literal ACK;
+ literal BYE;
+ literal CANCEL;
+ literal INVITE;
+ literal NOTIFY;
+ literal OPTIONS;
+ literal REACK;
+ literal REGISTER;
+ literal REINVITE;
+ literal REREGISTER;
+ literal RESUBSCRIBE;
+ literal SUBSCRIBE;
+ }
+
+ enumeration ControlMethod {
+ literal deploy;
+ literal undeploy;
+ literal uninvite;
+ literal unregister;
+ literal unsubscribe;
+ }
+
+ enumeration PrimitiveType {
+ literal void;
+ literal bool;
+ literal int;
+ literal request;
+ literal response;
+ literal string;
+ literal time;
+ literal uri;
+ }
+
+ enumeration Modifier {
+ literal LIFO;
+ literal FIFO;
+ }
+
+ enumeration FunctionLocation {
+ literal remote;
+ literal local;
+ }
+
+ enumeration SIPHeader {
+ literal CALL_ID;
+ literal CONTACT;
+ literal CSEQ;
+ literal EVENT;
+ literal FROM;
+ literal MAX_FORWARDS;
+ literal SUBSCRIPTION_STATE;
+ literal TO;
+ literal VIA;
+ }
+
+ enumeration SuccessKind {
+ literal OK;
+ literal ACCEPTED;
+ }
+
+ enumeration ClientErrorKind {
+ literal ADDRESS_INCOMPLETE;
+ literal AMBIGUOUS;
+ literal BAD_EXTENSION;
+ literal BAD_REQUEST;
+ literal BUSY_HERE;
+ literal CALL_OR_TRANSACTION_DOES_NOT_EXIST;
+ literal EXTENSION_REQUIRED;
+ literal FORBIDDEN;
+ literal GONE;
+ literal INTERVAL_TOO_BRIEF;
+ literal LOOP_DETECTED;
+ literal METHOD_NOT_ALLOWED;
+ literal NOT_ACCEPTABLE_HERE;
+ literal NOT_ACCEPTABLE;
+ literal NOT_FOUND;
+ literal PAYMENT_REQUIRED;
+ literal PROXY_AUTHENTICATION_REQUIRED;
+ literal REQUESTURI_TOO_LONG;
+ literal REQUEST_ENTITY_TOO_LARGE;
+ literal REQUEST_PENDING;
+ literal REQUEST_TERMINATED;
+ literal REQUEST_TIMEOUT;
+ literal TEMPORARILY_UNAVAILABLE;
+ literal TOO_MANY_HOPS;
+ literal UNAUTHORIZED;
+ literal UNDECIPHERABLE;
+ literal UNSUPPORTED_MEDIA_TYPE;
+ literal UNSUPPORTED_URI_SCHEME;
+ }
+
+ enumeration GlobalErrorKind {
+ literal BUSY_EVERYWHERE;
+ literal DECLINE;
+ literal DOES_NOT_EXIST_ANYWHERE;
+ literal NOT_ACCEPTABLE;
+ }
+
+ enumeration RedirectionErrorKind {
+ literal ALTERNATIVE_SERVICE;
+ literal MOVED_PERMANENTLY;
+ literal MOVED_TEMPORARILY;
+ literal MULTIPLE_CHOICES;
+ literal USE_PROXY;
+ }
+
+ enumeration ServerErrorKind {
+ literal BAD_GATEWAY;
+ literal MESSAGE_TOO_LARGE;
+ literal NOT_IMPLEMENTED;
+ literal SERVER_INTERNAL_ERROR;
+ literal SERVER_TIMEOUT;
+ literal SERVICE_UNAVAILABLE;
+ literal VERSION_NOT_SUPPORTED;
+ }
+
+-- enumeration UnaryOperator {
+-- literal "!";
+-- literal "-";
+-- }
+
+-- enumeration BinaryOperator {
+-- literal "+";
+-- literal "-";
+-- literal "*";
+-- literal "/";
+-- literal "<";
+-- literal ">";
+-- literal "==";
+-- literal "!=";
+-- literal "<=";
+-- literal ">=";
+-- literal "&&";
+-- literal "||";
+-- literal match;
+-- literal nomatch;
+-- }
+}
+
+
+package PrimitiveTypes {
+ datatype String;
+ datatype Integer;
+ datatype Boolean;
+}
+
diff --git a/syntaxes/SPL/Samples/SimpleForward.spl b/syntaxes/SPL/Samples/SimpleForward.spl
new file mode 100644
index 0000000..161b956
--- /dev/null
+++ b/syntaxes/SPL/Samples/SimpleForward.spl
@@ -0,0 +1,11 @@
+service SimpleForward {
+ processing {
+ uri us = 'sip:phoenix@barbade.enseirb.fr';
+
+ registration {
+ response incoming INVITE() {
+ return forward us;
+ }
+ }
+ }
+}
diff --git a/syntaxes/SPL/Syntax/SPL.tcs b/syntaxes/SPL/Syntax/SPL.tcs
new file mode 100644
index 0000000..a8e3c16
--- /dev/null
+++ b/syntaxes/SPL/Syntax/SPL.tcs
@@ -0,0 +1,704 @@
+syntax SPL(k = 0) {
+
+ primitiveTemplate identifier for String default using NAME:
+ value = "%token%";
+
+ primitiveTemplate stringSymbol for String using STRING:
+ value = "%token%",
+ serializer="'\'' + %value%.toCString() + '\''";
+
+ primitiveTemplate uriSymbol for String using URI:
+ value = "%token%",
+ serializer="'\'' + %value%.toCString() + '\''";
+
+ primitiveTemplate headerIdSymbol for String using HEADERID:
+ value = "%token%",
+ serializer="'\'' + %value%.toCString() + '\''";
+
+ primitiveTemplate integerSymbol for Integer default using INT:
+ value = "Integer.valueOf(%token%)";
+
+ template Program main
+ : service
+ ;
+
+ template Service context
+ : "service" name "{" [
+ [ "processing" "{" ] {indentIncr = 0, startNL = false, endNL = false, nbNL = 0} [
+ declarations
+ sessions
+ ] {nbNL = 2} "}"
+ ] "}"
+ ;
+
+-- @begin Sessions
+ template Session abstract;
+
+ template Registration context
+ : "registration" "{" [
+ declarations
+ sessions
+ ] {nbNL = 2} "}"
+ ;
+
+ template Dialog context
+ : "dialog" "{" [
+ declarations
+ methods
+ ] {nbNL = 2} "}"
+ ;
+
+ template Event
+ : "event" eventId
+ "{" [
+ declarations
+ methods
+ ] {nbNL = 2} "}"
+ ;
+
+-- @begin Methods
+ template Method context
+ : $methodHeader
+ "{" [
+ (isDefined(branches) ?
+ branches
+ :
+ statements
+ )
+ ] "}"
+ ;
+
+-- template SimpleMethod
+-- : $methodHeader "{" [
+-- statements
+-- ] "}"
+-- ;
+
+-- template ComposedMethod
+-- : $methodHeader "{" [
+-- branches
+-- ] "}"
+-- ;
+
+ function methodHeader(Method)
+ : type
+ (direction = #in ?
+ "incoming"
+ :
+ (direction = #out ?
+ "outgoing"
+ :
+ -- inout
+ )
+ )
+ methodName
+ "(" arguments{separator = ","} ")"
+ ;
+
+ template Argument addToContext
+ : type name
+ ;
+
+-- @begin Method Names
+ template MethodName abstract;
+
+ template SIPMethodName
+ : name
+ ;
+
+ template ControlMethodName
+ : name
+ ;
+-- @end Method Names
+-- @end Methods
+-- @end Sessions
+
+
+-- @begin Branches
+ template Branch abstract;
+
+ template DefaultBranch
+ : "branch" "default"
+ "{" statements "}"
+ ;
+
+ template NamedBranch
+ : "branch" name{separator = "|"}
+ "{" statements "}"
+ ;
+-- @end Branches
+
+-- @begin Declarations
+ template Declaration abstract;
+
+ template VariableDeclaration addToContext
+ : type name (isDefined(initExp) ? "=" initExp) ";"
+ ;
+
+-- @begin FunctionDeclarations
+ template FunctionDeclaration abstract;
+
+ template RemoteFunctionDeclaration addToContext
+ : functionLocation returnType name "(" arguments{separator = ","} ")" ";"
+ ;
+
+ template LocalFunctionDeclaration addToContext
+ : returnType name "(" arguments{separator = ","} ")" "{" [
+ statements
+ ] "}"
+ ;
+-- @end FunctionDeclarations
+
+-- @begin StructureDeclarations
+ template StructureDeclaration
+ : "type" name "{" [
+ properties
+ ] "}"
+ ;
+
+ template StructureProperty
+ : type name ";"
+ ;
+-- @end StructureDeclarations
+-- @end Declarations
+
+-- @begin Statements
+ template Statement abstract;
+
+ template CompoundStat
+ : "{" [ statements ] "}"
+ ;
+
+ template SetStat
+ : target "=" setValue ";"
+ ;
+
+ template DeclarationStat
+ : declaration
+ ;
+
+ template ReturnStat
+ : "return"
+ (isDefined(returnedValue) ? returnedValue)
+ (isDefined(branch) ? "branch" branch{refersTo = name, autoCreate = ifmissing})
+ ";"
+ ;
+
+ template IfStat
+ : "if" "(" condition ")" [
+ thenStatement
+ ]
+ (isDefined(elseStatement) ?
+ "else" [
+ elseStatement
+ ]
+ )
+ ;
+
+ template WhenStat context
+ : "when" idExp "(" whenHeaders{separator = ","} ")" "{" [
+ statements
+ ] "}"
+ (isDefined(elseStatement) ?
+ "else" [
+ elseStatement
+ ]
+ )
+ ;
+
+ template WhenHeader addToContext
+ : headerId{as = headerIdSymbol} type name (isDefined(value) ? value)
+ ;
+
+ template ForeachStat context
+ : "foreach" "(" iterator "in" sequenceExp ")" "{" [
+ statements
+ ] "}"
+ ;
+
+ template Iterator addToContext
+ : name
+ ;
+
+ template SelectStat
+ : "select" "(" matchedExp ")" "{" [
+ selectCases
+ (isDefined(selectDefault) ?
+ selectDefault
+ )
+ ] "}"
+ ;
+
+ template SelectCase
+ : "case" values{separator = "|"} ":" [ statements ]
+ ;
+
+ template SelectDefault
+ : "default" ":" [ statements ]
+ ;
+
+ template FunctionCallStat
+ : functionCall ";"
+ ;
+
+ template ContinueStat
+ : "continue" ";"
+ ;
+
+ template BreakStat
+ : "break" ";"
+ ;
+
+ template PushStat
+ : "push" target pushedValue ";"
+ ;
+-- @end Statements
+
+-- @begin Expressions
+ template Expression abstract operatored;
+
+ template ConstantExp
+ : value
+ ;
+
+ operatorTemplate OperatorExp(operators =
+-- opPoint opRarrow
+ opNot opMinus1
+ opStar opSlash
+ opPlus opMinus2
+ opEq opGt opLt opGe opLe opNe
+ opAnd opOr
+ opMatch opNoMatch
+ , source = leftExp, storeOpTo = opName, storeRightTo = rightExp);
+
+ -- must be nonPrimary because it finishes (or may finish) by an expression
+ template ForwardExp nonPrimary
+ : (isParallel ? "parallel") "forward" (isDefined(exp) ? exp)
+ ;
+
+ -- must be operatorTemplate because it is left recursive
+ operatorTemplate WithExp(operators = opWith, source = exp)
+ : "{" msgFields{separator = ","} "}"
+ ;
+
+ template MessageField abstract;
+
+ template ReasonMessageField
+ : "reason" "=" exp
+ ;
+
+ template HeadedMessageField
+ : headerId{as = headerIdSymbol} exp
+ ;
+
+ -- TODO: BlockExp?
+ template ReasonExp
+ : "reason"
+ ;
+
+ template BODYExp
+ : "BODY"
+ ;
+
+ template RequestURIExp
+ : "requestURI"
+ ;
+
+ template PopExp
+ : "pop" source
+ ;
+
+ template FunctionCallExp
+ : functionCall
+ ;
+
+ template FunctionCall
+ : function{refersTo = name} "(" parameters{separator = ","} ")"
+ ;
+
+ template Place abstract;
+
+ template SIPHeaderPlace
+ : header
+ ;
+
+ template VariablePlace abstract;
+
+ template Variable
+ : source{refersTo = name}
+ ;
+
+-- template PropertyCallPlace
+-- : -- TODO
+-- ;
+-- @end Expressions
+
+-- @begin Constants
+ template Constant abstract;
+
+ template BooleanConstant
+ : (value ? "true" : "false")
+ ;
+
+ template IntegerConstant
+ : value
+ ;
+
+ template StringConstant
+ : value{as = stringSymbol}
+ ;
+
+ template URIConstant
+ : uri{as = uriSymbol}
+ ;
+
+ template SequenceConstant
+ : "<" values{separator = ","} ">"
+ ;
+
+ template ResponseConstant
+ : response
+ ;
+-- @end Constants
+
+-- @begin Responses
+ template Response abstract;
+
+ template SuccessResponse abstract
+ : "/" <no_space> "SUCCESS"
+ (isDefined(successKind) ? <no_space> "/" <no_space> successKind)
+ ;
+
+ template ErrorResponse abstract
+ : "/" <no_space> "ERROR"
+ ;
+
+ template ClientErrorResponse
+ : "/" <no_space> "ERROR" <no_space> "/" <no_space> "CLIENT"
+ (isDefined(errorKind) ? <no_space> "/" <no_space> errorKind)
+ ;
+
+ template GlobalErrorResponse
+ : "/" <no_space> "ERROR" <no_space> "/" <no_space> "GLOBAL"
+ (isDefined(errorKind) ? <no_space> "/" <no_space> errorKind)
+ ;
+
+ template RedirectionErrorResponse
+ : "/" <no_space> "ERROR" <no_space> "/" <no_space> "REDIRECTION"
+ (isDefined(errorKind) ? <no_space> "/" <no_space> errorKind)
+ ;
+
+ template ServerErrorResponse
+ : "/" <no_space> "ERROR" <no_space> "/" <no_space> "SERVER"
+ (isDefined(errorKind) ? <no_space> "/" <no_space> errorKind)
+ ;
+-- @end Responses
+
+
+-- @begin Types
+ template TypeExpression abstract;
+
+ template SimpleType
+ : type
+ ;
+
+ template SequenceType
+ : (isDefined(modifier) ?
+ modifier
+ )
+ type "<" (isDefined(size) ? size) ">"
+ ;
+
+ enumerationTemplate Modifier auto
+ : #LIFO = "LIFO",
+ #FIFO = "FIFO"
+ ;
+-- @end Types
+
+ enumerationTemplate SIPMethod auto
+ : #ACK = "ACK",
+ #BYE = "BYE",
+ #CANCEL = "CANCEL",
+ #INVITE = "INVITE",
+ #NOTIFY = "NOTIFY",
+ #OPTIONS = "OPTIONS",
+ #REACK = "REACK",
+ #REGISTER = "REGISTER",
+ #REINVITE = "REINVITE",
+ #RESUBSCRIBE = "RESUBSCRIBE",
+ #SUBSCRIBE = "SUBSCRIBE"
+ ;
+
+ enumerationTemplate ControlMethod auto
+ : #deploy = "deploy",
+ #undeploy = "undeploy",
+ #uninvite = "uninvite",
+ #unregister = "unregister",
+ #unsubscribe = "unsubscribe"
+ ;
+
+ enumerationTemplate FunctionLocation auto
+ : #remote = "remote",
+ #local = "local"
+ ;
+
+ enumerationTemplate SuccessKind auto
+ : #OK = "OK",
+ #ACCEPTED = "ACCEPTED"
+ ;
+
+ enumerationTemplate ClientErrorKind auto
+ : #ADDRESS_INCOMPLETE = "ADDRESS_INCOMPLETE",
+ #AMBIGUOUS = "AMBIGUOUS",
+ #BAD_EXTENSION = "BAD_EXTENSION",
+ #BAD_REQUEST = "BAD_REQUEST",
+ #BUSY_HERE = "BUSY_HERE",
+ #CALL_OR_TRANSACTION_DOES_NOT_EXIST = "CALL_OR_TRANSACTION_DOES_NOT_EXIST",
+ #EXTENSION_REQUIRED = "EXTENSION_REQUIRED",
+ #FORBIDDEN = "FORBIDDEN",
+ #GONE = "GONE",
+ #INTERVAL_TOO_BRIEF = "INTERVAL_TOO_BRIEF",
+ #LOOP_DETECTED = "LOOP_DETECTED",
+ #METHOD_NOT_ALLOWED = "METHOD_NOT_ALLOWED",
+ #NOT_ACCEPTABLE_HERE = "NOT_ACCEPTABLE_HERE",
+ #NOT_ACCEPTABLE = "NOT_ACCEPTABLE",
+ #NOT_FOUND = "NOT_FOUND",
+ #PAYMENT_REQUIRED = "PAYMENT_REQUIRED",
+ #PROXY_AUTHENTICATION_REQUIRED = "PROXY_AUTHENTICATION_REQUIRED",
+ #REQUESTURI_TOO_LONG = "REQUESTURI_TOO_LONG",
+ #REQUEST_ENTITY_TOO_LARGE = "REQUEST_ENTITY_TOO_LARGE",
+ #REQUEST_PENDING = "REQUEST_PENDING",
+ #REQUEST_TERMINATED = "REQUEST_TERMINATED",
+ #REQUEST_TIMEOUT = "REQUEST_TIMEOUT",
+ #TEMPORARILY_UNAVAILABLE = "TEMPORARILY_UNAVAILABLE",
+ #TOO_MANY_HOPS = "TOO_MANY_HOPS",
+ #UNAUTHORIZED = "UNAUTHORIZED",
+ #UNDECIPHERABLE = "UNDECIPHERABLE",
+ #UNSUPPORTED_MEDIA_TYPE = "UNSUPPORTED_MEDIA_TYPE",
+ #UNSUPPORTED_URI_SCHEME = "UNSUPPORTED_URI_SCHEME"
+ ;
+
+ enumerationTemplate GlobalErrorKind auto
+ : #BUSY_EVERYWHERE = "BUSY_EVERYWHERE",
+ #DECLINE = "DECLINE",
+ #DOES_NOT_EXIST_ANYWHERE = "DOES_NOT_EXIST_ANYWHERE",
+ #NOT_ACCEPTABLE = "NOT_ACCEPTABLE"
+ ;
+
+ enumerationTemplate RedirectionErrorKind auto
+ : #ALTERNATIVE_SERVICE = "ALTERNATIVE_SERVICE",
+ #MOVED_PERMANENTLY = "MOVED_PERMANENTLY",
+ #MOVED_TEMPORARILY = "MOVED_TEMPORARILY",
+ #MULTIPLE_CHOICES = "MULTIPLE_CHOICES",
+ #USE_PROXY = "USE_PROXY"
+ ;
+
+ enumerationTemplate ServerErrorKind auto
+ : #BAD_GATEWAY = "BAD_GATEWAY",
+ #MESSAGE_TOO_LARGE = "MESSAGE_TOO_LARGE",
+ #NOT_IMPLEMENTED = "NOT_IMPLEMENTED",
+ #SERVER_INTERNAL_ERROR = "SERVER_INTERNAL_ERROR",
+ #SERVER_TIMEOUT = "SERVER_TIMEOUT",
+ #SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
+ #VERSION_NOT_SUPPORTED = "VERSION_NOT_SUPPORTED"
+ ;
+
+ enumerationTemplate SIPHeader auto
+ : #CALL_ID = "CALL_ID",
+ #CONTACT = "CONTACT",
+ #CSEQ = "CSEQ",
+ #EVENT = "EVENT",
+ #FROM = "FROM",
+ #MAX_FORWARDS = "MAX_FORWARDS",
+ #SUBSCRIPTION_STATE = "SUBSCRIPTION_STATE",
+ #TO = "TO",
+ #VIA = "VIA"
+ ;
+
+ enumerationTemplate PrimitiveType auto
+ : #void = "void",
+ #bool = "bool",
+ #int = "int",
+ #request = "request",
+ #response = "response",
+ #string = "string",
+ #time = "time",
+ #uri = "uri"
+ ;
+
+ symbols {
+ lsquare = "[";
+ rsquare = "]" : rightSpace;
+ excl = "!";
+ coma = "," : leftNone, rightSpace;
+ lparen = "(";
+ rparen = ")" : leftNone, rightSpace;
+ lcurly = "{" : leftSpace;
+ rcurly = "}" : leftNone, rightSpace;
+ semi = ";" : leftNone, rightSpace;
+ colon = ":" : leftNone, rightSpace;
+ colons = "::";
+ pipe = "|" : leftSpace, rightSpace;
+ sharp = "#" : leftSpace;
+ qmark = "?";
+
+ -- operator symbols
+ point = "." : leftNone;
+ rarrow = "->" : leftNone;
+ minus = "-" : leftSpace, rightSpace;
+ star = "*" : leftSpace, rightSpace;
+ slash = "/" : leftSpace, rightSpace;
+ plus = "+" : leftSpace, rightSpace;
+ eq = "=" : leftSpace, rightSpace;
+ eqeq = "==";
+ gt = ">" : leftSpace, rightSpace;
+ lt = "<" : leftSpace, rightSpace;
+ ge = ">=" : leftSpace, rightSpace;
+ le = "<=" : leftSpace, rightSpace;
+ ne = "!=" : leftSpace, rightSpace;
+ larrow = "<-" : leftSpace, rightSpace;
+ ampamp = "&&";
+ pipepipe = "||";
+ }
+
+ operators {
+ priority 0 { -- 0 is highest
+-- opPoint = point, 2;
+-- opRarrow = rarrow, 2;
+ opWith = "with", 2;
+ }
+
+ priority 1 {
+ opNot = excl, 1; -- no corresponding symbol => symbol is the keyword defined by the quoted string (which is also the name)
+ opMinus1 = minus, 1;
+ }
+
+ priority 2 {
+ opStar = star, 2;
+ opSlash = slash, 2;
+ }
+
+ priority 3 {
+ opPlus = plus, 2;
+ opMinus2 = minus, 2;
+ }
+
+ priority 4 {
+ opEq = eqeq, 2;
+ opGt = gt, 2;
+ opLt = lt, 2;
+ opGe = ge, 2;
+ opLe = le, 2;
+ opNe = ne, 2;
+ }
+
+ priority 5 {
+ opAnd = ampamp, 2;
+ opOr = pipepipe, 2;
+ }
+
+ priority 6 {
+ opMatch = "match", 2;
+ opNoMatch = "nomatch", 2;
+ }
+ }
+
+ token NAME : word(
+ start = [alpha] | "_",
+ part = [alnum] | "_"
+ , words = ("true" : BOOLEAN, "false" : BOOLEAN)
+ );
+ token COMMENT : endOfLine(start = "//") | multiLine(start = "/*", end = "*/");
+ token URI : multiLine(start = "\'", end = "\'");
+ token HEADERID : word(
+ start = "#",
+ part = [alnum] | "_" | "!" | "%" | "*" | "-" | "+" | "'" | "`" | "~",
+ end = ":"
+ );
+
+ lexer = "
+%options testLiterals = false;
+NL
+ : ( '\\r' '\\n'
+ | '\\n' '\\r' //Improbable
+ | '\\r'
+ | '\\n'
+ )
+ {newline();}
+ ;
+
+WS
+ : ( ' '
+ | '\\t'
+ )
+ ;
+
+%protected
+DIGIT
+ : '0'..'9'
+ ;
+
+INT
+ : (DIGIT)+
+ ;
+
+
+%protected
+ESC
+ : '\\\\'!
+ ( 'n' %v2{%setText(\"\\n\");}
+ | 'r' %v2{%setText(\"\\r\");}
+ | 't' %v2{%setText(\"\\t\");}
+ | 'b' %v2{%setText(\"\\b\");}
+ | 'f' %v2{%setText(\"\\f\");}
+ | '\"' %v2{%setText(\"\\\"\");}
+ | '\\.' %v2{%setText(\".\");} // SPL-specific
+ | '\\'' %v2{%setText(\"\\'\");}
+ | '\\\\' %v2{%setText(\"\\\\\");}
+ | (
+ ('0'..'3')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : '0'..'7'
+ )?
+ )?
+ | ('4'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ )?
+ )
+ {
+%v2 String s = %getText;
+%v2 int i;
+%v2 int ret = 0;
+%v2 String ans;
+%v2 for (i=0; i<s.length(); ++i)
+%v2 ret = ret*8 + s.charAt(i) - '0';
+%v2 ans = String.valueOf((char) ret);
+%v2 %setText(ans);
+ }
+ )
+ ;
+
+STRING
+ : '\\\"'!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\\"'|'\\n')
+ )*
+ '\\\"'!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ ;
+ ";
+
+}
diff --git a/syntaxes/SPL/build.properties b/syntaxes/SPL/build.properties
new file mode 100644
index 0000000..c916421
--- /dev/null
+++ b/syntaxes/SPL/build.properties
@@ -0,0 +1,2 @@
+dsl.name=SPL
+dsl.ext=spl \ No newline at end of file
diff --git a/syntaxes/SQLDDL/.externalToolBuilders/SQLDDL Language Builder.launch b/syntaxes/SQLDDL/.externalToolBuilders/SQLDDL Language Builder.launch
new file mode 100644
index 0000000..de4b71e
--- /dev/null
+++ b/syntaxes/SQLDDL/.externalToolBuilders/SQLDDL Language Builder.launch
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/AMMAScripts/build.dsl.xml"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,clean"/>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="AMMAScripts"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_CLEAN_TARGETS" value="clean,"/>
+<stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/>
+<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/SQLDDL}"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre1.6.0_01&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.ant.ui.classpathentry.antHome&quot;&gt;&#13;&#10;&lt;memento default=&quot;true&quot;/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.ant.ui.classpathentry.extraClasspathEntries&quot;&gt;&#13;&#10;&lt;memento/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/AMMAScripts/libs/antlr.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/AMMAScripts/libs/antlr-3.0.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/AMMAScripts/libs/antlr3-ant.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/AMMAScripts/libs/stringtemplate-3.0.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/AMMAScripts/build.dsl.xml}"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+</launchConfiguration>
diff --git a/syntaxes/SQLDDL/.project b/syntaxes/SQLDDL/.project
new file mode 100644
index 0000000..4a970fe
--- /dev/null
+++ b/syntaxes/SQLDDL/.project
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>SQLDDL</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ <dictionary>
+ <key>LaunchConfigHandle</key>
+ <value>&lt;project&gt;/.externalToolBuilders/SQLDDL Language Builder.launch</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2m.atl.adt.builder.atlBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2m.atl.adt.builder.atlNature</nature>
+ </natures>
+</projectDescription>
diff --git a/syntaxes/SQLDDL/Metamodel/SQLDDL.ann b/syntaxes/SQLDDL/Metamodel/SQLDDL.ann
new file mode 100644
index 0000000..d0f93de
--- /dev/null
+++ b/syntaxes/SQLDDL/Metamodel/SQLDDL.ann
@@ -0,0 +1,2 @@
+annotate SQLDDL {
+} \ No newline at end of file
diff --git a/syntaxes/SQLDDL/Metamodel/SQLDDL.km3 b/syntaxes/SQLDDL/Metamodel/SQLDDL.km3
new file mode 100644
index 0000000..2dfea34
--- /dev/null
+++ b/syntaxes/SQLDDL/Metamodel/SQLDDL.km3
@@ -0,0 +1,101 @@
+-- @name SQLDDL
+-- @version 1.0
+-- @domains Databases
+-- @authors Marcos Didonet Del Fabro (marcos.didonet-del-fabro@univ-nantes.fr)
+-- @date 2006/08/28
+-- @description This metamodel is a subset of SQL Data Definition Language
+
+
+package SQLDDL {
+
+ abstract class LocatedElement {
+ attribute location : String;
+ attribute commentsBefore[*] : String;
+ attribute commentsAfter[*] : String;
+ }
+
+ abstract class NamedElement extends LocatedElement {
+ attribute name : String;
+ }
+
+ class Database extends NamedElement {
+ reference tables[*] ordered container : Table oppositeOf database;
+ }
+
+ class Table extends NamedElement {
+ reference database : Database oppositeOf tables;
+ reference referencedBy[*] : ForeignKey oppositeOf referencedTable;
+
+ reference elements[*] ordered container : TableElement oppositeOf table;
+ reference parameters[*] ordered container : Parameter oppositeOf table;
+ }
+
+-- @begin Table Elements
+ abstract class TableElement extends LocatedElement {
+ reference table : Table oppositeOf elements;
+ }
+
+ class Column extends TableElement {
+ reference referencedBy[*] : ForeignKey oppositeOf referencedColumns;
+
+ attribute name : String;
+
+ reference type container : Type;
+ attribute canBeNull : Boolean;
+ reference default[0-1] container : Value;
+
+ reference keys[*] : Key oppositeOf columns;
+ }
+
+ abstract class Key extends TableElement {
+ attribute isUnique : Boolean;
+ attribute name[0-1] : String;
+ reference columns[1-*] ordered : Column oppositeOf keys;
+ }
+
+ class SimpleKey extends Key {
+ }
+
+ class PrimaryKey extends Key {
+ }
+
+ class ForeignKey extends Key {
+ reference referencedTable : Table oppositeOf referencedBy;
+ reference referencedColumns[1-*] : Column oppositeOf referencedBy;
+ }
+-- @end Table Elements
+
+ class Type extends NamedElement {
+ attribute length[0-2] : Integer;
+ attribute isUnsigned : Boolean;
+ }
+
+ class Parameter extends NamedElement {
+ reference table : Table oppositeOf parameters;
+
+ reference value[0-1] container : Value;
+ }
+
+-- @begin Values
+ abstract class Value extends LocatedElement {
+ }
+
+ class IntegerVal extends Value {
+ attribute value : Integer;
+ }
+
+ class NullVal extends Value {
+ }
+
+ class StringVal extends Value {
+ attribute value : String;
+ }
+-- @end Values
+}
+
+package PrimitiveTypes {
+ datatype Boolean;
+ datatype Integer;
+ datatype String;
+}
+
diff --git a/syntaxes/SQLDDL/Samples/SPL.sql b/syntaxes/SQLDDL/Samples/SPL.sql
new file mode 100644
index 0000000..48b38a0
--- /dev/null
+++ b/syntaxes/SQLDDL/Samples/SPL.sql
@@ -0,0 +1,622 @@
+CREATE TABLE LocatedElement (
+ __IDLocatedElement__ Integer NOT NULL,
+ location text,
+ PRIMARY KEY LocatedElement (__IDLocatedElement__)
+) ;
+
+CREATE TABLE Program (
+ __IDProgram__ Integer NOT NULL,
+ FOREIGN KEY service (__FKservice__) REFERENCES Service (__IDService__),
+ PRIMARY KEY Program (__IDProgram__),
+ __FKservice__ Integer
+) ;
+
+CREATE TABLE Service (
+ __IDService__ Integer NOT NULL,
+ name text,
+ PRIMARY KEY Service (__IDService__)
+) ;
+
+CREATE TABLE Session (
+ __IDSession__ Integer NOT NULL,
+ PRIMARY KEY Session (__IDSession__)
+) ;
+
+CREATE TABLE Registration (
+ __IDRegistration__ Integer NOT NULL,
+ PRIMARY KEY Registration (__IDRegistration__)
+) ;
+
+CREATE TABLE Dialog (
+ __IDDialog__ Integer NOT NULL,
+ PRIMARY KEY Dialog (__IDDialog__)
+) ;
+
+CREATE TABLE Event (
+ __IDEvent__ Integer NOT NULL,
+ eventId text,
+ PRIMARY KEY Event (__IDEvent__)
+) ;
+
+CREATE TABLE Method (
+ __IDMethod__ Integer NOT NULL,
+ FOREIGN KEY type (__FKtype__) REFERENCES TypeExpression (__IDTypeExpression__),
+ direction text,
+ FOREIGN KEY methodName (__FKmethodName__) REFERENCES MethodName (__IDMethodName__),
+ PRIMARY KEY Method (__IDMethod__),
+ __FKmethodName__ Integer,
+ __FKtype__ Integer
+) ;
+
+CREATE TABLE Argument (
+ __IDArgument__ Integer NOT NULL,
+ PRIMARY KEY Argument (__IDArgument__)
+) ;
+
+CREATE TABLE MethodName (
+ __IDMethodName__ Integer NOT NULL,
+ PRIMARY KEY MethodName (__IDMethodName__)
+) ;
+
+CREATE TABLE SIPMethodName (
+ __IDSIPMethodName__ Integer NOT NULL,
+ name text,
+ PRIMARY KEY SIPMethodName (__IDSIPMethodName__)
+) ;
+
+CREATE TABLE ControlMethodName (
+ __IDControlMethodName__ Integer NOT NULL,
+ name text,
+ PRIMARY KEY ControlMethodName (__IDControlMethodName__)
+) ;
+
+CREATE TABLE Branch (
+ __IDBranch__ Integer NOT NULL,
+ PRIMARY KEY Branch (__IDBranch__)
+) ;
+
+CREATE TABLE DefaultBranch (
+ __IDDefaultBranch__ Integer NOT NULL,
+ PRIMARY KEY DefaultBranch (__IDDefaultBranch__)
+) ;
+
+CREATE TABLE NamedBranch (
+ __IDNamedBranch__ Integer NOT NULL,
+ PRIMARY KEY NamedBranch (__IDNamedBranch__)
+) ;
+
+CREATE TABLE TypeExpression (
+ __IDTypeExpression__ Integer NOT NULL,
+ PRIMARY KEY TypeExpression (__IDTypeExpression__)
+) ;
+
+CREATE TABLE SimpleType (
+ __IDSimpleType__ Integer NOT NULL,
+ type text,
+ PRIMARY KEY SimpleType (__IDSimpleType__)
+) ;
+
+CREATE TABLE SequenceType (
+ __IDSequenceType__ Integer NOT NULL,
+ modifier text,
+ type text,
+ size Integer,
+ PRIMARY KEY SequenceType (__IDSequenceType__)
+) ;
+
+CREATE TABLE DefinedType (
+ __IDDefinedType__ Integer NOT NULL,
+ typeName text,
+ PRIMARY KEY DefinedType (__IDDefinedType__)
+) ;
+
+CREATE TABLE Declaration (
+ __IDDeclaration__ Integer NOT NULL,
+ name text,
+ PRIMARY KEY Declaration (__IDDeclaration__)
+) ;
+
+CREATE TABLE VariableDeclaration (
+ __IDVariableDeclaration__ Integer NOT NULL,
+ FOREIGN KEY type (__FKtype__) REFERENCES TypeExpression (__IDTypeExpression__),
+ FOREIGN KEY initExp (__FKinitExp__) REFERENCES Expression (__IDExpression__),
+ PRIMARY KEY VariableDeclaration (__IDVariableDeclaration__),
+ __FKinitExp__ Integer,
+ __FKtype__ Integer
+) ;
+
+CREATE TABLE FunctionDeclaration (
+ __IDFunctionDeclaration__ Integer NOT NULL,
+ FOREIGN KEY returnType (__FKreturnType__) REFERENCES TypeExpression (__IDTypeExpression__),
+ PRIMARY KEY FunctionDeclaration (__IDFunctionDeclaration__),
+ __FKreturnType__ Integer
+) ;
+
+CREATE TABLE RemoteFunctionDeclaration (
+ __IDRemoteFunctionDeclaration__ Integer NOT NULL,
+ functionLocation text,
+ PRIMARY KEY RemoteFunctionDeclaration (__IDRemoteFunctionDeclaration__)
+) ;
+
+CREATE TABLE LocalFunctionDeclaration (
+ __IDLocalFunctionDeclaration__ Integer NOT NULL,
+ PRIMARY KEY LocalFunctionDeclaration (__IDLocalFunctionDeclaration__)
+) ;
+
+CREATE TABLE StructureDeclaration (
+ __IDStructureDeclaration__ Integer NOT NULL,
+ PRIMARY KEY StructureDeclaration (__IDStructureDeclaration__)
+) ;
+
+CREATE TABLE StructureProperty (
+ __IDStructureProperty__ Integer NOT NULL,
+ name text,
+ FOREIGN KEY type (__FKtype__) REFERENCES TypeExpression (__IDTypeExpression__),
+ PRIMARY KEY StructureProperty (__IDStructureProperty__),
+ __FKtype__ Integer
+) ;
+
+CREATE TABLE FunctionCall (
+ __IDFunctionCall__ Integer NOT NULL,
+ FOREIGN KEY function (__FKfunction__) REFERENCES FunctionDeclaration (__IDFunctionDeclaration__),
+ PRIMARY KEY FunctionCall (__IDFunctionCall__),
+ __FKfunction__ Integer
+) ;
+
+CREATE TABLE Statement (
+ __IDStatement__ Integer NOT NULL,
+ PRIMARY KEY Statement (__IDStatement__)
+) ;
+
+CREATE TABLE CompoundStat (
+ __IDCompoundStat__ Integer NOT NULL,
+ PRIMARY KEY CompoundStat (__IDCompoundStat__)
+) ;
+
+CREATE TABLE SetStat (
+ __IDSetStat__ Integer NOT NULL,
+ FOREIGN KEY target (__FKtarget__) REFERENCES Place (__IDPlace__),
+ FOREIGN KEY setValue (__FKsetValue__) REFERENCES Expression (__IDExpression__),
+ PRIMARY KEY SetStat (__IDSetStat__),
+ __FKsetValue__ Integer,
+ __FKtarget__ Integer
+) ;
+
+CREATE TABLE DeclarationStat (
+ __IDDeclarationStat__ Integer NOT NULL,
+ FOREIGN KEY declaration (__FKdeclaration__) REFERENCES Declaration (__IDDeclaration__),
+ PRIMARY KEY DeclarationStat (__IDDeclarationStat__),
+ __FKdeclaration__ Integer
+) ;
+
+CREATE TABLE ReturnStat (
+ __IDReturnStat__ Integer NOT NULL,
+ FOREIGN KEY returnedValue (__FKreturnedValue__) REFERENCES Expression (__IDExpression__),
+ FOREIGN KEY branch (__FKbranch__) REFERENCES NamedBranch (__IDNamedBranch__),
+ PRIMARY KEY ReturnStat (__IDReturnStat__),
+ __FKreturnedValue__ Integer,
+ __FKbranch__ Integer
+) ;
+
+CREATE TABLE IfStat (
+ __IDIfStat__ Integer NOT NULL,
+ FOREIGN KEY "condition" (__FKcondition__) REFERENCES Expression (__IDExpression__),
+ PRIMARY KEY IfStat (__IDIfStat__),
+ __FKcondition__ Integer
+) ;
+
+CREATE TABLE WhenStat (
+ __IDWhenStat__ Integer NOT NULL,
+ FOREIGN KEY idExp (__FKidExp__) REFERENCES Variable (__IDVariable__),
+ PRIMARY KEY WhenStat (__IDWhenStat__),
+ __FKidExp__ Integer
+) ;
+
+CREATE TABLE ForeachStat (
+ __IDForeachStat__ Integer NOT NULL,
+ iteratorName text,
+ FOREIGN KEY sequenceExp (__FKsequenceExp__) REFERENCES Expression (__IDExpression__),
+ PRIMARY KEY ForeachStat (__IDForeachStat__),
+ __FKsequenceExp__ Integer
+) ;
+
+CREATE TABLE SelectStat (
+ __IDSelectStat__ Integer NOT NULL,
+ FOREIGN KEY matchedExp (__FKmatchedExp__) REFERENCES Expression (__IDExpression__),
+ FOREIGN KEY selectDefault (__FKselectDefault__) REFERENCES SelectDefault (__IDSelectDefault__),
+ PRIMARY KEY SelectStat (__IDSelectStat__),
+ __FKselectDefault__ Integer,
+ __FKmatchedExp__ Integer
+) ;
+
+CREATE TABLE FunctionCallStat (
+ __IDFunctionCallStat__ Integer NOT NULL,
+ FOREIGN KEY functionCall (__FKfunctionCall__) REFERENCES FunctionCall (__IDFunctionCall__),
+ PRIMARY KEY FunctionCallStat (__IDFunctionCallStat__),
+ __FKfunctionCall__ Integer
+) ;
+
+CREATE TABLE ContinueStat (
+ __IDContinueStat__ Integer NOT NULL,
+ PRIMARY KEY ContinueStat (__IDContinueStat__)
+) ;
+
+CREATE TABLE BreakStat (
+ __IDBreakStat__ Integer NOT NULL,
+ PRIMARY KEY BreakStat (__IDBreakStat__)
+) ;
+
+CREATE TABLE PushStat (
+ __IDPushStat__ Integer NOT NULL,
+ FOREIGN KEY target (__FKtarget__) REFERENCES Place (__IDPlace__),
+ FOREIGN KEY pushedValue (__FKpushedValue__) REFERENCES Expression (__IDExpression__),
+ PRIMARY KEY PushStat (__IDPushStat__),
+ __FKtarget__ Integer,
+ __FKpushedValue__ Integer
+) ;
+
+CREATE TABLE WhenHeader (
+ __IDWhenHeader__ Integer NOT NULL,
+ headerId text,
+ FOREIGN KEY value (__FKvalue__) REFERENCES Constant (__IDConstant__),
+ PRIMARY KEY WhenHeader (__IDWhenHeader__),
+ __FKvalue__ Integer
+) ;
+
+CREATE TABLE SelectMember (
+ __IDSelectMember__ Integer NOT NULL,
+ PRIMARY KEY SelectMember (__IDSelectMember__)
+) ;
+
+CREATE TABLE SelectDefault (
+ __IDSelectDefault__ Integer NOT NULL,
+ PRIMARY KEY SelectDefault (__IDSelectDefault__)
+) ;
+
+CREATE TABLE SelectCase (
+ __IDSelectCase__ Integer NOT NULL,
+ PRIMARY KEY SelectCase (__IDSelectCase__)
+) ;
+
+CREATE TABLE Expression (
+ __IDExpression__ Integer NOT NULL,
+ PRIMARY KEY Expression (__IDExpression__)
+) ;
+
+CREATE TABLE ConstantExp (
+ __IDConstantExp__ Integer NOT NULL,
+ FOREIGN KEY value (__FKvalue__) REFERENCES Constant (__IDConstant__),
+ PRIMARY KEY ConstantExp (__IDConstantExp__),
+ __FKvalue__ Integer
+) ;
+
+CREATE TABLE OperatorExp (
+ __IDOperatorExp__ Integer NOT NULL,
+ opName text,
+ FOREIGN KEY leftExp (__FKleftExp__) REFERENCES Expression (__IDExpression__),
+ FOREIGN KEY rightExp (__FKrightExp__) REFERENCES Expression (__IDExpression__),
+ PRIMARY KEY OperatorExp (__IDOperatorExp__),
+ __FKrightExp__ Integer,
+ __FKleftExp__ Integer
+) ;
+
+CREATE TABLE ForwardExp (
+ __IDForwardExp__ Integer NOT NULL,
+ isParallel Boolean,
+ FOREIGN KEY exp (__FKexp__) REFERENCES Expression (__IDExpression__),
+ PRIMARY KEY ForwardExp (__IDForwardExp__),
+ __FKexp__ Integer
+) ;
+
+CREATE TABLE WithExp (
+ __IDWithExp__ Integer NOT NULL,
+ FOREIGN KEY exp (__FKexp__) REFERENCES Expression (__IDExpression__),
+ PRIMARY KEY WithExp (__IDWithExp__),
+ __FKexp__ Integer
+) ;
+
+CREATE TABLE BlockExp (
+ __IDBlockExp__ Integer NOT NULL,
+ FOREIGN KEY exp (__FKexp__) REFERENCES Expression (__IDExpression__),
+ PRIMARY KEY BlockExp (__IDBlockExp__),
+ __FKexp__ Integer
+) ;
+
+CREATE TABLE ReasonExp (
+ __IDReasonExp__ Integer NOT NULL,
+ PRIMARY KEY ReasonExp (__IDReasonExp__)
+) ;
+
+CREATE TABLE BODYExp (
+ __IDBODYExp__ Integer NOT NULL,
+ PRIMARY KEY BODYExp (__IDBODYExp__)
+) ;
+
+CREATE TABLE RequestURIExp (
+ __IDRequestURIExp__ Integer NOT NULL,
+ PRIMARY KEY RequestURIExp (__IDRequestURIExp__)
+) ;
+
+CREATE TABLE PopExp (
+ __IDPopExp__ Integer NOT NULL,
+ FOREIGN KEY source (__FKsource__) REFERENCES Place (__IDPlace__),
+ PRIMARY KEY PopExp (__IDPopExp__),
+ __FKsource__ Integer
+) ;
+
+CREATE TABLE FunctionCallExp (
+ __IDFunctionCallExp__ Integer NOT NULL,
+ FOREIGN KEY functionCall (__FKfunctionCall__) REFERENCES FunctionCall (__IDFunctionCall__),
+ PRIMARY KEY FunctionCallExp (__IDFunctionCallExp__),
+ __FKfunctionCall__ Integer
+) ;
+
+CREATE TABLE Place (
+ __IDPlace__ Integer NOT NULL,
+ PRIMARY KEY Place (__IDPlace__)
+) ;
+
+CREATE TABLE SIPHeaderPlace (
+ __IDSIPHeaderPlace__ Integer NOT NULL,
+ header text,
+ PRIMARY KEY SIPHeaderPlace (__IDSIPHeaderPlace__)
+) ;
+
+CREATE TABLE VariablePlace (
+ __IDVariablePlace__ Integer NOT NULL,
+ PRIMARY KEY VariablePlace (__IDVariablePlace__)
+) ;
+
+CREATE TABLE PropertyCallPlace (
+ __IDPropertyCallPlace__ Integer NOT NULL,
+ propName text,
+ FOREIGN KEY source (__FKsource__) REFERENCES VariablePlace (__IDVariablePlace__),
+ PRIMARY KEY PropertyCallPlace (__IDPropertyCallPlace__),
+ __FKsource__ Integer
+) ;
+
+CREATE TABLE Variable (
+ __IDVariable__ Integer NOT NULL,
+ FOREIGN KEY source (__FKsource__) REFERENCES Declaration (__IDDeclaration__),
+ PRIMARY KEY Variable (__IDVariable__),
+ __FKsource__ Integer
+) ;
+
+CREATE TABLE MessageField (
+ __IDMessageField__ Integer NOT NULL,
+ FOREIGN KEY exp (__FKexp__) REFERENCES Expression (__IDExpression__),
+ PRIMARY KEY MessageField (__IDMessageField__),
+ __FKexp__ Integer
+) ;
+
+CREATE TABLE ReasonMessageField (
+ __IDReasonMessageField__ Integer NOT NULL,
+ PRIMARY KEY ReasonMessageField (__IDReasonMessageField__)
+) ;
+
+CREATE TABLE HeadedMessageField (
+ __IDHeadedMessageField__ Integer NOT NULL,
+ headerId text,
+ PRIMARY KEY HeadedMessageField (__IDHeadedMessageField__)
+) ;
+
+CREATE TABLE Constant (
+ __IDConstant__ Integer NOT NULL,
+ PRIMARY KEY Constant (__IDConstant__)
+) ;
+
+CREATE TABLE BooleanConstant (
+ __IDBooleanConstant__ Integer NOT NULL,
+ value Boolean,
+ PRIMARY KEY BooleanConstant (__IDBooleanConstant__)
+) ;
+
+CREATE TABLE IntegerConstant (
+ __IDIntegerConstant__ Integer NOT NULL,
+ value Integer,
+ PRIMARY KEY IntegerConstant (__IDIntegerConstant__)
+) ;
+
+CREATE TABLE StringConstant (
+ __IDStringConstant__ Integer NOT NULL,
+ value text,
+ PRIMARY KEY StringConstant (__IDStringConstant__)
+) ;
+
+CREATE TABLE URIConstant (
+ __IDURIConstant__ Integer NOT NULL,
+ uri text,
+ PRIMARY KEY URIConstant (__IDURIConstant__)
+) ;
+
+CREATE TABLE SequenceConstant (
+ __IDSequenceConstant__ Integer NOT NULL,
+ PRIMARY KEY SequenceConstant (__IDSequenceConstant__)
+) ;
+
+CREATE TABLE ResponseConstant (
+ __IDResponseConstant__ Integer NOT NULL,
+ FOREIGN KEY response (__FKresponse__) REFERENCES Response (__IDResponse__),
+ PRIMARY KEY ResponseConstant (__IDResponseConstant__),
+ __FKresponse__ Integer
+) ;
+
+CREATE TABLE Response (
+ __IDResponse__ Integer NOT NULL,
+ PRIMARY KEY Response (__IDResponse__)
+) ;
+
+CREATE TABLE SuccessResponse (
+ __IDSuccessResponse__ Integer NOT NULL,
+ successKind text,
+ PRIMARY KEY SuccessResponse (__IDSuccessResponse__)
+) ;
+
+CREATE TABLE ErrorResponse (
+ __IDErrorResponse__ Integer NOT NULL,
+ PRIMARY KEY ErrorResponse (__IDErrorResponse__)
+) ;
+
+CREATE TABLE ClientErrorResponse (
+ __IDClientErrorResponse__ Integer NOT NULL,
+ errorKind text,
+ PRIMARY KEY ClientErrorResponse (__IDClientErrorResponse__)
+) ;
+
+CREATE TABLE GlobalErrorResponse (
+ __IDGlobalErrorResponse__ Integer NOT NULL,
+ errorKind text,
+ PRIMARY KEY GlobalErrorResponse (__IDGlobalErrorResponse__)
+) ;
+
+CREATE TABLE RedirectionErrorResponse (
+ __IDRedirectionErrorResponse__ Integer NOT NULL,
+ errorKind text,
+ PRIMARY KEY RedirectionErrorResponse (__IDRedirectionErrorResponse__)
+) ;
+
+CREATE TABLE ServerErrorResponse (
+ __IDServerErrorResponse__ Integer NOT NULL,
+ errorKind text,
+ PRIMARY KEY ServerErrorResponse (__IDServerErrorResponse__)
+) ;
+
+CREATE TABLE WhenStat_statements_Statement (
+ __IDWhenStat__ Integer NOT NULL,
+ __IDStatement__ Integer NOT NULL
+) ;
+
+CREATE TABLE SelectStat_selectCases_SelectCase (
+ __IDSelectStat__ Integer NOT NULL,
+ __IDSelectCase__ Integer NOT NULL
+) ;
+
+CREATE TABLE Method_arguments_Argument (
+ __IDMethod__ Integer NOT NULL,
+ __IDArgument__ Integer NOT NULL
+) ;
+
+CREATE TABLE Registration_declarations_Declaration (
+ __IDRegistration__ Integer NOT NULL,
+ __IDDeclaration__ Integer NOT NULL
+) ;
+
+CREATE TABLE Service_declarations_Declaration (
+ __IDService__ Integer NOT NULL,
+ __IDDeclaration__ Integer NOT NULL
+) ;
+
+CREATE TABLE LocalFunctionDeclaration_statements_Statement (
+ __IDLocalFunctionDeclaration__ Integer NOT NULL,
+ __IDStatement__ Integer NOT NULL
+) ;
+
+CREATE TABLE WhenStat_whenHeaders_WhenHeader (
+ __IDWhenStat__ Integer NOT NULL,
+ __IDWhenHeader__ Integer NOT NULL
+) ;
+
+CREATE TABLE Dialog_methods_Method (
+ __IDDialog__ Integer NOT NULL,
+ __IDMethod__ Integer NOT NULL
+) ;
+
+CREATE TABLE Registration_sessions_Session (
+ __IDRegistration__ Integer NOT NULL,
+ __IDSession__ Integer NOT NULL
+) ;
+
+CREATE TABLE FunctionCall_parameters_Expression (
+ __IDFunctionCall__ Integer NOT NULL,
+ __IDExpression__ Integer NOT NULL
+) ;
+
+CREATE TABLE Method_statements_Statement (
+ __IDMethod__ Integer NOT NULL,
+ __IDStatement__ Integer NOT NULL
+) ;
+
+CREATE TABLE Branch_statements_Statement (
+ __IDBranch__ Integer NOT NULL,
+ __IDStatement__ Integer NOT NULL
+) ;
+
+CREATE TABLE CompoundStat_statements_Statement (
+ __IDCompoundStat__ Integer NOT NULL,
+ __IDStatement__ Integer NOT NULL
+) ;
+
+CREATE TABLE WhenStat_elseStatements_Statement (
+ __IDWhenStat__ Integer NOT NULL,
+ __IDStatement__ Integer NOT NULL
+) ;
+
+CREATE TABLE WithExp_msgFields_MessageField (
+ __IDWithExp__ Integer NOT NULL,
+ __IDMessageField__ Integer NOT NULL
+) ;
+
+CREATE TABLE StructureDeclaration_properties_Argument (
+ __IDStructureDeclaration__ Integer NOT NULL,
+ __IDArgument__ Integer NOT NULL
+) ;
+
+CREATE TABLE IfStat_thenStatements_Statement (
+ __IDIfStat__ Integer NOT NULL,
+ __IDStatement__ Integer NOT NULL
+) ;
+
+CREATE TABLE IfStat_elseStatements_Statement (
+ __IDIfStat__ Integer NOT NULL,
+ __IDStatement__ Integer NOT NULL
+) ;
+
+CREATE TABLE SelectMember_statements_Statement (
+ __IDSelectMember__ Integer NOT NULL,
+ __IDStatement__ Integer NOT NULL
+) ;
+
+CREATE TABLE FunctionDeclaration_arguments_Argument (
+ __IDFunctionDeclaration__ Integer NOT NULL,
+ __IDArgument__ Integer NOT NULL
+) ;
+
+CREATE TABLE Event_methods_Method (
+ __IDEvent__ Integer NOT NULL,
+ __IDMethod__ Integer NOT NULL
+) ;
+
+CREATE TABLE Event_declarations_Declaration (
+ __IDEvent__ Integer NOT NULL,
+ __IDDeclaration__ Integer NOT NULL
+) ;
+
+CREATE TABLE ForeachStat_statements_Statement (
+ __IDForeachStat__ Integer NOT NULL,
+ __IDStatement__ Integer NOT NULL
+) ;
+
+CREATE TABLE Dialog_declarations_Declaration (
+ __IDDialog__ Integer NOT NULL,
+ __IDDeclaration__ Integer NOT NULL
+) ;
+
+CREATE TABLE Method_branches_Branch (
+ __IDMethod__ Integer NOT NULL,
+ __IDBranch__ Integer NOT NULL
+) ;
+
+CREATE TABLE Service_sessions_Session (
+ __IDService__ Integer NOT NULL,
+ __IDSession__ Integer NOT NULL
+) ;
+
+CREATE TABLE SequenceConstant_values_Constant (
+ __IDSequenceConstant__ Integer NOT NULL,
+ __IDConstant__ Integer NOT NULL
+) ;
+
+CREATE TABLE SelectCase_values_Constant (
+ __IDSelectCase__ Integer NOT NULL,
+ __IDConstant__ Integer NOT NULL
+) ;
diff --git a/syntaxes/SQLDDL/Syntax/SQLDDL.tcs b/syntaxes/SQLDDL/Syntax/SQLDDL.tcs
new file mode 100644
index 0000000..2c3ca04
--- /dev/null
+++ b/syntaxes/SQLDDL/Syntax/SQLDDL.tcs
@@ -0,0 +1,235 @@
+-- @authors Frédéric Jouault
+-- @date 2006/01/13
+-- @description This TCS model defines the syntax of SQL DDL.
+syntax SQLDDL {
+
+ primitiveTemplate identifier for String default using NAME:
+ value = "%token%";
+
+ primitiveTemplate stringSymbol for String using STRING:
+ value = "%token%",
+ serializer="'\'' + %value%.toCString() + '\''";
+
+ primitiveTemplate integerSymbol for Integer default using INT:
+ value = "Integer.valueOf(%token%)";
+
+ primitiveTemplate floatSymbol for Double default using FLOAT:
+ value = "Double.valueOf(%token%)";
+
+ template Database main context
+ : tables
+ ;
+
+ template Table context addToContext
+ : "CREATE" "TABLE" name "(" [
+ elements{separator = ","}
+ ] ")" parameters ";"
+ ;
+
+-- @end Table Elements
+ template TableElement abstract;
+
+ template Column addToContext
+ : name type
+ (canBeNull ? : "NOT" "NULL")
+ (isDefined(default) ? "default" default{as = stringSymbol})
+ ;
+
+ template Key abstract;
+
+ template SimpleKey
+ : (isUnique ? "UNIQUE")
+ "KEY" (isDefined(name) ? name) "(" columns{refersTo = name, separator = ","} ")"
+ ;
+
+ template PrimaryKey
+ : "PRIMARY" (isUnique ? "UNIQUE")
+ "KEY" (isDefined(name) ? name) "(" columns{refersTo = name, separator = ","} ")"
+ ;
+
+ template ForeignKey
+ : "FOREIGN" (isUnique ? "UNIQUE")
+ "KEY" (isDefined(name) ? name) "(" columns{refersTo = name, separator = ","} ")"
+ "REFERENCES" referencedTable{refersTo = name} "(" referencedColumns{separator = ",", refersTo = name, lookIn = referencedTable} ")"
+ ;
+-- @begin Table Elements
+
+ template Type
+ : name (isDefined(length) ? "(" length{separator = ","} ")") (isUnsigned ? "unsigned")
+ ;
+
+ template Parameter
+ : name (isDefined(value) ? "=" value)
+ ;
+
+-- @begin Values
+ template Value abstract;
+
+ template IntegerVal
+ : value
+ ;
+
+ template NullVal
+ : "NULL"
+ ;
+
+ template StringVal
+ : value{as = stringSymbol}
+ ;
+-- @end Values
+
+ symbols {
+ lsquare = "[";
+ rsquare = "]" : rightSpace;
+ excl = "!";
+ coma = "," : leftNone, rightSpace;
+ lparen = "(" : leftSpace;
+ rparen = ")" : rightSpace;
+ lcurly = "{" : leftSpace;
+ rcurly = "}";
+ semi = ";";
+ colon = ":" : leftSpace, rightSpace;
+ colons = "::";
+ pipe = "|";
+ sharp = "#";
+ qmark = "?";
+
+ -- operator symbols
+ point = ".";
+ rarrow = "->";
+ minus = "-";
+ star = "*";
+ slash = "/";
+ plus = "+";
+ eq = "=";
+ gt = ">";
+ lt = "<";
+ ge = ">=";
+ le = "<=";
+ ne = "<>";
+ larrow = "<-";
+ }
+
+ token COMMENT : endOfLine(start = "--");
+
+ lexer = "
+%options testLiterals = false;
+NL
+ : ( '\\r' '\\n'
+ | '\\n' '\\r' //Improbable
+ | '\\r'
+ | '\\n'
+ )
+ {newline();}
+ ;
+
+WS
+ : ( ' '
+ | '\\t'
+ )
+ ;
+
+%protected
+DIGIT
+ : '0'..'9'
+ ;
+
+%protected
+ALPHA
+ : 'a'..'z'
+ | 'A'..'Z'
+ | '_'
+ //For Unicode compatibility (from 0000 to 00ff)
+ | '\\u00C0' .. '\\u00D6'
+ | '\\u00D8' .. '\\u00F6'
+ | '\\u00F8' .. '\\u00FF'
+ ;
+
+%protected
+SNAME
+%v2 options {
+%v2 testLiterals = true;
+%v2 }
+ : (ALPHA) (ALPHA | DIGIT)*
+;
+
+NAME
+ : (
+%v3 SNAME
+%v2 s:SNAME {if(s.getType() != SNAME) $setType(s.getType());}
+ | '\"'!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\\"'|'\\n')
+ )*
+ '\"'!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ )
+ ;
+
+INT
+ : (DIGIT)+
+%v2 (('.' DIGIT)=> '.' (DIGIT)+ {$setType(FLOAT);})?
+ ;
+
+%v3 FLOAT : DIGIT+ (('.' DIGIT)=>'.' DIGIT+)? ; // cannot accept DIGIT '.' because it would conflict with Navigation
+
+%protected
+ESC
+ : '\\\\'!
+ ( 'n' %v2{%setText(\"\\n\");}
+ | 'r' %v2{%setText(\"\\r\");}
+ | 't' %v2{%setText(\"\\t\");}
+ | 'b' %v2{%setText(\"\\b\");}
+ | 'f' %v2{%setText(\"\\f\");}
+ | '\"' %v2{%setText(\"\\\"\");}
+ | '\\'' %v2{%setText(\"\\'\");}
+ | '\\\\' %v2{%setText(\"\\\\\");}
+ | (
+ ('0'..'3')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : '0'..'7'
+ )?
+ )?
+ | ('4'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ )?
+ )
+ {
+%v2 String s = %getText;
+%v2 int i;
+%v2 int ret = 0;
+%v2 String ans;
+%v2 for (i=0; i<s.length(); ++i)
+%v2 ret = ret*8 + s.charAt(i) - '0';
+%v2 ans = String.valueOf((char) ret);
+%v2 %setText(ans);
+ }
+ )
+ ;
+
+STRING
+ : '\\''!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\''|'\\n')
+ )*
+ '\\''!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ ;
+ ";
+
+}
+
diff --git a/syntaxes/SQLDDL/build.properties b/syntaxes/SQLDDL/build.properties
new file mode 100644
index 0000000..78b2915
--- /dev/null
+++ b/syntaxes/SQLDDL/build.properties
@@ -0,0 +1,2 @@
+dsl.name=SQLDDL
+dsl.ext=sql \ No newline at end of file
diff --git a/syntaxes/Scatter/.project b/syntaxes/Scatter/.project
new file mode 100644
index 0000000..8f16e6c
--- /dev/null
+++ b/syntaxes/Scatter/.project
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Scatter</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.m2m.atl.adt.builder.atlBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.gmt.tcs.builder.Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2m.atl.adt.builder.atlNature</nature>
+ </natures>
+</projectDescription>
diff --git a/syntaxes/Scatter/Metamodel/Scatter.ann b/syntaxes/Scatter/Metamodel/Scatter.ann
new file mode 100644
index 0000000..21a872b
--- /dev/null
+++ b/syntaxes/Scatter/Metamodel/Scatter.ann
@@ -0,0 +1,2 @@
+annotate Scatter {
+} \ No newline at end of file
diff --git a/syntaxes/Scatter/Metamodel/Scatter.km3 b/syntaxes/Scatter/Metamodel/Scatter.km3
new file mode 100644
index 0000000..aaaad22
--- /dev/null
+++ b/syntaxes/Scatter/Metamodel/Scatter.km3
@@ -0,0 +1,98 @@
+-- @name Scatter
+-- @version 1.0
+-- @domains Constraint solving
+-- @authors Frédéric Jouault, Jules White
+-- @date 2007/10/04
+-- @description Scatter metamodel.
+package Scatter {
+
+ abstract class LocatedElement {
+ attribute location[0-1] : String;
+ attribute commentsBefore[*] ordered : String;
+ attribute commentsAfter[*] ordered : String;
+ }
+
+ class SourceItem extends LocatedElement {
+ reference features[*] ordered container : Feature;
+ }
+
+ class Feature extends LocatedElement {
+ attribute name : String;
+ reference directives[*] ordered container : Directive;
+ }
+
+-- @begin Directives
+ abstract class Directive extends LocatedElement {}
+
+ class Requires extends Directive {
+ reference features[*] ordered : Feature;
+ }
+
+ class Instances extends Directive {
+ reference cardinality container : Cardinality;
+ }
+
+ class Select extends Directive {
+ reference cardinality container : Cardinality;
+ reference features[*] ordered : Feature;
+ }
+
+ class Target extends Directive {
+ reference constraint container : Expression;
+ }
+
+ class Set extends Directive {
+ reference valueDefinition container : Expression;
+ }
+-- @end Directives
+
+ abstract class Cardinality extends LocatedElement {}
+
+ class BoundedCardinality extends Cardinality{
+ attribute lower : Integer;
+ attribute upper : Integer;
+ }
+
+ class FixedCardinality extends Cardinality{
+ attribute value : Integer;
+ }
+
+--@begin Expressions
+ abstract class Expression extends LocatedElement {}
+
+ class FeaturePropertyExp extends Expression {
+ reference feature : Feature;
+ attribute name : String;
+ }
+
+ class SourcePropertyExp extends Expression {
+ attribute name : String;
+ }
+
+ class TargetPropertyExp extends Expression {
+ attribute name : String;
+ }
+
+ class BinaryOperatorExp extends Expression {
+ reference left container : Expression;
+ attribute operator : String;
+ reference right container : Expression;
+ }
+
+ class EqualsExp extends Expression {
+ reference left container : Expression;
+ reference right container : Expression;
+ }
+
+ class ConstantExp extends Expression {
+ attribute name : String;
+ }
+--@end Expressions
+
+}
+
+package PrimitiveTypes {
+ datatype Boolean;
+ datatype Integer;
+ datatype String;
+}
diff --git a/syntaxes/Scatter/Samples/Car.refresh b/syntaxes/Scatter/Samples/Car.refresh
new file mode 100644
index 0000000..c9226f2
--- /dev/null
+++ b/syntaxes/Scatter/Samples/Car.refresh
@@ -0,0 +1,23 @@
+Car {
+ Requires:Wheels,Engine,Frame;
+}
+
+Wheels {
+ Instances:3..4;
+}
+
+Engine {
+ Select:[1..2],Turbo,LargeExhaust;
+ Target:Source.MaxWeight > Target.MaxWeight;
+}
+
+LargeExhaust {
+ Set:Engine.manifold=XYZManifold;
+}
+
+Turbo {
+ Instances:1;
+}
+
+Frame {
+}
diff --git a/syntaxes/Scatter/Syntax/Scatter.tcs b/syntaxes/Scatter/Syntax/Scatter.tcs
new file mode 100644
index 0000000..92ff00b
--- /dev/null
+++ b/syntaxes/Scatter/Syntax/Scatter.tcs
@@ -0,0 +1,275 @@
+-- @authors Frédéric Jouault, Jules White
+-- @date 2007/10/04/
+-- @description This TCS model defines the syntax of the Scatter language.
+syntax Scatter {
+
+ primitiveTemplate identifier for String default using NAME:
+ value = "%token%";
+
+ primitiveTemplate stringSymbol for String using STRING:
+ value = "%token%",
+ serializer="'\'' + %value%.toCString() + '\''";
+
+ primitiveTemplate integerSymbol for Integer default using INT:
+ value = "Integer.valueOf(%token%)";
+
+ template SourceItem main context
+ : [ features ] {nbNL = 2, startNL = false, indentIncr = 0}
+ ;
+
+ template Feature addToContext
+ : name "{" [
+ directives
+ ] "}"
+ ;
+
+-- @begin Directives
+ template Directive abstract;
+
+ template Requires
+ : "Requires" ":" features{refersTo = name, separator = ","} ";"
+ ;
+
+ template Instances
+ : "Instances" ":" cardinality ";"
+ ;
+
+ template Select
+ : "Select" ":" "[" cardinality "]" "," features{refersTo = name, separator = ","} ";"
+ ;
+
+ template Target
+ : "Target" ":" constraint ";"
+ ;
+
+ template Set
+ : "Set" ":" valueDefinition ";"
+ ;
+-- @end Directives
+
+ template Cardinality abstract;
+-- : (isDefined(lower) ?
+-- lower ".."
+-- ) upper
+-- ;
+
+ template BoundedCardinality
+ : lower ".." upper
+ ;
+
+ template FixedCardinality
+ : value
+ ;
+
+-- @begin Expressions
+ template Expression abstract operatored;
+
+ template FeaturePropertyExp
+ : feature{refersTo = name} "." name
+ ;
+
+ template SourcePropertyExp
+ : "Source" "." name
+ ;
+
+ template TargetPropertyExp
+ : "Target" "." name
+ ;
+
+ operatorTemplate BinaryOperatorExp(operators =
+ opPlus opMinus2
+ opStar opDiv opSlash opMod
+ opLt opLe opNe opGe opGt
+ opAnd opOr
+ , source = 'left', storeOpTo = operator, storeRightTo = 'right');
+
+ operatorTemplate EqualsExp(operators =
+ opEq
+ , source = 'left', storeRightTo = 'right');
+
+ template ConstantExp
+ : name
+ ;
+-- @end Expressions
+
+ symbols {
+ lsquare = "[";
+ rsquare = "]";
+ excl = "!";
+ coma = ",";
+ lparen = "(";
+ rparen = ")" : rightSpace;
+ lcurly = "{" : leftSpace;
+ rcurly = "}" : rightSpace;
+ semi = ";" : leftNone;
+ colon = ":" : leftSpace, rightSpace;
+ pipe = "|";
+ sharp = "#";
+ qmark = "?";
+
+ -- operator symbols
+ point = "." : leftNone;
+ rarrow = "->";
+ minus = "-" : leftSpace, rightSpace;
+ star = "*" : leftSpace, rightSpace;
+ slash = "/" : leftSpace, rightSpace;
+ plus = "+" : leftSpace, rightSpace;
+ eq = "=" : leftSpace, rightSpace;
+ gt = ">" : leftSpace, rightSpace;
+ lt = "<" : leftSpace, rightSpace;
+ ge = ">=" : leftSpace, rightSpace;
+ le = "<=" : leftSpace, rightSpace;
+ ne = "<>" : leftSpace, rightSpace;
+ larrow = "<-" : leftSpace, rightSpace;
+
+ assign = ":=" : leftSpace, rightSpace;
+ dotdot = "..";
+ }
+
+ operators {
+ priority 0 {
+ opStar = star, 2;
+ opSlash = slash, 2;
+ opDiv = "div", 2;
+ opMod = "mod", 2;
+ }
+
+ priority 1 {
+ opPlus = plus, 2;
+ opMinus2 = minus, 2;
+ }
+
+ priority 2 {
+ opEq = eq, 2;
+ opGt = gt, 2;
+ opLt = lt, 2;
+ opGe = ge, 2;
+ opLe = le, 2;
+ opNe = ne, 2;
+ }
+
+ priority 3 {
+ opAnd = "and", 2;
+ opOr = "or", 2;
+ }
+ }
+
+ token COMMENT : endOfLine(start = "--");
+
+ lexer = "
+%options testLiterals = false;
+NL
+ : ( '\\r' '\\n'
+ | '\\n' '\\r' //Improbable
+ | '\\r'
+ | '\\n'
+ )
+ {newline();}
+ ;
+
+WS
+ : ( ' '
+ | '\\t'
+ )
+ ;
+
+%protected
+DIGIT
+ : '0'..'9'
+ ;
+
+%protected
+ALPHA
+ : 'a'..'z'
+ | 'A'..'Z'
+ | '_'
+ //For Unicode compatibility (from 0000 to 00ff)
+ | '\\u00C0' .. '\\u00D6'
+ | '\\u00D8' .. '\\u00F6'
+ | '\\u00F8' .. '\\u00FF'
+ ;
+
+%protected
+SNAME
+%v2 options {
+%v2 testLiterals = true;
+%v2 }
+ : (ALPHA) (ALPHA | DIGIT)*
+;
+
+NAME
+ : (
+%v3 SNAME
+%v2 s:SNAME {if(s.getType() != SNAME) $setType(s.getType());}
+ | '\"'!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\\"'|'\\n')
+ )*
+ '\"'!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ )
+ ;
+
+INT
+ : (DIGIT)+
+ ;
+
+%protected
+ESC
+ : '\\\\'!
+ ( 'n' %v2{%setText(\"\\n\");}
+ | 'r' %v2{%setText(\"\\r\");}
+ | 't' %v2{%setText(\"\\t\");}
+ | 'b' %v2{%setText(\"\\b\");}
+ | 'f' %v2{%setText(\"\\f\");}
+ | '\"' %v2{%setText(\"\\\"\");}
+ | '\\'' %v2{%setText(\"\\'\");}
+ | '\\\\' %v2{%setText(\"\\\\\");}
+ | (
+ ('0'..'3')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : '0'..'7'
+ )?
+ )?
+ | ('4'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ )?
+ )
+ {
+%v2 String s = %getText;
+%v2 int i;
+%v2 int ret = 0;
+%v2 String ans;
+%v2 for (i=0; i<s.length(); ++i)
+%v2 ret = ret*8 + s.charAt(i) - '0';
+%v2 ans = String.valueOf((char) ret);
+%v2 %setText(ans);
+ }
+ )
+ ;
+
+STRING
+ : '\\''!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\''|'\\n')
+ )*
+ '\\''!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ ;
+ ";
+}
+
diff --git a/syntaxes/Scatter/build.properties b/syntaxes/Scatter/build.properties
new file mode 100644
index 0000000..105c49d
--- /dev/null
+++ b/syntaxes/Scatter/build.properties
@@ -0,0 +1,2 @@
+dsl.name=Scatter
+dsl.ext=refresh \ No newline at end of file
diff --git a/syntaxes/XML2/.externalToolBuilders/XML2 Language Builder.launch b/syntaxes/XML2/.externalToolBuilders/XML2 Language Builder.launch
new file mode 100644
index 0000000..5274791
--- /dev/null
+++ b/syntaxes/XML2/.externalToolBuilders/XML2 Language Builder.launch
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/AMMAScripts/build.dsl.xml"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,clean"/>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="AMMAScripts"/>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_CLEAN_TARGETS" value="clean,"/>
+<stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
+<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/XML2}"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre1.6.0_01&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.ant.ui.classpathentry.antHome&quot;&gt;&#13;&#10;&lt;memento default=&quot;true&quot;/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.ant.ui.classpathentry.extraClasspathEntries&quot;&gt;&#13;&#10;&lt;memento/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/AMMAScripts/libs/antlr.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/AMMAScripts/libs/antlr-3.0.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/AMMAScripts/libs/antlr3-ant.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/AMMAScripts/libs/stringtemplate-3.0.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/AMMAScripts/build.dsl.xml}"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+</launchConfiguration>
diff --git a/syntaxes/XML2/.project b/syntaxes/XML2/.project
new file mode 100644
index 0000000..03a3df0
--- /dev/null
+++ b/syntaxes/XML2/.project
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>XML2</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ <dictionary>
+ <key>LaunchConfigHandle</key>
+ <value>&lt;project&gt;/.externalToolBuilders/XML2 Language Builder.launch</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2m.atl.adt.builder.atlBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2m.atl.adt.builder.atlNature</nature>
+ </natures>
+</projectDescription>
diff --git a/syntaxes/XML2/Metamodel/XML2.ann b/syntaxes/XML2/Metamodel/XML2.ann
new file mode 100644
index 0000000..1d88a4b
--- /dev/null
+++ b/syntaxes/XML2/Metamodel/XML2.ann
@@ -0,0 +1,2 @@
+annotate XML2 {
+} \ No newline at end of file
diff --git a/syntaxes/XML2/Metamodel/XML2.km3 b/syntaxes/XML2/Metamodel/XML2.km3
new file mode 100644
index 0000000..3db8aed
--- /dev/null
+++ b/syntaxes/XML2/Metamodel/XML2.km3
@@ -0,0 +1,44 @@
+-- @name XML2
+-- @version 1.0
+-- @domains XML technology
+-- @authors Frédéric Jouault
+-- @date 2007/05/28
+-- @description This metamodel defines XML concepts in a way that makes TCS usable (i.e., by separating child attributes from child elements and text nodes).
+package XML2 {
+
+ abstract class LocatedElement {
+ attribute location[0-1] : String;
+ attribute commentsBefore[*] ordered : String;
+ attribute commentsAfter[*] ordered : String;
+ }
+
+ abstract class Node extends LocatedElement {
+ reference parent[0-1] : Element oppositeOf children;
+ }
+
+ class Attribute extends LocatedElement {
+ attribute prefix[0-1] : String;
+ attribute name : String;
+ attribute value : String;
+ reference owner : Element oppositeOf attributes;
+ }
+
+ class Text extends Node {
+ attribute value : String;
+ }
+
+ class Element extends Node {
+ attribute prefix[0-1] : String;
+ attribute name : String;
+ reference attributes[*] ordered container : Attribute oppositeOf owner;
+ reference children[*] ordered container : Node oppositeOf parent;
+ }
+
+ class Root extends Element {}
+}
+
+package PrimitiveTypes {
+ datatype Boolean;
+ datatype Integer;
+ datatype String;
+}
diff --git a/syntaxes/XML2/Samples/Test.xml2 b/syntaxes/XML2/Samples/Test.xml2
new file mode 100644
index 0000000..bdd6015
--- /dev/null
+++ b/syntaxes/XML2/Samples/Test.xml2
@@ -0,0 +1,9 @@
+<a>
+ <!-- Test -->
+ <b name="test">
+ </b>
+ <c>
+ <d>
+ </d>
+ </c>
+</a>
diff --git a/syntaxes/XML2/Samples/XML2.xml2 b/syntaxes/XML2/Samples/XML2.xml2
new file mode 100644
index 0000000..05661a4
--- /dev/null
+++ b/syntaxes/XML2/Samples/XML2.xml2
@@ -0,0 +1,33 @@
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">
+ <ecore:EPackage name="XML2">
+ <eClassifiers xsi:type="ecore:EClass" name="LocatedElement" abstract="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="location" ordered="false" unique="false" eType="/1/String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="startLine" ordered="false" unique="false" eType="/1/Integer"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="startColumn" ordered="false" unique="false" eType="/1/Integer"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="endLine" ordered="false" unique="false" eType="/1/Integer"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="endColumn" ordered="false" unique="false" eType="/1/Integer"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Node" abstract="true" eSuperTypes="/0/LocatedElement">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="parent" ordered="false" eType="/0/Element" eOpposite="/0/Element/children"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Attribute" eSuperTypes="/0/LocatedElement">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false" unique="false" lowerBound="1" eType="/1/String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" ordered="false" unique="false" lowerBound="1" eType="/1/String"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="owner" ordered="false" lowerBound="1" eType="/0/Element" eOpposite="/0/Element/attributes"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Text" eSuperTypes="/0/Node">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" ordered="false" unique="false" lowerBound="1" eType="/1/String"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Element" eSuperTypes="/0/Node">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false" unique="false" lowerBound="1" eType="/1/String"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="attributes" upperBound="-1" eType="/0/Attribute" containment="true" eOpposite="/0/Attribute/owner"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="children" upperBound="-1" eType="/0/Node" containment="true" eOpposite="/0/Node/parent"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Root" eSuperTypes="/0/Element"/>
+ </ecore:EPackage>
+ <ecore:EPackage name="PrimitiveTypes">
+ <eClassifiers xsi:type="ecore:EDataType" name="Boolean"/>
+ <eClassifiers xsi:type="ecore:EDataType" name="Integer"/>
+ <eClassifiers xsi:type="ecore:EDataType" name="String"/>
+ </ecore:EPackage>
+</xmi:XMI>
diff --git a/syntaxes/XML2/Syntax/XML2.tcs b/syntaxes/XML2/Syntax/XML2.tcs
new file mode 100644
index 0000000..dcb3739
--- /dev/null
+++ b/syntaxes/XML2/Syntax/XML2.tcs
@@ -0,0 +1,204 @@
+-- @authors Frédéric Jouault
+-- @date 2007/05/28
+-- @description This TCS model defines the syntax of the XML2 language.
+syntax XML2 {
+
+ primitiveTemplate identifier for String default using NAME:
+ value = "%token%";
+
+ primitiveTemplate identifierOrKeyword for String using NAME orKeyword:
+ value = "%token%";
+
+ primitiveTemplate stringSymbol for String using STRING:
+ value = "%token%",
+ serializer="'\'' + %value%.toCString() + '\''";
+
+ primitiveTemplate integerSymbol for Integer default using INT:
+ value = "Integer.valueOf(%token%)";
+
+ primitiveTemplate floatSymbol for Double default using FLOAT:
+ value = "Double.valueOf(%token%)";
+
+ template Root main
+ : $elementContents
+ ;
+
+ -- duplicate features:
+ -- - name:
+ -- - this will (more or less) work for injection (no check if name is the same though)
+ -- - this works for extraction
+ function elementContents(Element)
+ : "<" (isDefined(prefix) ? prefix ":") name attributes
+ (isDefined(children) ? ">" [
+ children
+ ] "<" "/" (isDefined(prefix) ? prefix ":") name ">"
+ :
+ "/" ">"
+ )
+ ;
+
+ template Element
+ : $elementContents
+ ;
+
+ template Node abstract;
+
+ template Attribute
+ : (isDefined(prefix) ? prefix ":") name "=" value{as = stringSymbol}
+ ;
+
+ symbols {
+ lsquare = "[";
+ rsquare = "]" : rightSpace;
+ excl = "!";
+ coma = "," : leftNone, rightSpace;
+ lparen = "(";
+ rparen = ")" : leftNone, rightSpace;
+ lcurly = "{" : leftSpace;
+ rcurly = "}" : leftNone, rightSpace;
+ semi = ";" : leftNone, rightSpace;
+ colon = ":" : leftSpace, rightSpace; -- except after def where it is leftNone, rightSpace
+ pipe = "|" : leftSpace, rightSpace;
+ sharp = "#" : leftSpace;
+ qmark = "?";
+ coloncolon = "::" : leftNone, rightNone;
+
+ -- operator symbols
+ point = "." : leftNone;
+ rarrow = "->" : leftNone;
+ minus = "-" : leftSpace, rightSpace;
+ star = "*" : leftSpace, rightSpace;
+ slash = "/" : leftSpace, rightSpace;
+ plus = "+" : leftSpace, rightSpace;
+ eq = "=" : leftSpace, rightSpace;
+ gt = ">" : leftSpace, rightSpace;
+ lt = "<" : leftSpace, rightSpace;
+ ge = ">=" : leftSpace, rightSpace;
+ le = "<=" : leftSpace, rightSpace;
+ ne = "<>" : leftSpace, rightSpace;
+ larrow = "<-" : leftSpace, rightSpace;
+ }
+
+ token COMMENT : multiLine(start = "<!--", end = "-->");
+
+ lexer = "
+%options testLiterals = false;
+NL
+ : ( '\\r' '\\n'
+ | '\\n' '\\r' //Improbable
+ | '\\r'
+ | '\\n'
+ )
+ {newline();}
+ ;
+
+WS
+ : ( ' '
+ | '\\t'
+ )
+ ;
+
+%protected
+DIGIT
+ : '0'..'9'
+ ;
+
+%protected
+ALPHA
+ : 'a'..'z'
+ | 'A'..'Z'
+ | '_'
+ //For Unicode compatibility (from 0000 to 00ff)
+ | '\\u00C0' .. '\\u00D6'
+ | '\\u00D8' .. '\\u00F6'
+ | '\\u00F8' .. '\\u00FF'
+ ;
+
+%protected
+SNAME
+%v2 options {
+%v2 testLiterals = true;
+%v2 }
+ : (ALPHA) (ALPHA | DIGIT)*
+;
+
+NAME
+ :
+%v3 SNAME
+%v2 s:SNAME {if(s.getType() != SNAME) $setType(s.getType());}
+ ;
+
+INT
+ : (DIGIT)+
+%v2 (('.' DIGIT)=> '.' (DIGIT)+ {$setType(FLOAT);})?
+ ;
+
+%v3 FLOAT : DIGIT+ (('.' DIGIT)=>'.' DIGIT+)? ; // cannot accept DIGIT '.' because it would conflict with Navigation
+
+%protected
+ESC
+ : '\\\\'!
+ ( 'n' %v2{%setText(\"\\n\");}
+ | 'r' %v2{%setText(\"\\r\");}
+ | 't' %v2{%setText(\"\\t\");}
+ | 'b' %v2{%setText(\"\\b\");}
+ | 'f' %v2{%setText(\"\\f\");}
+ | '\"' %v2{%setText(\"\\\"\");}
+ | '\\'' %v2{%setText(\"\\'\");}
+ | '\\\\' %v2{%setText(\"\\\\\");}
+ | (
+ ('0'..'3')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : '0'..'7'
+ )?
+ )?
+ | ('4'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ )?
+ )
+ {
+%v2 String s = %getText;
+%v2 int i;
+%v2 int ret = 0;
+%v2 String ans;
+%v2 for (i=0; i<s.length(); ++i)
+%v2 ret = ret*8 + s.charAt(i) - '0';
+%v2 ans = String.valueOf((char) ret);
+%v2 %setText(ans);
+ }
+ )
+ ;
+
+STRING
+ : ('\\''!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\''|'\\n')
+ )*
+ '\\''!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ | '\"'!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\\"'|'\\n')
+ )*
+ '\"'!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ )
+
+ ;
+ ";
+
+}
diff --git a/syntaxes/XML2/build.properties b/syntaxes/XML2/build.properties
new file mode 100644
index 0000000..f0a97eb
--- /dev/null
+++ b/syntaxes/XML2/build.properties
@@ -0,0 +1,2 @@
+dsl.name=XML2
+dsl.ext=xml2 \ No newline at end of file
diff --git a/syntaxes/XPath/.externalToolBuilders/XPath Language Builder.launch b/syntaxes/XPath/.externalToolBuilders/XPath Language Builder.launch
new file mode 100644
index 0000000..9661af5
--- /dev/null
+++ b/syntaxes/XPath/.externalToolBuilders/XPath Language Builder.launch
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/AMMAScripts/build.dsl.xml"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,clean"/>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="AMMAScripts"/>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_CLEAN_TARGETS" value="clean,"/>
+<stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
+<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/XPath}"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre1.6.0_01&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.ant.ui.classpathentry.antHome&quot;&gt;&#13;&#10;&lt;memento default=&quot;true&quot;/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.ant.ui.classpathentry.extraClasspathEntries&quot;&gt;&#13;&#10;&lt;memento/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/AMMAScripts/libs/antlr.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/AMMAScripts/libs/antlr-3.0.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/AMMAScripts/libs/antlr3-ant.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/AMMAScripts/libs/stringtemplate-3.0.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/AMMAScripts/build.dsl.xml}"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+</launchConfiguration>
diff --git a/syntaxes/XPath/.project b/syntaxes/XPath/.project
new file mode 100644
index 0000000..ab7be10
--- /dev/null
+++ b/syntaxes/XPath/.project
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>XPath</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ <dictionary>
+ <key>LaunchConfigHandle</key>
+ <value>&lt;project&gt;/.externalToolBuilders/XPath Language Builder.launch</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2m.atl.adt.builder.atlBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2m.atl.adt.builder.atlNature</nature>
+ </natures>
+</projectDescription>
diff --git a/syntaxes/XPath/Interpreter/XPathEvaluator.atl b/syntaxes/XPath/Interpreter/XPathEvaluator.atl
new file mode 100644
index 0000000..7edd9ba
--- /dev/null
+++ b/syntaxes/XPath/Interpreter/XPathEvaluator.atl
@@ -0,0 +1,177 @@
+-- @atlcompiler atl2006
+library XPathEvaluator;
+
+helper context String def: evalXPath(contextNode : XML!Node) : OclAny =
+ self.inject(
+ 'XPathTemp', 'ebnf2', 'name=XPath,isEmbedded=false,keepNL=false,tabSize=1,parserGenerator=antlr3'
+ ).eval(contextNode);
+
+
+helper context XPath!PathExpression def: eval(contextNode : XML!Node) : OclAny =
+ self.steps->iterate(s; acc : Sequence(XML!Node) = Sequence {contextNode} |
+ acc->collect(e |
+ s.eval(e)
+ )->flatten()
+ );
+
+helper context XPath!Step def: eval(contextNode : XML!Node) : OclAny =
+ self.predicates->iterate(p; acc : OclAny = self.axis.eval(contextNode, self.nodeTest) |
+ acc->iterate(e; acc : TupleType(location : Integer, ret : OclAny) =
+ Tuple {location = 1, ret = Sequence {}} |
+ let result : OclAny = p.expression.eval(e) in
+ Tuple {
+ location = acc.location + 1,
+ ret =
+ if result.oclIsKindOf(Integer) then
+ if result = acc.location then
+ acc.ret->including(e)
+ else
+ acc.ret
+ endif
+ else
+ if result.asBoolean() then
+ acc.ret->including(e)
+ else
+ acc.ret
+ endif
+ endif
+ }
+ ).ret
+ );
+
+-- @begin Expressions
+helper context XPath!Expression def: eval(contextNode : XML!Node) : OclAny =
+ OclUndefined.debug('unsupported expression ' + self.oclType().name);
+
+helper context XPath!OperatorCallExp def: eval(contextNode : XML!Node) : OclAny =
+ let left : OclAny = self.left.eval(contextNode) in
+ let right : OclAny = self.right.eval(contextNode) in
+ if self.name = 'and' then
+ left.asBoolean() and right.asBoolean()
+ else if self.name = '=' then
+ if left.oclIsKindOf(String) then
+ left = right.asString()
+ else if right.oclIsKindOf(String) then
+ left.asString() = right
+ else -- TODO: more type conversions
+ left = right
+ endif endif
+ else
+ OclUndefined.debug('unsupported operator ' + self.name)
+ endif endif;
+
+helper context XPath!IntegerExp def: eval(contextNode : XML!Node) : OclAny =
+ self.symbol;
+
+helper context XPath!StringExp def: eval(contextNode : XML!Node) : OclAny =
+ self.symbol;
+-- @end Expressions
+
+-- @begin Value helpers
+-- We need an operation version, so that it works on collections
+helper context OclAny def: asString() : String =
+ if self.oclIsKindOf(Collection(OclAny)) then
+ if self->isEmpty() then
+ ''
+ else if self->size() = 1 then
+ self->any(e | true).asString
+ else -- TODO: more
+ self->collect(e | e.asString)
+ endif endif
+ else
+ self.toString()
+ endif;
+
+helper context OclAny def: asString : String =
+ if self.oclIsKindOf(Collection(OclAny)) then
+ if self->isEmpty() then
+ ''
+ else if self->size() = 1 then
+ self->any(e | true).asString
+ else -- TODO: more
+ self->collect(e | e.asString)
+ endif endif
+ else
+ self.toString()
+ endif;
+
+helper context String def: asString : String =
+ self;
+
+helper context XML!Attribute def: asString : String =
+ self.value;
+
+helper context XML!Text def: asString : String =
+ self.value;
+
+helper context XML!Element def: asString : String =
+ self.children->iterate(e; acc : String = '' |
+ if e.oclIsKindOf(XML!Text) then
+ acc + e.value
+ else if e.oclIsKindOf(XML!Element) then
+ acc + e.asString
+ else
+ acc
+ endif endif
+ );
+
+helper context OclAny def: asBoolean() : Boolean =
+ if self.oclIsKindOf(Collection(OclAny)) then
+ self->notEmpty()
+ else
+ not self.oclIsUndefined()
+ endif;
+
+helper context Boolean def: asBoolean() : Boolean =
+ self;
+-- @end Value helpers
+
+-- @begin Axes
+helper context XPath!Axis def: eval(contextNode : XML!Node, nodeTest : XPath!NodeTest) : Sequence(XML!Node) =
+ OclUndefined.debug('unsupported axis ' + self.oclType().name);
+
+helper context XPath!DescendantAxis def: eval(contextNode : XML!Node, nodeTest : XPath!NodeTest) : Sequence(XML!Node) =
+ contextNode.children->iterate(e; acc : Sequence(XML!Node) = Sequence {} |
+ if nodeTest.eval(e) then
+ acc->append(e)
+ else
+ acc
+ endif->union(
+ if e.oclIsKindOf(XML!Element) then
+ self.eval(e, nodeTest)
+ else
+ Sequence {}
+ endif
+ )
+ );
+
+helper context XPath!ParentAxis def: eval(contextNode : XML!Node, nodeTest : XPath!NodeTest) : Sequence(XML!Node) =
+ if contextNode.parent.oclIsUndefined() then
+ Sequence {}
+ else
+ Sequence {contextNode.parent}->select(e | nodeTest.eval(e))
+ endif;
+
+helper context XPath!ChildAxis def: eval(contextNode : XML!Node, nodeTest : XPath!NodeTest) : Sequence(XML!Node) =
+ contextNode.children->select(e |
+ nodeTest.eval(e)
+ );
+
+helper context XPath!AttributeAxis def: eval(contextNode : XML!Node, nodeTest : XPath!NodeTest) : Sequence(XML!Node) =
+ contextNode.children->select(e |
+ e.oclIsKindOf(XML!Attribute)
+ )->select(e |
+ nodeTest.eval(e)
+ );
+-- @end Axes
+
+-- @begin NodeTests
+helper context XPath!NodeTest def: eval(contextNode : XML!Node) : Boolean =
+ OclUndefined.debug('unsupported node test ' + self.oclType().name);
+
+helper context XPath!IsTextTest def: eval(contextNode : XML!Node) : Boolean =
+ contextNode.oclIsKindOf(XML!Text);
+
+helper context XPath!NameTest def: eval(contextNode : XML!Node) : Boolean =
+ contextNode.name = self.name;
+-- @end NodeTests
diff --git a/syntaxes/XPath/Metamodel/XPath.ann b/syntaxes/XPath/Metamodel/XPath.ann
new file mode 100644
index 0000000..02c71c7
--- /dev/null
+++ b/syntaxes/XPath/Metamodel/XPath.ann
@@ -0,0 +1,2 @@
+annotate XPath {
+} \ No newline at end of file
diff --git a/syntaxes/XPath/Metamodel/XPath.km3 b/syntaxes/XPath/Metamodel/XPath.km3
new file mode 100644
index 0000000..f8d1148
--- /dev/null
+++ b/syntaxes/XPath/Metamodel/XPath.km3
@@ -0,0 +1,177 @@
+-- @name XPath
+-- @version 1.0
+-- @domains XML technologies
+-- @authors Frédéric Jouault
+-- @date 2005/01/20
+-- @description This metamodel describes XPath.
+-- @see http://en.wikipedia.org/wiki/XPath
+package XPath {
+
+ abstract class LocatedElement {
+ attribute location[0-1] : String;
+ attribute commentsBefore[*] ordered : String;
+ attribute commentsAfter[*] ordered : String;
+ }
+
+ abstract class NamedElement extends LocatedElement {
+ attribute name : String;
+ }
+
+
+-- Expressions
+ abstract class Expression extends LocatedElement {
+
+ }
+
+ class VariableExp extends Expression, NamedElement {
+
+ }
+
+ class PathExpression extends Expression {
+ attribute isAbsolute : Boolean;
+ reference steps[*] ordered container : Step;
+ }
+
+ class Step extends LocatedElement {
+ reference axis container : Axis;
+ reference nodeTest container : NodeTest;
+ reference predicates[*] ordered container : Predicate;
+ }
+
+ class Predicate extends LocatedElement {
+ reference expression container : Expression;
+ }
+
+ class OperatorCallExp extends Expression, NamedElement {
+ reference left container : Expression;
+ reference right[0-1] container : Expression;
+ }
+
+ class FunctionCallExp extends Expression, NamedElement {
+ reference arguments[*] ordered container : Expression;
+ }
+
+ -- LiteralExps
+ abstract class LiteralExp extends Expression {
+
+ }
+
+ class IntegerExp extends LiteralExp {
+ attribute symbol : Integer;
+ }
+
+ class StringExp extends LiteralExp {
+ attribute symbol : String;
+ }
+
+ -- No BooleanExp. Booleans are represented by the true() and false() function calls.
+ -- End LiteralExps
+-- End Expressions
+
+
+-- NodeTests
+ abstract class NodeTest extends LocatedElement {
+
+ }
+
+ class NameTest extends NodeTest, NamedElement {
+
+ }
+
+ class WildCardTest extends NodeTest {
+
+ }
+
+ class IsNodeTest extends NodeTest {
+
+ }
+
+ class IsTextTest extends NodeTest {
+
+ }
+-- End NodeTests
+
+
+-- Axes
+-- enumeration AxisKind {
+-- literal ancestor;
+-- literal ancestorOrSelf;
+-- literal attribute;
+-- literal child;
+-- literal descendant;
+-- literal descendantOrSelf;
+-- literal following;
+-- literal followingSibling;
+-- literal namespace;
+-- literal parent;
+-- literal preceding;
+-- literal precedingSibling;
+-- literal self;
+-- }
+
+-- Metamodel Refactoring:
+-- enumeration AxisKind to classes with abstract Axis
+
+ abstract class Axis extends LocatedElement {
+
+ }
+
+ class AncestorAxis extends Axis {
+
+ }
+
+ class AncestorOrSelfAxis extends Axis {
+
+ }
+
+ class AttributeAxis extends Axis {
+
+ }
+
+ class ChildAxis extends Axis {
+
+ }
+
+ class DescendantAxis extends Axis {
+
+ }
+
+ class DescendantOrSelfAxis extends Axis {
+
+ }
+
+ class FollowingAxis extends Axis {
+
+ }
+
+ class FollowingSiblingAxis extends Axis {
+
+ }
+
+ class NamespaceAxis extends Axis {
+
+ }
+
+ class ParentAxis extends Axis {
+
+ }
+
+ class PrecedingAxis extends Axis {
+
+ }
+
+ class PrecedingSiblingAxis extends Axis {
+
+ }
+
+ class SelfAxis extends Axis {
+
+ }
+-- End Axes
+}
+
+package PrimitiveType {
+ datatype Boolean;
+ datatype Integer;
+ datatype String;
+}
diff --git a/syntaxes/XPath/Samples/README.txt b/syntaxes/XPath/Samples/README.txt
new file mode 100644
index 0000000..06e72fe
--- /dev/null
+++ b/syntaxes/XPath/Samples/README.txt
@@ -0,0 +1,3 @@
+Several samples do not parse.
+They illustrates the limit of the current concrete syntax definition.
+They may be used to test improvements. \ No newline at end of file
diff --git a/syntaxes/XPath/Samples/Test1.xpath b/syntaxes/XPath/Samples/Test1.xpath
new file mode 100644
index 0000000..eb821fc
--- /dev/null
+++ b/syntaxes/XPath/Samples/Test1.xpath
@@ -0,0 +1 @@
+descendant-or-self::test
diff --git a/syntaxes/XPath/Samples/Test2.xpath b/syntaxes/XPath/Samples/Test2.xpath
new file mode 100644
index 0000000..71114f6
--- /dev/null
+++ b/syntaxes/XPath/Samples/Test2.xpath
@@ -0,0 +1,2 @@
+cd[price > 5]
+
diff --git a/syntaxes/XPath/Samples/Test22.xpath b/syntaxes/XPath/Samples/Test22.xpath
new file mode 100644
index 0000000..c9d06ee
--- /dev/null
+++ b/syntaxes/XPath/Samples/Test22.xpath
@@ -0,0 +1,2 @@
+cd[./price > 5]
+
diff --git a/syntaxes/XPath/Samples/Test23.xpath b/syntaxes/XPath/Samples/Test23.xpath
new file mode 100644
index 0000000..5eb2d45
--- /dev/null
+++ b/syntaxes/XPath/Samples/Test23.xpath
@@ -0,0 +1,2 @@
+cd[@price > 5]/name
+
diff --git a/syntaxes/XPath/Samples/Test24.xpath b/syntaxes/XPath/Samples/Test24.xpath
new file mode 100644
index 0000000..240cda5
--- /dev/null
+++ b/syntaxes/XPath/Samples/Test24.xpath
@@ -0,0 +1,2 @@
+cd[@price > 5]/author[name = $searchedName]
+
diff --git a/syntaxes/XPath/Samples/Test3.xpath b/syntaxes/XPath/Samples/Test3.xpath
new file mode 100644
index 0000000..88c0c5b
--- /dev/null
+++ b/syntaxes/XPath/Samples/Test3.xpath
@@ -0,0 +1 @@
+child::cd[3]
diff --git a/syntaxes/XPath/Samples/Test32.xpath b/syntaxes/XPath/Samples/Test32.xpath
new file mode 100644
index 0000000..91664e9
--- /dev/null
+++ b/syntaxes/XPath/Samples/Test32.xpath
@@ -0,0 +1 @@
+cd[3]
diff --git a/syntaxes/XPath/Samples/Test4.xpath b/syntaxes/XPath/Samples/Test4.xpath
new file mode 100644
index 0000000..f33dfa2
--- /dev/null
+++ b/syntaxes/XPath/Samples/Test4.xpath
@@ -0,0 +1 @@
+1
diff --git a/syntaxes/XPath/Samples/Test5.xpath b/syntaxes/XPath/Samples/Test5.xpath
new file mode 100644
index 0000000..240af5d
--- /dev/null
+++ b/syntaxes/XPath/Samples/Test5.xpath
@@ -0,0 +1 @@
+cd[position()=last()-1]
diff --git a/syntaxes/XPath/Samples/Test6.xpath b/syntaxes/XPath/Samples/Test6.xpath
new file mode 100644
index 0000000..d83d55f
--- /dev/null
+++ b/syntaxes/XPath/Samples/Test6.xpath
@@ -0,0 +1 @@
+/
diff --git a/syntaxes/XPath/Samples/Test7.xpath b/syntaxes/XPath/Samples/Test7.xpath
new file mode 100644
index 0000000..b45b67e
--- /dev/null
+++ b/syntaxes/XPath/Samples/Test7.xpath
@@ -0,0 +1 @@
+/ * / *
diff --git a/syntaxes/XPath/Samples/Test8.xpath b/syntaxes/XPath/Samples/Test8.xpath
new file mode 100644
index 0000000..5f7c77d
--- /dev/null
+++ b/syntaxes/XPath/Samples/Test8.xpath
@@ -0,0 +1 @@
+//
diff --git a/syntaxes/XPath/Samples/Test9.xpath b/syntaxes/XPath/Samples/Test9.xpath
new file mode 100644
index 0000000..9f88b47
--- /dev/null
+++ b/syntaxes/XPath/Samples/Test9.xpath
@@ -0,0 +1 @@
+/ * 5
diff --git a/syntaxes/XPath/Syntax/XPath.tcs b/syntaxes/XPath/Syntax/XPath.tcs
new file mode 100644
index 0000000..5f7ffc4
--- /dev/null
+++ b/syntaxes/XPath/Syntax/XPath.tcs
@@ -0,0 +1,364 @@
+syntax XPath(k = 0) {
+
+ primitiveTemplate identifier for String default using NAME:
+ value = "%token%";
+
+ primitiveTemplate stringSymbol for String using STRING:
+ value = "%token%",
+ serializer="'\'' + %value%.toCString() + '\''";
+
+ primitiveTemplate integerSymbol for Integer default using INT:
+ value = "Integer.valueOf(%token%)";
+
+ primitiveTemplate floatSymbol for Double default using FLOAT:
+ value = "Double.valueOf(%token%)";
+
+-- Expressions
+ template Expression main abstract operatored;
+
+ template VariableExp
+ : "$" name
+ ;
+
+ template PathExpression
+ :
+-- (isAbsolute ? "/")
+-- steps{separator = "/"}
+
+ (isAbsolute ?
+ "/" steps{separator = "/"}
+ :
+ steps{separator = "/", forcedLower = 1}
+ )
+ ;
+
+ template Step(disambiguate = "(step)=>")
+ :
+ [[ axis nodeTest
+ | "." -- {{axis <- new SelfAxis, nodeTest <- new IsNodeTest}} -- self::node()
+ | ".." -- {{axis <- new ParentAxis, nodeTest <- new IsNodeTest}} -- parent::node()
+ ]]
+ predicates
+ ;
+
+ template Predicate
+ : "[" expression "]"
+ ;
+
+ operatorTemplate OperatorCallExp(operators =
+ opUnion
+
+ opMinus1
+
+ opMul opDiv opMod
+
+ opPlus opMinus
+
+ opLT
+ opLE
+ opGT
+ opGE
+
+ opEQ
+ opNE
+
+ opAnd
+
+ opOr,
+ source = 'left', storeOpTo = name, storeRightTo = 'right');
+
+ template FunctionCallExp(disambiguate = "NAME LPAREN")
+ : name "(" arguments{separator = ","} ")"
+ ;
+
+ template LiteralExp abstract;
+
+ template IntegerExp
+ : symbol
+ ;
+
+ template StringExp
+ : symbol{as = stringSymbol}
+ ;
+-- End Expressions
+
+
+-- NodeTests
+ template NodeTest abstract;
+
+ template NameTest
+ : name
+ ;
+
+ template WildCardTest
+ : "*"
+ ;
+
+ template IsNodeTest
+ : "node" "(" ")"
+ ;
+
+ template IsTextTest
+ : "text" "(" ")"
+ ;
+-- End NodeTests
+
+
+-- Axes
+ template Axis abstract;
+
+ template AncestorAxis
+ : "ancestor" "::"
+ ;
+
+ template AncestorOrSelfAxis
+ : "ancestor-or-self" "::"
+ ;
+
+ template AttributeAxis
+ : [[ "attribute" "::"
+ | "@"
+ ]]
+ ;
+
+ template ChildAxis
+ : [[ "child" "::"
+ | -- *nothing* is equivalent to child::
+ ]]
+
+ ;
+
+ template DescendantAxis
+ : "descendant" "::"
+ ;
+
+ template DescendantOrSelfAxis
+ : "descendant-or-self" "::"
+ ;
+
+ template FollowingAxis
+ : "following" "::"
+ ;
+
+ template FollowingSiblingAxis
+ : "following-sibling" "::"
+ ;
+
+ template NamespaceAxis
+ : "namespace" "::"
+ ;
+
+ template ParentAxis
+ : "parent" "::"
+ ;
+
+ template PrecedingAxis
+ : "preceding" "::"
+ ;
+
+ template PrecedingSiblingAxis
+ : "preceding-sibling" "::"
+ ;
+
+ template SelfAxis
+ : "self" "::"
+ ;
+-- End Axes
+
+ symbols {
+ dollar = "$";
+ lsquare = "[";
+ rsquare = "]";
+ lparen = "(";
+ rparen = ")";
+ colons = "::";
+ point = ".";
+ pointpoint = "..";
+ arobas = "@";
+ slash = "/";
+
+ -- operator symbols
+ pipe = "|";
+ minus = "-";
+ star = "*";
+ slashslash = "//";
+ plus = "+";
+ eq = "=";
+ gt = ">";
+ lt = "<";
+ ge = ">=";
+ le = "<=";
+ excleq = "!=";
+ }
+
+ operators {
+ priority 0 {
+ -- opPredicate []
+ }
+
+ priority 1 {
+ -- opChild = slash, 2;
+ -- opDescendant = slashslash, 2;
+ }
+
+ priority 2 {
+ opUnion = pipe, 2;
+ }
+
+ priority 3 {
+ opMinus1 = minus, 1;
+ }
+
+ priority 4 {
+ opMul = star, 2;
+ opDiv = "div", 2;
+ opMod = "mod", 2;
+ }
+
+ priority 5 {
+ opPlus = plus, 2;
+ opMinus = minus, 2;
+ }
+
+ priority 6 {
+ opLT = lt, 2;
+ opLE = le, 2;
+ opGT = gt, 2;
+ opGE = ge, 2;
+ }
+
+ priority 7 {
+ opEQ = eq, 2;
+ opNE = excleq, 2;
+ }
+
+ priority 8 {
+ opAnd = "and", 2;
+ }
+
+ priority 9 {
+ opOr = "or", 2;
+ }
+ }
+
+ token COMMENT : endOfLine(start = "--");
+
+ lexer = "
+%options testLiterals = false;
+NL
+ : ( '\\r' '\\n'
+ | '\\n' '\\r' //Improbable
+ | '\\r'
+ | '\\n'
+ )
+ {newline();}
+ ;
+
+WS
+ : ( ' '
+ | '\\t'
+ )
+ ;
+
+%protected
+DIGIT
+ : '0'..'9'
+ ;
+
+%protected
+ALPHA
+ : 'a'..'z'
+ | 'A'..'Z'
+ | '_'
+ //For Unicode compatibility (from 0000 to 00ff)
+ | '\\u00C0' .. '\\u00D6'
+ | '\\u00D8' .. '\\u00F6'
+ | '\\u00F8' .. '\\u00FF'
+ ;
+
+%protected
+SNAME
+%v2 options {
+%v2 testLiterals = true;
+%v2 }
+ : (ALPHA) (ALPHA | DIGIT)*
+;
+
+NAME
+ : (
+%v3 SNAME
+%v2 s:SNAME {if(s.getType() != SNAME) $setType(s.getType());}
+ | '\"'!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\\"'|'\\n')
+ )*
+ '\"'!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ )
+ ;
+
+INT
+ : (DIGIT)+
+%v2 (('.' DIGIT)=> '.' (DIGIT)+ {$setType(FLOAT);})?
+ ;
+
+%v3 FLOAT : DIGIT+ (('.' DIGIT)=>'.' DIGIT+)? ; // cannot accept DIGIT '.' because it would conflict with Navigation
+
+%protected
+ESC
+ : '\\\\'!
+ ( 'n' %v2{%setText(\"\\n\");}
+ | 'r' %v2{%setText(\"\\r\");}
+ | 't' %v2{%setText(\"\\t\");}
+ | 'b' %v2{%setText(\"\\b\");}
+ | 'f' %v2{%setText(\"\\f\");}
+ | '\"' %v2{%setText(\"\\\"\");}
+ | '\\'' %v2{%setText(\"\\'\");}
+ | '\\\\' %v2{%setText(\"\\\\\");}
+ | (
+ ('0'..'3')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : '0'..'7'
+ )?
+ )?
+ | ('4'..'7')
+ (
+%v2 options {
+%v2 warnWhenFollowAmbig = false;
+%v2 }
+ : ('0'..'7')
+ )?
+ )
+ {
+%v2 String s = %getText;
+%v2 int i;
+%v2 int ret = 0;
+%v2 String ans;
+%v2 for (i=0; i<s.length(); ++i)
+%v2 ret = ret*8 + s.charAt(i) - '0';
+%v2 ans = String.valueOf((char) ret);
+%v2 %setText(ans);
+ }
+ )
+ ;
+
+STRING
+ : '\\''!
+ ( ESC
+ | '\\n' {newline();}
+ | ~('\\\\'|'\\''|'\\n')
+ )*
+ '\\''!
+%v3 {setText(ei.unescapeString(getText(), 1));}
+ ;
+ ";
+}
diff --git a/syntaxes/XPath/build.properties b/syntaxes/XPath/build.properties
new file mode 100644
index 0000000..bb4d032
--- /dev/null
+++ b/syntaxes/XPath/build.properties
@@ -0,0 +1,2 @@
+dsl.name=XPath
+dsl.ext=xpath \ No newline at end of file

Back to the top