├── .gitignore
├── .mvn
├── extensions.xml
├── jvm.config
├── maven.config
└── settings.xml
├── CONTRIBUTING.md
├── Jenkinsfile
├── README.md
├── change_name.sh
├── change_spoofax_version.sh
├── change_to_spoofax_nightly.sh
├── change_to_spoofax_stable.sh
├── change_version.sh
├── change_version_to_stable.sh
├── icedust.eclipse.feature
├── .gitignore
├── build.properties
├── feature.xml
└── pom.xml
├── icedust.eclipse.site
├── .gitignore
├── pom.xml
└── site.xml
├── icedust.eclipse
├── .gitignore
├── META-INF
│ └── MANIFEST.MF
├── build.properties
├── plugin.xml
└── pom.xml
├── icedust.example.webdsl
├── .gitignore
├── .project
├── README.md
└── icedustWebDSL2.ice
├── icedust.example
├── .gitignore
├── .project
├── blog
│ └── blog.ice
├── cms
│ └── cms.ice
├── example.ice
├── graph
│ └── directedgraph.ice
├── icedust
│ └── icedust.ice
├── incometax
│ └── incometax.ice
├── metaborg.yaml
├── neverwinter
│ ├── neverwinter.ice
│ └── neverwinter2.ice
├── objectquery
│ ├── objectquery.ice
│ └── objectquery2.ice
├── pom.xml
├── relationsbetweenrelations
│ └── relationsbetweenrelations.ice
├── scopegraph
│ └── scopegraph.ice
├── ternary
│ └── ternary.ice
└── weblab
│ ├── weblab.ice
│ ├── weblabMicro.ice
│ └── weblabMini.ice
├── icedust.proofs
├── README.md
├── multiplicities.v
└── multiplicities2.v
├── icedust.test
├── .gitignore
├── .mvn
│ └── settings.xml
├── dynamic-semantics
│ ├── java
│ │ ├── features
│ │ │ ├── TODO
│ │ │ │ ├── auto-shortcut
│ │ │ │ │ └── AutoShortcuts.spt
│ │ │ │ ├── expressions-aggregations-recursive
│ │ │ │ │ └── ExpressionsAggregationRecursive.spt
│ │ │ │ ├── expressions-aggregations
│ │ │ │ │ └── ExpressionsAggregation.spt
│ │ │ │ ├── expressions-role-inverses-multiplicities
│ │ │ │ │ └── ExpressionsRolesInversesMultiplicities.spt
│ │ │ │ ├── expressions-roles-inverses
│ │ │ │ │ └── ExpressionsRolesInverses.spt
│ │ │ │ └── expressions-shortcuts
│ │ │ │ │ └── ExpressionsShortcuts.spt
│ │ │ ├── abstractfield
│ │ │ │ └── abstractfield.spt
│ │ │ ├── expressions
│ │ │ │ ├── cast
│ │ │ │ │ └── cast.spt
│ │ │ │ ├── datetime
│ │ │ │ │ └── datetime.spt
│ │ │ │ ├── logic
│ │ │ │ │ └── logic.spt
│ │ │ │ ├── math
│ │ │ │ │ └── math.spt
│ │ │ │ ├── multiplicities
│ │ │ │ │ └── multiplicities.spt
│ │ │ │ ├── nestedIf
│ │ │ │ │ └── nestedIf.spt
│ │ │ │ └── references
│ │ │ │ │ └── references.spt
│ │ │ ├── functions
│ │ │ │ └── functions.spt
│ │ │ ├── inlinefield
│ │ │ │ └── inlinefield.spt
│ │ │ ├── ondemandincremental
│ │ │ │ └── ondemandincremental.spt
│ │ │ └── stringinterpolation
│ │ │ │ └── stringinterpolation.spt
│ │ └── programs
│ │ │ ├── helloworld
│ │ │ └── helloworld.spt
│ │ │ ├── icedust
│ │ │ └── icedust.spt
│ │ │ ├── incometax
│ │ │ └── incometax.spt
│ │ │ └── weblab
│ │ │ ├── weblab.spt
│ │ │ └── weblab2.spt
│ ├── javascript
│ │ ├── features
│ │ │ ├── derived
│ │ │ │ └── calculateMany
│ │ │ │ │ └── calculateMany.spt
│ │ │ ├── expressions
│ │ │ │ ├── cast
│ │ │ │ │ └── cast.spt
│ │ │ │ ├── datetime
│ │ │ │ │ └── datetime.spt
│ │ │ │ ├── elemAt
│ │ │ │ │ └── elemAt.spt
│ │ │ │ ├── find
│ │ │ │ │ └── find.spt
│ │ │ │ ├── first
│ │ │ │ │ └── first.spt
│ │ │ │ ├── indexOf
│ │ │ │ │ └── indexOf.spt
│ │ │ │ ├── logic
│ │ │ │ │ └── logic.spt
│ │ │ │ ├── math
│ │ │ │ │ └── math.spt
│ │ │ │ ├── multiplicities
│ │ │ │ │ └── multiplicities.spt
│ │ │ │ ├── nestedIf
│ │ │ │ │ └── nestedIf.spt
│ │ │ │ ├── orderBy
│ │ │ │ │ └── orderBy.spt
│ │ │ │ └── references
│ │ │ │ │ └── references.spt
│ │ │ ├── filter
│ │ │ │ └── filter.spt
│ │ │ ├── html
│ │ │ │ └── html-target.spt
│ │ │ └── stringinterpolation
│ │ │ │ └── stringinterpolation.spt
│ │ └── programs
│ │ │ ├── helloworld
│ │ │ └── helloworld.spt
│ │ │ ├── incometax
│ │ │ └── incometax.spt
│ │ │ └── weblab
│ │ │ └── weblab.spt
│ └── webdsl
│ │ └── programs
│ │ └── weblab
│ │ └── weblab.spt
├── metaborg.yaml
├── pom.xml
└── static-semantics
│ ├── api
│ ├── attributes.spt
│ ├── entities.spt
│ ├── entityinstances.spt
│ ├── flowsto.spt
│ ├── flowsto2.spt
│ ├── flowsto3.spt
│ ├── flowsto4.spt
│ ├── flowsto5.spt
│ ├── flowsto6.spt
│ ├── flowsto7.spt
│ ├── flowsto8.spt
│ ├── functions.spt
│ ├── inlining.spt
│ ├── membervalues.spt
│ ├── modules.spt
│ ├── relations.spt
│ ├── roleinverse.spt
│ ├── shortcuts.spt
│ └── traits
│ │ ├── entities.spt
│ │ ├── entityparents.spt
│ │ ├── flowsto.spt
│ │ └── memberparents.spt
│ ├── config
│ ├── config-section.spt
│ ├── derived-relations.spt
│ ├── eventual.spt
│ ├── first-class-relations.spt
│ ├── inlines.spt
│ ├── strategies.spt
│ └── subtyping.spt
│ ├── desugar
│ ├── auto-inverses.spt
│ ├── auto-relations.spt
│ └── auto-shortcuts.spt
│ ├── names
│ ├── attributes.spt
│ ├── builtin.spt
│ ├── data.spt
│ ├── entities.spt
│ ├── entityinstances.spt
│ ├── filter.spt
│ ├── functions.spt
│ ├── inlining.spt
│ ├── inverses.spt
│ ├── members.spt
│ ├── roles.spt
│ ├── shortcutrel.spt
│ ├── shortcuts.spt
│ └── traits
│ │ ├── concat.spt
│ │ ├── cycle.spt
│ │ ├── data.spt
│ │ ├── filtertype.spt
│ │ ├── members-multiple.spt
│ │ ├── members-override.spt
│ │ ├── members.spt
│ │ ├── parents-multiple.spt
│ │ └── parents.spt
│ ├── prettyprint
│ └── program1.spt
│ ├── syntax
│ ├── data.spt
│ ├── expressions-disambiguation.spt
│ ├── expressions.spt
│ ├── literals-layout.spt
│ └── model.spt
│ └── types
│ ├── aggregation.spt
│ ├── assignments.spt
│ ├── casts.spt
│ ├── collections.spt
│ ├── data.spt
│ ├── data2.spt
│ ├── derived-relations.spt
│ ├── filter.spt
│ ├── functions.spt
│ ├── literals.spt
│ ├── logic.spt
│ ├── math.spt
│ ├── multiplicity-op-choice.spt
│ ├── multiplicity-op-merge.spt
│ ├── references-attributes-direct.spt
│ ├── references-attributes-indirect.spt
│ ├── references-entities.spt
│ ├── references-relations.spt
│ ├── references-roles-inverses.spt
│ ├── references-shorthands.spt
│ ├── references-this.spt
│ ├── strategy-composition-assignments.spt
│ ├── strategy-composition.spt
│ ├── stringinterpolation.spt
│ └── traits
│ ├── concat.spt
│ └── filtertype.spt
├── icedust
├── .gitignore
├── .mvn
│ ├── extensions.xml
│ ├── jvm.config
│ ├── maven.config
│ └── settings.xml
├── editor
│ ├── Analysis.esv
│ ├── Colorer.esv
│ ├── Main.esv
│ ├── Menus.esv
│ └── Syntax.esv
├── icons
│ ├── arrow-blue.png
│ ├── arrowleft-red.gif
│ ├── arrowleft-red.graffle
│ ├── arrowleftright-red.gif
│ ├── arrowleftright-red.graffle
│ ├── arrowright-red.gif
│ ├── arrowright-red.graffle
│ ├── circle-green.png
│ ├── data.png
│ ├── diamond-yellow.png
│ ├── execute.png
│ ├── icedust-32x32.png
│ ├── icedust-48x48.png
│ ├── icedust-640x640.png
│ ├── icedust-64x64.png
│ ├── icedust.graffle
│ ├── icedust.pdf
│ ├── icedust.png
│ ├── model.png
│ ├── module.png
│ ├── page-arrow-white.png
│ ├── square-gray.png
│ ├── square-red.png
│ └── triangle-blue.png
├── lib-java
│ ├── src
│ │ ├── derivations
│ │ │ └── Settings.java
│ │ └── lib
│ │ │ └── icedust
│ │ │ └── Expressions.java
│ └── test
│ │ └── lib
│ │ └── icedust
│ │ └── ExpressionsTest.java
├── lib-js
│ ├── .gitignore
│ ├── dependencies
│ │ ├── .gitignore
│ │ ├── package.json
│ │ ├── src
│ │ │ └── index.js
│ │ ├── target
│ │ │ └── libraries.generated.js
│ │ ├── webpack.config.js
│ │ └── yarn.lock
│ ├── nashorn.jar
│ └── src
│ │ ├── nashorn-polyfill.js
│ │ ├── require.js
│ │ └── runtime
│ │ ├── constants.js
│ │ ├── expression.js
│ │ ├── lib
│ │ └── functions.js
│ │ ├── loadModule.js
│ │ ├── pixiedust
│ │ ├── components
│ │ │ ├── Lifted.js
│ │ │ ├── PixieDustComponent.js
│ │ │ ├── PixieDustProvider.js
│ │ │ ├── Result.js
│ │ │ └── ResultEntry.js
│ │ ├── index.js
│ │ ├── runner.js
│ │ └── runtime.js
│ │ └── runner.js
├── lib-webdsl
│ ├── javascript
│ │ ├── Expressions.js
│ │ └── javascript-lib.js
│ ├── lib
│ │ └── icedust
│ │ │ ├── Expressions.app
│ │ │ ├── eventually-consistent-ac.app
│ │ │ ├── eventually-consistent.app
│ │ │ ├── modelexplorer-ui.app
│ │ │ └── non-required-inputs.app
│ └── stylesheets
│ │ └── icedust.css
├── lib
│ ├── Stratego-Box.tbl
│ ├── Stratego-Java-15.tbl
│ ├── StrategoJS.tbl
│ ├── StrategoWebDSL.tbl
│ ├── java
│ │ ├── Java-parenthesize.str
│ │ ├── Java.str
│ │ ├── pp
│ │ │ ├── class
│ │ │ │ ├── enum-declaration.meta
│ │ │ │ ├── enum-declaration.str
│ │ │ │ ├── method-declaration.meta
│ │ │ │ └── method-declaration.str
│ │ │ ├── expression.meta
│ │ │ ├── expression.str
│ │ │ ├── helpers.meta
│ │ │ ├── helpers.str
│ │ │ ├── interface
│ │ │ │ ├── annotation-type.meta
│ │ │ │ ├── annotation-type.str
│ │ │ │ ├── annotation.meta
│ │ │ │ └── annotation.str
│ │ │ ├── literal.meta
│ │ │ ├── literal.str
│ │ │ ├── main.meta
│ │ │ ├── main.str
│ │ │ ├── modifier.meta
│ │ │ ├── modifier.str
│ │ │ ├── name.meta
│ │ │ ├── name.str
│ │ │ ├── statement.meta
│ │ │ ├── statement.str
│ │ │ └── type
│ │ │ │ ├── parameterized.meta
│ │ │ │ ├── parameterized.str
│ │ │ │ ├── primitive.meta
│ │ │ │ ├── primitive.str
│ │ │ │ ├── reference.meta
│ │ │ │ ├── reference.str
│ │ │ │ ├── variable.meta
│ │ │ │ └── variable.str
│ │ └── pretty-print.str
│ ├── js
│ │ ├── js-util.meta
│ │ ├── js-util.str
│ │ ├── pp
│ │ │ ├── Assignment-pp.str
│ │ │ ├── Class-pp.str
│ │ │ ├── Common-pp.str
│ │ │ ├── Export-pp.str
│ │ │ ├── Expression-pp.str
│ │ │ ├── Import-pp.str
│ │ │ ├── Lexical-pp.str
│ │ │ ├── Statement-pp.str
│ │ │ ├── javascript-parenthesize.str
│ │ │ └── javascript-pp.str
│ │ └── signatures
│ │ │ ├── Assignment-sig.str
│ │ │ ├── Class-sig.str
│ │ │ ├── Common-sig.str
│ │ │ ├── Export-sig.str
│ │ │ ├── Expression-sig.str
│ │ │ ├── Import-sig.str
│ │ │ ├── Lexical-sig.str
│ │ │ ├── Statement-sig.str
│ │ │ └── javascript-sig.str
│ └── webdsl
│ │ ├── HQL-pretty.pp
│ │ ├── HQL-pretty.pp.af
│ │ ├── WebDSL-parenthesize.str
│ │ ├── WebDSL-pretty.pp
│ │ ├── WebDSL-pretty.pp.af
│ │ ├── WebDSL.str
│ │ ├── constructors.str
│ │ ├── pp-hql.str
│ │ └── pp-webdsl.str
├── metaborg.yaml
├── pom.xml
├── src
│ └── main
│ │ └── strategies
│ │ └── icedust
│ │ └── strategies
│ │ ├── InteropRegisterer.java
│ │ ├── Main.java
│ │ ├── eval_javascript_0_0.java
│ │ ├── graph_topological_sort_1_0.java
│ │ ├── make_module_tree_0_0.java
│ │ ├── nashorn
│ │ ├── MergedWriter.java
│ │ ├── ModuleEntry.java
│ │ ├── ModuleScope.java
│ │ ├── ModuleTree.java
│ │ ├── ModuleTreeBuilder.java
│ │ ├── ModuleTreeWriter.java
│ │ └── NashornInitializer.java
│ │ ├── open_browser_0_0.java
│ │ └── read_resource_0_0.java
├── syntax
│ ├── Common.sdf3
│ ├── Config.sdf3
│ ├── Data.sdf3
│ ├── Execute.sdf3
│ ├── Expressions.sdf3
│ ├── Functions.sdf3
│ ├── Model.sdf3
│ ├── Modules.sdf3
│ ├── Types.sdf3
│ ├── _PrettyPrint.sdf3
│ └── icedust.sdf3
└── trans
│ ├── analysis
│ ├── _constructors.str
│ ├── config.nabl2
│ ├── data.nabl2
│ ├── expressions-casts.nabl2
│ ├── expressions-collections.nabl2
│ ├── expressions-functions.nabl2
│ ├── expressions-literals.nabl2
│ ├── expressions-logic.nabl2
│ ├── expressions-math.nabl2
│ ├── expressions-multiplicity-operators.nabl2
│ ├── expressions-references.nabl2
│ ├── functions2.nabl2
│ ├── map3.nabl2
│ ├── model.nabl2
│ ├── module.nabl2
│ ├── static-semantics.nabl2
│ └── types.nabl2
│ ├── analysis2
│ ├── analyse-post-analysis.str
│ ├── analysis2.str
│ ├── check.str
│ ├── config.str
│ ├── constructors.str
│ └── path.str
│ ├── api
│ ├── _generated.str
│ ├── _runtime-constructors.str
│ ├── _runtime.str
│ ├── api-test.str
│ ├── config-api.str
│ ├── data-api.str
│ ├── data-names-api.str
│ ├── expressions-api.str
│ ├── expressions-names-api.str
│ ├── functions-api.str
│ ├── functions-names-api.str
│ ├── model-api.str
│ ├── model-names-api.str
│ ├── module-api.str
│ ├── module-names-api.str
│ ├── types-api.str
│ └── types-names-api.str
│ ├── desugaring
│ ├── alternatives.str
│ ├── desugar.str
│ └── omitted.str
│ ├── editor
│ ├── analysis.str
│ ├── build.str
│ ├── builders.str
│ ├── completion.str
│ ├── outline.str
│ ├── pp.str
│ └── services.str
│ ├── generating
│ ├── _ir
│ │ ├── constructors.str
│ │ ├── expressions.str
│ │ ├── model.str
│ │ └── paths.str
│ ├── java.str
│ ├── java
│ │ ├── data.meta
│ │ ├── data.str
│ │ ├── execute.meta
│ │ ├── execute.str
│ │ ├── expressions-references.meta
│ │ ├── expressions-references.str
│ │ ├── expressions.meta
│ │ ├── expressions.str
│ │ ├── functions.meta
│ │ ├── functions.str
│ │ ├── generate.str
│ │ ├── model-runtime-layers.graffle
│ │ ├── model.meta
│ │ ├── model.str
│ │ ├── module.meta
│ │ ├── module.str
│ │ ├── types.meta
│ │ └── types.str
│ ├── js
│ │ ├── access.meta
│ │ ├── access.str
│ │ ├── build.str
│ │ ├── calculate.meta
│ │ ├── calculate.str
│ │ ├── common.meta
│ │ ├── common.str
│ │ ├── data.meta
│ │ ├── data.str
│ │ ├── execute.meta
│ │ ├── execute.str
│ │ ├── expression.meta
│ │ ├── expression.str
│ │ ├── generate.meta
│ │ ├── generate.str
│ │ ├── getter.meta
│ │ ├── getter.str
│ │ ├── init.meta
│ │ ├── init.str
│ │ ├── invalidation.meta
│ │ ├── invalidation.str
│ │ ├── model.meta
│ │ ├── model.str
│ │ ├── names.meta
│ │ ├── names.str
│ │ ├── reducer.meta
│ │ ├── reducer.str
│ │ ├── runner.meta
│ │ ├── runner.str
│ │ ├── setter.meta
│ │ └── setter.str
│ ├── webdsl.str
│ └── webdsl
│ │ ├── data.meta
│ │ ├── data.str
│ │ ├── expressions-references.meta
│ │ ├── expressions-references.str
│ │ ├── expressions.meta
│ │ ├── expressions.str
│ │ ├── functions.meta
│ │ ├── functions.str
│ │ ├── generate.str
│ │ ├── java
│ │ ├── generate.str
│ │ ├── module.meta
│ │ └── module.str
│ │ ├── js
│ │ ├── expressions.meta
│ │ ├── expressions.str
│ │ ├── generate.str
│ │ ├── js-helper.str
│ │ ├── module.meta
│ │ └── module.str
│ │ ├── model-runtime-layers.graffle
│ │ ├── model.meta
│ │ ├── model.str
│ │ ├── module-derivations.meta
│ │ ├── module-derivations.str
│ │ ├── module-manage.meta
│ │ ├── module-manage.str
│ │ ├── module-ui.meta
│ │ ├── module-ui.str
│ │ ├── module.meta
│ │ ├── module.str
│ │ ├── types.meta
│ │ ├── types.str
│ │ └── webdsl-helper.str
│ ├── icedust.str
│ ├── lib
│ ├── annotations.str
│ ├── call-external.str
│ ├── debug.str
│ ├── eq.str
│ ├── files.str
│ ├── graph.str
│ ├── index.str
│ ├── intlist.str
│ ├── lists-tuples.str
│ ├── nabl2.str
│ ├── new-name.str
│ ├── option.str
│ ├── origin.str
│ ├── search.str
│ ├── string.str
│ ├── time.str
│ └── traverse.str
│ ├── prettyprinting
│ ├── pp.str
│ └── variations.str
│ └── tiersplit
│ ├── constructors.str
│ └── intra-object.str
├── language-extension.md
└── pom.xml
/.gitignore:
--------------------------------------------------------------------------------
1 | bin
2 | .cache
3 | include/Relations.def
4 | include/Relations-parenthesize.str
5 | include/Relations-Permissive.def
6 | include/Relations.generated.pp.af
7 | include/Relations.packed.esv
8 | include/Relations.pp.af
9 | include/Relations.rtg
10 | include/Relations.str
11 | include/Relations.tbl
12 | include/relations.rtree
13 | include/relations.ctree
14 | include/relations.ctree.dep
15 | include/relations.jar
16 | include/relations-java.jar
17 | editor/java/trans
18 | editor/*.generated.*
19 | syntax/Relations*.generated.esv
20 | syntax/Relations.generated.pp
21 | trans/*.pp.generated.str
22 | trans/types.generated.str
23 | trans/*/types.generated.str
24 | trans/names.str
25 | trans/*/names.str
26 | .settings/org.eclipse.jdt.core.prefs
27 | lib/runtime
28 | lib/analysis
29 | lib/editor
30 | lib/index
31 | lib/nabl
32 | lib/properties
33 | lib/relations
34 | lib/task
35 | lib/tmpl
36 | lib/types
37 | lib/*.generated.str
38 | lib-refactoring/*.generated.str
39 | *.aterm
40 | */*.aterm
41 | */*/*.aterm
42 | */*/*/*.aterm
43 | */*/*/*/*.aterm
44 | syntax/*.sdf
45 | /include
46 | update/target
47 | relations-eclipse-plugin/target
48 |
--------------------------------------------------------------------------------
/.mvn/extensions.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | org.metaborg
5 | spoofax-maven-plugin-pomless
6 | 2.4.0
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.mvn/jvm.config:
--------------------------------------------------------------------------------
1 | -Xmx2G -Xss16m
2 |
--------------------------------------------------------------------------------
/.mvn/maven.config:
--------------------------------------------------------------------------------
1 | --global-settings .mvn/settings.xml
2 |
--------------------------------------------------------------------------------
/change_name.sh:
--------------------------------------------------------------------------------
1 | FROMNAME=icedust2
2 | TONAME=icedust
3 | FROMEXTENSION=ice2
4 | TOEXTENSION=ice
5 |
6 | # change name
7 | grep -rEl --exclude=*/target/* --exclude=*/src-gen/* --exclude=*change_name.sh* --exclude=*_subtyping.ts* --exclude=*_runtime.str* "${FROMNAME}" * | xargs sed -i "" "s/${FROMNAME}/${TONAME}/g"
8 | find . -depth -name "*${FROMNAME}*" -execdir sh -c "mv {} \$(echo {} | sed \"s/${FROMNAME}/${TONAME}/\")" \;
9 |
10 | # change extension
11 | grep -rEl --exclude=*/target/* --exclude=*/src-gen/* --exclude=*change_name.sh* --exclude=*_subtyping.ts* --exclude=*_runtime.str* "extensions : ${FROMEXTENSION}" * | xargs sed -i "" "s/extensions : ${FROMEXTENSION}/extensions : ${TOEXTENSION}/g"
12 | find . -depth -name "*.${FROMEXTENSION}*" -execdir sh -c "mv {} \$(echo {} | sed \"s/.${FROMEXTENSION}/.${TOEXTENSION}/\")" \;
13 |
--------------------------------------------------------------------------------
/change_spoofax_version.sh:
--------------------------------------------------------------------------------
1 | FROMVERSION=2.3.0
2 | TOVERSION=2.4.0
3 |
4 | grep -rEl --exclude=*/target/* --exclude=*/src-gen/* --include=*.{yaml,xml,MF} "${FROMVERSION}" . | xargs sed -i "" "s/${FROMVERSION}/${TOVERSION}/g"
5 |
--------------------------------------------------------------------------------
/change_to_spoofax_nightly.sh:
--------------------------------------------------------------------------------
1 | grep -rEl --exclude=*/target/* --exclude=*/src-gen/* --include=*.{yaml,xml} "http://artifacts.metaborg.org/content/unzip/releases-unzipped/org/metaborg/org.metaborg.spoofax.eclipse.updatesite/2.2.0/org.metaborg.spoofax.eclipse.updatesite-2.2.0-assembly.zip-unzip/" search . | xargs sed -i "" "s_http://artifacts.metaborg.org/content/unzip/releases-unzipped/org/metaborg/org.metaborg.spoofax.eclipse.updatesite/2.2.0/org.metaborg.spoofax.eclipse.updatesite-2.2.0-assembly.zip-unzip/_http://buildfarm.metaborg.org/job/metaborg/job/spoofax-releng/job/master/lastSuccessfulBuild/artifact/dist/spoofax/eclipse/site/_g"
2 | grep -rEl --exclude=*/target/* --exclude=*/src-gen/* --include=*.{yaml,xml} "2.2.0" search . | xargs sed -i "" "s/2.2.0/2.3.0-SNAPSHOT/g"
--------------------------------------------------------------------------------
/change_to_spoofax_stable.sh:
--------------------------------------------------------------------------------
1 | grep -rEl --exclude=*/target/* --exclude=*/src-gen/* --include=*.{yaml,xml} "http://buildfarm.metaborg.org/job/metaborg/job/spoofax-releng/job/master/lastSuccessfulBuild/artifact/dist/spoofax/eclipse/site/" search . | xargs sed -i "" "s_http://buildfarm.metaborg.org/job/metaborg/job/spoofax-releng/job/master/lastSuccessfulBuild/artifact/dist/spoofax/eclipse/site/_http://artifacts.metaborg.org/content/unzip/releases-unzipped/org/metaborg/org.metaborg.spoofax.eclipse.updatesite/2.3.0/org.metaborg.spoofax.eclipse.updatesite-2.3.0-assembly.zip-unzip/_g"
2 | grep -rEl --exclude=*/target/* --exclude=*/src-gen/* --include=*.{yaml,xml} "2.3.0-SNAPSHOT" search . | xargs sed -i "" "s_2.3.0-SNAPSHOT_2.3.0_g"
--------------------------------------------------------------------------------
/change_version.sh:
--------------------------------------------------------------------------------
1 | FROMVERSION=0.8.3
2 | TOVERSION=1.0.1
3 |
4 | grep -rEl --exclude=*/target/* --exclude=*/src-gen/* --include=*.{yaml,xml,MF} "${FROMVERSION}(.qualifier|-SNAPSHOT)" * | xargs sed -i "" "s/${FROMVERSION}/${TOVERSION}/g"
5 |
--------------------------------------------------------------------------------
/change_version_to_stable.sh:
--------------------------------------------------------------------------------
1 | FROMVERSION=0.8.3
2 | TOVERSION=1.0.0
3 |
4 | grep -rEl --exclude=*/target/* --exclude=*/src-gen/* --include=*.{yaml,xml,MF} "${FROMVERSION}.qualifier" * | xargs sed -i "" "s/${FROMVERSION}.qualifier/${TOVERSION}/g"
5 | grep -rEl --exclude=*/target/* --exclude=*/src-gen/* --include=*.{yaml,xml,MF} "${FROMVERSION}-SNAPSHOT" * | xargs sed -i "" "s/${FROMVERSION}-SNAPSHOT/${TOVERSION}/g"
6 |
--------------------------------------------------------------------------------
/icedust.eclipse.feature/.gitignore:
--------------------------------------------------------------------------------
1 | /.project
2 | /.settings
3 | /target
4 |
--------------------------------------------------------------------------------
/icedust.eclipse.feature/build.properties:
--------------------------------------------------------------------------------
1 | bin.includes = feature.xml
2 |
--------------------------------------------------------------------------------
/icedust.eclipse.feature/feature.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/icedust.eclipse.site/.gitignore:
--------------------------------------------------------------------------------
1 | /.project
2 | /.settings
3 | /target
4 | /content.jar
5 | /artifacts.jar
6 | /features
7 | /plugins
8 |
--------------------------------------------------------------------------------
/icedust.eclipse.site/site.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | icedust language Eclipse plugin.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/icedust.eclipse/.gitignore:
--------------------------------------------------------------------------------
1 | /.classpath
2 | /.project
3 | /.settings
4 | /target
5 |
--------------------------------------------------------------------------------
/icedust.eclipse/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Bundle-ManifestVersion: 2
3 | Bundle-Name: icedust language Eclipse plugin
4 | Bundle-SymbolicName: icedust.eclipse;singleton:=true
5 | Bundle-Version: 1.0.1.qualifier
6 | Bundle-Vendor: org.metaborg.lang
7 | Bundle-ActivationPolicy: lazy
8 | Require-Bundle: org.metaborg.spoofax.eclipse
9 | Bundle-RequiredExecutionEnvironment: JavaSE-1.7
10 |
--------------------------------------------------------------------------------
/icedust.eclipse/build.properties:
--------------------------------------------------------------------------------
1 | bin.includes = plugin.xml, META-INF/, target/unpacked/
2 |
--------------------------------------------------------------------------------
/icedust.eclipse/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/icedust.example.webdsl/.gitignore:
--------------------------------------------------------------------------------
1 | bin
2 | nativejava
3 | .servletapp
4 | lib
5 | stylesheets
6 | WebContent
7 | icedustWebDSL2.app
8 | .settings/
9 | .webdsl-parsecache
10 | .dependencies.webdsl
11 | build.xml
12 | clean-project.xml
13 | icedustWebDSL2 build.xml.launch
14 | icedustWebDSL2 clean-project.xml.launch
15 | .classpath
16 | application.ini
17 | .saved-but-not-built
18 | javascript/*
19 | javascript
20 | .webdsl-fragment-cache
21 | *.dependson.txt
22 | *.flowsto.txt
--------------------------------------------------------------------------------
/icedust.example.webdsl/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | icedustWebDSL2
4 |
5 |
6 | org.eclipse.ui.externaltools.ExternalToolBuilder
7 | full,incremental,
8 |
9 | LaunchConfigHandle
10 | <project>/icedustWebDSL build.xml.launch
11 |
12 |
13 |
14 | org.eclipse.jdt.core.javabuilder
15 |
16 | webdsl.editor.builder
17 |
18 | org.eclipse.ui.externaltools.ExternalToolBuilder
19 | clean,
20 |
21 | LaunchConfigHandle
22 | <project>/.settings/icedustWebDSL clean-project.xml.launch
23 |
24 |
25 |
26 |
27 | org.eclipse.jdt.core.javanature
28 | org.eclipse.wst.common.project.facet.core.nature
29 | org.eclipse.wst.common.modulecore.ModuleCoreNature
30 | org.eclipse.jem.workbench.JavaEMFNature
31 |
32 |
33 |
--------------------------------------------------------------------------------
/icedust.example.webdsl/README.md:
--------------------------------------------------------------------------------
1 | After import run `Convert to a WebDSL project`
--------------------------------------------------------------------------------
/icedust.example/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /.classpath
3 | /.settings
4 | *.analysis.txt
5 | *.java
6 | *.class
7 | *.flowsto.txt
8 | *.dependson.txt
9 | *.class
10 | *.js
11 | *.java
12 | scratchpad.ice2
13 |
--------------------------------------------------------------------------------
/icedust.example/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | icedust.example
4 |
5 |
6 |
7 |
8 |
9 | org.metaborg.spoofax.eclipse.builder
10 |
11 |
12 |
13 |
14 | org.eclipse.m2e.core.maven2Builder
15 |
16 |
17 |
18 |
19 |
20 | org.metaborg.spoofax.eclipse.nature
21 | org.eclipse.m2e.core.maven2Nature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/icedust.example/blog/blog.ice:
--------------------------------------------------------------------------------
1 | module blog // >>> Solving constraints <<< Finished in 2.11s
2 |
3 | model
4 |
5 | entity User {
6 | name : String = "my name"
7 | }
8 |
9 | entity Post {
10 | title : String
11 | body : String = title (default)
12 | }
13 |
14 | relation Post.author 1 <-> * User.posts
15 |
16 | data
17 |
18 | me : User {
19 | posts =
20 | p1 {title = "First post"},
21 | p2 {title = "Second post" body = "Some text"}
22 | }
23 |
24 | execute
25 |
26 | me.posts // give Posts that are authored by me
27 |
28 | me.posts.title // my blogpost titles
29 |
--------------------------------------------------------------------------------
/icedust.example/cms/cms.ice:
--------------------------------------------------------------------------------
1 | module cms
2 |
3 | model
4 |
5 | trait File {
6 | }
7 |
8 | entity Image {
9 | path : String
10 | inUse : Boolean = count(usedBy)>0
11 | usedByNames : String = concat(usedBy.name)
12 | display : String = "
"
13 | }
14 |
15 | trait HasImage {
16 | name : String
17 | }
18 |
19 | relation HasImage.image ? <-> * Image.usedBy
20 |
21 | entity Page extends HasImage, Displayable {
22 | title : String
23 | body : String
24 | display : String = menu + breadcrumbs + "
" + title + "
" + body + (image.display<+"") + "Authors: " + concat(editedBy.name)
25 | url : String = title
26 | name : String = title
27 | }
28 |
29 | entity Profile extends Displayable{
30 | name : String = user.name
31 | bio : String
32 | display : String = menu + breadcrumbs + "" + name + "
" + "bio:" + bio + (user.image.display<+"")
33 | url : String = "profile/"+name
34 | }
35 |
36 | trait Displayable {
37 | display : String
38 | url : String
39 | label : String
40 | link : String = "" + label + ""
41 | breadcrumbs : String = parent.breadcrumbs + " > " + parent.link <+ ""
42 | menu : String = concat(children.link)
43 | }
44 |
45 | relation Displayable.children * <-> ? Displayable.parent
46 |
47 | entity User extends HasImage {
48 | name : String
49 | }
50 |
51 | relation User ? <-> 1 Profile
52 |
53 | relation User * <-> * Page.editedBy
54 |
--------------------------------------------------------------------------------
/icedust.example/example.ice:
--------------------------------------------------------------------------------
1 | module test
2 | model
3 | entity Node{}
4 | // relation Node.maybe ? <-> 1 Node.one {}
5 | // relation Node.star * <-> + Node.plus {}
6 | relation NodeMaybeRelation {
7 | Node.maybeRelation ? -> one
8 | Node.oneRelation 1 -> maybe
9 | maybe.one <-> one.maybe
10 | }
11 |
12 | relation NodeStarRelation {
13 | Node.starRelation * -> plus
14 | Node.plusRelation + (ordered) -> star
15 | star.plus <-> plus.star
16 | }
17 | data
18 | n : Node {
19 | maybe = n
20 | star = n
21 | }
22 | execute
23 | 3
24 | n.maybeRelation.maybe
--------------------------------------------------------------------------------
/icedust.example/graph/directedgraph.ice:
--------------------------------------------------------------------------------
1 | module directedgraph // >>> Solving constraints <<< Finished in 6.41s
2 |
3 | //model
4 | //
5 | // entity Node {
6 | // name : String
7 | // }
8 | //
9 | // relation Node.from <-> Node.to //{} //TODO: get NaBL2 desugaring bug fixed
10 | //
11 | //data
12 | //
13 | // // cyclic graph: a -> b -> c -> a
14 | //
15 | // a : Node {
16 | // name = "a"
17 | // to = b {
18 | // name = "b"
19 | // to = c {
20 | // name = "c"
21 | // to = a
22 | // }
23 | // }
24 | // }
25 | //
26 | //execute
27 | //
28 | // a.name
29 | // b.name
30 | // c.name
31 | // a.to.name //must be [b]
32 | // a.from.name //must be [c]
33 | // a.to.to.name //must be [c]
34 | // a.to.to.to.name //must be [a]
35 |
--------------------------------------------------------------------------------
/icedust.example/metaborg.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | dependencies:
3 | compile:
4 | - org.metaborg.lang:icedust:1.0.1-SNAPSHOT
5 |
--------------------------------------------------------------------------------
/icedust.example/objectquery/objectquery.ice:
--------------------------------------------------------------------------------
1 | module objectquery
2 |
3 | // model taken from Demand-Driven Incremental Object Queries - PPDP 2016
4 |
5 | model
6 |
7 | entity Celeb {
8 |
9 | }
10 |
11 | entity User {
12 | loc : String
13 | email : String
14 | }
15 |
16 | relation Celeb.followers * <-> * User.celebs
17 |
18 | entity Group {
19 |
20 | }
21 |
22 | relation User.groups * <-> * Group.members
23 |
24 | entity Demand {
25 | cond : String // equality check
26 | result : String* = users.email
27 | }
28 |
29 | relation Demand.celeb 1 <-> * Celeb.demands
30 |
31 | relation Demand.group 1 <-> * Group.demands
32 |
33 | relation Demand.users * = group.members.filter(u => u.loc == cond).filter(u => u.celebs.filter(c => c == celeb).count()>0) // schedule: first join group users, then check whether celeb
34 | <-> * User.demandResults
35 |
36 | // comparison with IncOQ
37 | //
38 | // update triggers:
39 | // User.loc -> groups.demands.users (which is exactly the first nested for loops in running example in paper - but IceDust re-evalutes full expression instead of modifies cache with deltas)
40 | //
41 | // the re-evaluation of the users field triggers:
42 | // User.loc -> groups.demands.members.filter(...).filter(u => u.groups.filter(g => g == group)) (which is the remainder of nested for loops. Though IceDust looks at all members of the demand rather than only the changed member. IncOQ only accesses the single changed member.)
43 |
--------------------------------------------------------------------------------
/icedust.example/relationsbetweenrelations/relationsbetweenrelations.ice:
--------------------------------------------------------------------------------
1 | module relationsbetweenrelations // >>> Solving constraints <<< Finished in 18.84s
2 |
3 | //model
4 | //
5 | // entity Person {
6 | // name : String
7 | // }
8 | //
9 | // relation Marriage {
10 | // Person.marriage ? -> husband
11 | // Person.marriage2 ? -> wife
12 | //
13 | // name : String = husband.name + " is married to " + wife.name
14 | // }
15 | //
16 | // relation Counseling {
17 | // Person * -> counselor
18 | // Marriage 1 -> counselled
19 | //
20 | // name : String = counselor.name + " is counseling " + counselled.husband.name + " and " + counselled.wife.name
21 | // }
22 | //
23 | //data
24 | //
25 | // man : Person {
26 | // name = "Bob"
27 | // wife =
28 | // < theMarriage { } >
29 | // woman {
30 | // name = "Alice"
31 | // }
32 | // }
33 | // counsellor : Person {
34 | // name = "Charles"
35 | // counselled = theMarriage
36 | // }
37 | //
38 | //execute
39 | //
40 | // man.marriage.name // get the marriage
41 | //
42 | // man.marriage.wife.name // get his wife
43 | //
44 | // man.marriage.counseling.name // go from the man to his marriage to the counseling of this marriage
45 | //
46 | // man.marriage.counseling.counselor.name // and then get the counselor of this marriage
47 |
--------------------------------------------------------------------------------
/icedust.example/ternary/ternary.ice:
--------------------------------------------------------------------------------
1 | module ternary // >>> Solving constraints <<< Finished in 14.12s
2 |
3 | //model
4 | //
5 | // entity Supplier {
6 | // name : String
7 | // }
8 | //
9 | // entity Part {
10 | // name : String
11 | // nameMany : String = name + "s" (default) // not all names are +s for multiple
12 | // }
13 | //
14 | // entity Project {
15 | // name : String
16 | // }
17 | //
18 | // relation Supply {
19 | // Supplier *
20 | // Part *
21 | // Project *
22 | // amount : Int
23 | //
24 | // name : String = supplier.name + " supplies " + amount as String + " " + part.nameMany + " to " + project.name
25 | // }
26 | //
27 | //data
28 | //
29 | // s : Supplier {
30 | // name = "MySupplier"
31 | // }
32 | //
33 | // p : Part {
34 | // name = "SomePart"
35 | // }
36 | //
37 | // pr : Project {
38 | // name = "AwesomeProject"
39 | // }
40 | //
41 | // x : Supply {
42 | // supplier = s
43 | // part = p
44 | // project = pr
45 | // amount = 10
46 | // }
47 | //
48 | // y : Supply {
49 | // supplier = s
50 | // part = p
51 | // project = pr
52 | // amount = 42
53 | // }
54 | //
55 | //execute
56 | //
57 | // p.supply.name // this part participates in two supply relations
58 | //
59 | // p.supply.amount // and these two have both an amount
60 | //
61 | // p.supply.supplier.name // this part is supplied two times, but both by the same supplier -> 1 supplier, set based navigation
62 | //
63 | // p.supply.project.name // and to the same project -> 2 x project, bag based navigation
64 |
--------------------------------------------------------------------------------
/icedust.test/.gitignore:
--------------------------------------------------------------------------------
1 | src-gen
2 | target
3 | /.classpath
4 | /.project
5 | /.settings
6 | **/nativejava
7 | **/stylesheets
8 | **/.saved-but-not-built
9 | **/*.class
10 | **/*.java
11 | **/lib
12 | /*/*/*.class
13 | /*/*/*.java
14 | /*/*/lib
15 | **/.saved-but-not-built
16 | **/common_.css
17 | /*/*/*/*/javascript
18 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/java/features/TODO/auto-shortcut/AutoShortcuts.spt:
--------------------------------------------------------------------------------
1 | module generate-auto-shortcuts
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module AutoShortcuts (on-demand)
7 |
8 | model
9 | entity Node{
10 | value : Int ? = avg( this.child.value ) (default)
11 | }
12 | relation Tree{
13 | Node.tree_as_parent * -> parent
14 | Node.tree_as_child ? -> child
15 | }
16 |
17 | data
18 | n3 : Node {
19 | child =
20 | n1 : Node {value=2},
21 | n2 : Node {value=4}
22 | }
23 |
24 | execute
25 | n3.value
26 | [[...]]
27 | ]]
28 |
29 | //test Expressions Auto Shortcuts execute-java [[ ]] transform "SPT -> Build" to //FIXME: fix analysis
30 | //"3
31 | //"
32 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/java/features/TODO/expressions-aggregations-recursive/ExpressionsAggregationRecursive.spt:
--------------------------------------------------------------------------------
1 | module generate-expressions-aggregation-recursive
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module ExpressionsAggregationRecursive (on-demand)
7 |
8 | model
9 |
10 | entity Node {
11 | value : Int ? = avg ( this.children.value ) (default)
12 | }
13 |
14 | relation Node.parent ? <-> * Node.children {}
15 |
16 |
17 | data
18 |
19 | root : Node {
20 | children =
21 | n1 : Node {value=2},
22 | n2 : Node {value=4}
23 | }
24 |
25 | execute
26 |
27 | root.value
28 | [[...]]
29 | ]]
30 |
31 | //test Expressions Aggregation Recursive execute-java [[ ]] transform "SPT -> Build" to //FIXME: analysis fails
32 | //"5
33 | //"
34 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/java/features/TODO/expressions-aggregations/ExpressionsAggregation.spt:
--------------------------------------------------------------------------------
1 | module generate-expressions-aggregation
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module ExpressionsAggregation (on-demand)
7 |
8 | model
9 | entity X {
10 | noVal : Boolean?
11 | val : Int = if(!disj(noVal++noVal)and conj(noVal++noVal)) //disj(no value)=false, conj(no value)=true
12 | max( 2 ++ 5 ++ 3)
13 | else
14 | 1
15 | }
16 |
17 | data
18 | x : X{}
19 |
20 | execute
21 | x.val
22 | [[...]]
23 | ]]
24 |
25 | //test Expressions Aggregation execute-java [[ ]] transform "SPT -> Build" to //FIXME: code generator fails
26 | //"5
27 | //"
28 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/java/features/TODO/expressions-role-inverses-multiplicities/ExpressionsRolesInversesMultiplicities.spt:
--------------------------------------------------------------------------------
1 | module generate-expressions-roles-inverse-multiplicities
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module ExpressionsRolesInversesMultiplicities (on-demand)
7 |
8 | config
9 |
10 | backend : Java
11 | phase : generate
12 | language features : first-class relations
13 |
14 | model
15 | entity Node{
16 | a : Int = 1
17 | }
18 | relation Tree{
19 | Node.parentTree * -> parent
20 | Node.childTree ? -> child
21 | }
22 |
23 | data
24 | n1 : Node {}
25 | n2 : Node { parent = n1 }
26 |
27 |
28 | execute
29 | [[...]]
30 | ]]
31 |
32 | //test Expressions Roles Inverses Multiplicities generate-java 1 in single [[ n2.childTree.parent . a ]] transform "SPT -> Build"
33 | //test Expressions Roles Inverses Multiplicities compile-java 1 in single [[ n2.childTree.parent . a ]] transform "SPT -> to Java -> Compile" //FIXME: fix generated code
34 | //test Expressions Roles Inverses Multiplicities execute-java 1 in single [[ n2.childTree.parent . a ]] transform "SPT -> Build" to //FIXME: fix generated code
35 | //"1
36 | //"
37 |
38 | //test Expressions Roles Inverses Multiplicities execute-java 0 in single [[ n1.childTree.parent . a ]] transform "SPT -> Build" to //FIXME: fix generated code
39 | //"null
40 | //"
41 |
42 | //test Expressions Roles Inverses Multiplicities execute-java 1 in many [[ n1.parentTree.child . a ]] transform "SPT -> Build" to //FIXME: fix generated code
43 | //"[1]
44 | //"
45 |
46 | //test Expressions Roles Inverses Multiplicities execute-java 0 in many [[ n2.parentTree.child . a ]] transform "SPT -> Build" to //FIXME: fix generated code
47 | //"[]
48 | //"
49 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/java/features/TODO/expressions-roles-inverses/ExpressionsRolesInverses.spt:
--------------------------------------------------------------------------------
1 | module generate-expressions-roles-inverses
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module ExpressionsRolesInverses
7 |
8 | model
9 |
10 | entity Person {
11 | name : String
12 | }
13 |
14 | relation Marriage {
15 | Person.marriage ? -> husband
16 | Person.marriage2 ? -> wife
17 | }
18 |
19 | relation Counseling {
20 | Person * -> counselor
21 | Marriage 1 -> counselled
22 | }
23 |
24 | data
25 |
26 | man : Person {
27 | name = "Bob"
28 | wife =
29 | < theMarriage { } >
30 | woman {
31 | name = "Alice"
32 | }
33 | }
34 | counsellor : Person {
35 | name = "Charles"
36 | counselled = theMarriage
37 | }
38 |
39 | execute
40 |
41 |
42 | man.marriage.counseling.counselor.name // and then get the counselor of this marriage
43 | [[...]]
44 | ]]
45 |
46 | //test Expressions Roles Inverses execute-java [[ ]] transform "SPT -> Build" to //FIXME: fix generated code
47 | //"Charles
48 | //"
49 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/java/features/TODO/expressions-shortcuts/ExpressionsShortcuts.spt:
--------------------------------------------------------------------------------
1 | module generate-expressions-shortcuts
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module ExpressionsShortcuts
7 |
8 | model
9 | entity Node{
10 | value : Int ? = avg( this.children.value ) (default)
11 | }
12 | relation Tree{
13 | Node.parentTree * -> parent
14 | Node.childTree ? -> child
15 |
16 | child.parent <-> parent.children
17 | }
18 |
19 | data
20 | n3 : Node {
21 | children =
22 | n1 : Node {value=2},
23 | n2 : Node {value=4}
24 | }
25 |
26 | execute
27 | n3.value
28 | [[...]]
29 | ]]
30 |
31 | //test Expressions Shortcuts execute-java [[ ]] transform "SPT -> Build" to //FIXME: fix analysis
32 | //"3
33 | //"
34 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/java/features/abstractfield/abstractfield.spt:
--------------------------------------------------------------------------------
1 | module java-feature-abstractfield
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module abstractfield [[...]]
7 |
8 | config
9 | backend: Java
10 |
11 | model
12 |
13 | entity Submission {
14 | grade : Float? (abstract)
15 | }
16 |
17 | entity CollectionSubmission extends Submission{
18 | grade : Float? = avg(children.grade)
19 | }
20 |
21 | entity LeafSubmission extends Submission{
22 | grade : Float?
23 | }
24 |
25 | relation CollectionSubmission.children * <-> ? Submission.parent
26 |
27 | data
28 |
29 | mathAlice:CollectionSubmission{
30 | children =
31 | labAlice:CollectionSubmission{
32 | children =
33 | lab1Alice:LeafSubmission{
34 | grade = 7.0
35 | },
36 | lab2Alice:LeafSubmission{
37 | grade = 9.0
38 | }
39 | },
40 | examAlice:LeafSubmission{
41 | grade = 9.0
42 | }
43 | }
44 |
45 | execute
46 |
47 | mathAlice.grade
48 | ]]
49 |
50 | test Traits abstract field execute-java on-demand [[ (on-demand) ]] transform "SPT -> Build" to
51 | "8.5
52 | "
53 |
54 | test Traits abstract field execute-java incremental [[ (incremental) ]] transform "SPT -> Build" to
55 | "Updating CollectionSubmission.grade: 2
56 | Updating CollectionSubmission.grade: 1
57 | 8.5
58 | "
59 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/java/features/expressions/cast/cast.spt:
--------------------------------------------------------------------------------
1 | module java-features-expressions-cast
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module cast (on-demand)
7 |
8 | config
9 | backend: Java
10 |
11 | execute
12 | concat(5.0 as String + " " + true as String + " " + 5 as String ++ no value as String)
13 | [[...]]
14 | ]]
15 |
16 | test cast [[ ]] transform "SPT -> Build" to
17 | "5.0 true 5
18 | "
19 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/java/features/expressions/datetime/datetime.spt:
--------------------------------------------------------------------------------
1 | module java-features-expressions-datetime
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module datetime
7 |
8 | config
9 | backend: Java
10 |
11 | execute
12 |
13 | (2015-1-1 0:00:00 - 2014-12-31 0:00:00) /. 3600
14 | 2017-03-05 10:00:00 - 2017-03-05 08:00:00
15 | 2017-03-05 10:00:00 > 2017-03-05 08:00:00
16 | 2017-03-05 10:00:00 >= 2017-03-05 08:00:00
17 | 2017-03-05 10:00:00 >= 2017-03-05 10:00:00
18 | 2017-03-05 10:00:00 < 2017-03-05 08:00:00
19 | 2017-03-05 10:00:00 <= 2017-03-05 08:00:00
20 | 2017-03-05 10:00:00 <= 2017-03-05 10:00:00
21 | 2017-09-05 18:00:00 == 2017-09-05 18:00:00
22 | min(2018-03-16 16:00:00 ++ 2018-03-15 16:00:00 ) == 2018-03-15 16:00:00
23 | //
24 | [[...]]
25 | ]]
26 |
27 | test java datetime [[ ]] transform "SPT -> Build" to
28 | "24
29 | 7200
30 | true
31 | true
32 | true
33 | false
34 | false
35 | true
36 | true
37 | true
38 | "
39 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/java/features/expressions/logic/logic.spt:
--------------------------------------------------------------------------------
1 | module java-features-expressions-logic
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module logic (on-demand)
7 |
8 | config
9 | backend: Java
10 |
11 | model
12 | entity X {
13 | val : Int = (42 >= 4 && !false ? "a" : "b") == "a" ? 5 : 88 + 4
14 | }
15 |
16 | data
17 | x : X {}
18 |
19 | execute
20 | x.val
21 | [[...]]
22 | ]]
23 |
24 | test logic [[ ]] transform "SPT -> Build" to
25 | "5
26 | "
27 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/java/features/expressions/math/math.spt:
--------------------------------------------------------------------------------
1 | module java-features-expressions-math
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module math (on-demand)
7 |
8 | config
9 | backend: Java
10 |
11 | model
12 | entity X {
13 | val : Int ? = 42 * 6 % 10 /. (5 - 10) + 4 - 3 * 8 /. -1 + (3 / 2) as Int
14 | }
15 |
16 | data
17 | x : X {}
18 |
19 | execute
20 | x.val
21 | [[...]]
22 | ]]
23 |
24 | test math [[ ]] transform "SPT -> Build" to
25 | "29
26 | "
27 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/java/features/expressions/multiplicities/multiplicities.spt:
--------------------------------------------------------------------------------
1 | module java-features-expressions-multiplicities
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module multiplicities (on-demand)
7 |
8 | config
9 | backend: Java
10 |
11 | model
12 | entity Foo{
13 | input1 : Int = 5
14 | input2 : Int?
15 | value : Int = input2 <+ input1
16 | }
17 |
18 | data
19 | f : Foo {}
20 |
21 | execute
22 | f.input1 ++ f.input2
23 |
24 | 42 \ 42
25 | 42 \ 43
26 | no value \ 42
27 | 42 \ no value
28 | 42 \ (42 ++ 43)
29 | 42 \ (43 ++ 44)
30 |
31 | (42 ++ 43) \ 42
32 | (42 ++ 43) \ 44
33 | (42 ++ 43) \ no value
34 | (42 ++ 43) \ (41 ++ 42)
35 | (42 ++ 43) \ (43 ++ 44)
36 | (42 ++ 43 ++ 44) \ (42 ++ 43)
37 | (42 ++ 43 ++ 44) \ (42 ++ 43 ++ 44)
38 | (42 ++ 42) \ 42
39 |
40 | if(true) (1 ++ 1) else (2 ++ 2)
41 | if(true) 1 else (1 ++ 1)
42 | if(true) (1 ++ 1) else 1
43 | // TODO fix choice_One_Mult
44 | // 1 <+ 1 ++ 1
45 | (1 ++ 1) <+ 1
46 | (1 ++ 1) <+ (2 ++ 2)
47 |
48 | [[...]]
49 | ]]
50 |
51 | test java multiplicities [[ ]] transform "SPT -> Build" to
52 | "[5]
53 | null
54 | 42
55 | null
56 | 42
57 | null
58 | 42
59 | [43]
60 | [42, 43]
61 | [42, 43]
62 | [43]
63 | [42]
64 | [44]
65 | []
66 | []
67 | [1, 1]
68 | [1]
69 | [1, 1]
70 | [1, 1]
71 | [1, 1]
72 | "
73 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/java/features/expressions/nestedIf/nestedIf.spt:
--------------------------------------------------------------------------------
1 | module java-features-expressions-nestedIf
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module nestedIf (on-demand)
7 |
8 | config
9 | backend: Java
10 |
11 | model
12 |
13 | entity Z{
14 | b : Boolean
15 | c : Boolean = (if(b) this else this).b
16 | // d : Boolean = this
17 | }
18 |
19 | data
20 |
21 | z:Z{b=true}
22 |
23 | execute
24 |
25 | z.c
26 | [[...]]
27 | ]]
28 |
29 |
30 | test nestedIf [[ ]] transform "SPT -> Build" to
31 | "true
32 | "
33 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/java/features/expressions/references/references.spt:
--------------------------------------------------------------------------------
1 | module java-features-expressions-references
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module references (on-demand)
7 |
8 | config
9 | backend: Java
10 |
11 | model
12 | entity Foo{
13 | input1 : Int = 5
14 | input2 : Int?
15 | value : Int = input1
16 | }
17 |
18 | data
19 | f : Foo {}
20 |
21 | execute
22 | f.value
23 | [[...]]
24 | ]]
25 |
26 | test Expressions References execute-java [[ ]] transform "SPT -> Build" to
27 | "5
28 | "
29 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/java/features/functions/functions.spt:
--------------------------------------------------------------------------------
1 | module java-features-functions
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module functions
7 |
8 | functions
9 |
10 | round1(f : Float) : Float = (f * 10.0 + 0.5) as Int as Float / 10.0
11 |
12 | countTrue(bs : Boolean *) : Int = bs.filter(b=>b).count()
13 |
14 | accessField (bar : Bar) : Int = bar.i1
15 | accessParentField(bar : Bar) : Int = bar.parent.accessField() <+ 4
16 |
17 | hasI(i : Int*) : Boolean = count(i)>0
18 |
19 | model
20 |
21 | entity Bar {
22 | i1 : Int
23 |
24 | i2 : Int = accessParentField(this)
25 | }
26 |
27 | relation Bar.parent ? <-> Bar.children
28 |
29 | data
30 |
31 | bar:Bar{
32 | i1=5
33 | parent={
34 | i1=88
35 | }
36 | }
37 |
38 | execute
39 |
40 | round1(4.44)
41 |
42 | countTrue(true ++ false ++ true ++ false ++ true)
43 |
44 | bar.i2
45 |
46 | hasI(no value)
47 |
48 | [[...]]
49 | ]]
50 |
51 | test Functions execute-java [[ ]] transform "SPT -> Build" to
52 | "Updating Bar.i2: 2
53 | 4.4
54 | 3
55 | 88
56 | false
57 | "
58 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/java/features/inlinefield/inlinefield.spt:
--------------------------------------------------------------------------------
1 | module java-features-inlinefield
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module inlinefield
7 |
8 | config
9 | backend: Java
10 |
11 | model
12 |
13 | entity Foo{
14 | myBars : Bar*(ordered) = bars.filter(x => x.b).orderBy(x => x.v).first(2) (inline)
15 | v : Int = sum(myBars.v)
16 | }
17 |
18 | entity Bar{
19 | b : Boolean
20 | v : Int
21 | }
22 |
23 | relation Foo.bars * <-> * Bar.foos
24 |
25 | data
26 |
27 | foo:Foo{
28 | bars =
29 | {
30 | b = true
31 | v = 5
32 | },
33 | {
34 | b = false
35 | v = 19
36 | },
37 | {
38 | b = true
39 | v = 55
40 | },
41 | {
42 | b = false
43 | v = 4
44 | },
45 | {
46 | b = true
47 | v = 37
48 | }
49 | }
50 |
51 | execute
52 |
53 | foo.v
54 | [[...]]
55 | ]]
56 |
57 | test Inline field execute-java [[ ]] transform "SPT -> Build" to
58 | "Updating Foo.v: 1
59 | 42
60 | "
61 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/java/features/ondemandincremental/ondemandincremental.spt:
--------------------------------------------------------------------------------
1 | module java-features-ondemandincremental
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module ondemandincremental (on-demand incremental)
7 |
8 | config
9 | backend: Java
10 |
11 | model
12 |
13 | entity Foo{
14 | in : Int
15 | v2 : Int = in * 2
16 | v3 : Int = in * 3
17 | v4 : Int = v2 + 1
18 | }
19 |
20 | data
21 |
22 | foo : Foo { in = 5}
23 |
24 | execute
25 |
26 | foo.v4
27 | [[...]]
28 | ]]
29 |
30 | test On-demand incremental execute-java [[ ]] transform "SPT -> Build" to
31 | "Updating Foo.v4
32 | Updating Foo.v2
33 | 11
34 | "
35 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/java/features/stringinterpolation/stringinterpolation.spt:
--------------------------------------------------------------------------------
1 | module java-features-stringinterpolation
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module stringinterpolation (on-demand)
7 |
8 | model
9 |
10 | entity Assignment{
11 | name : String?
12 | displayName : String = name<+"Assignment"
13 | displayLine : String = "\n* ${displayName}"
14 | description : String = "${displayName} consists of the following sub assignments:${children.displayLine}"
15 | }
16 |
17 | relation Assignment.children * <-> ? Assignment.parent
18 |
19 | data
20 |
21 | math:Assignment{
22 | name = "Math"
23 | children =
24 | {name="Exam"},
25 | {name="Lab"}
26 | }
27 |
28 | execute
29 |
30 | math.description
31 | [[...]]
32 | ]]
33 |
34 | test String interpolation execute-java [[ ]] transform "SPT -> Build" to
35 | "Math consists of the following sub assignments:
36 | * Exam
37 | * Lab
38 | "
39 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/java/programs/helloworld/helloworld.spt:
--------------------------------------------------------------------------------
1 | module java-programs-helloworld
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module helloworld
7 |
8 | config
9 |
10 | backend : Java
11 | phase : [[...]]
12 |
13 | model
14 | entity Message {
15 | text : String
16 | }
17 |
18 | data
19 | hello : Message {
20 | text="Hello World!"
21 | }
22 |
23 | execute
24 | hello.text
25 | ]]
26 |
27 | test Hello World generate-java [[ generate ]] transform "SPT -> Build"
28 |
29 | test Hello World compile-java [[ compile ]] transform "SPT -> Build"
30 |
31 | test Hello World execute-java [[ execute ]] transform "SPT -> Build" to
32 | "Hello World!
33 | "
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/javascript/features/derived/calculateMany/calculateMany.spt:
--------------------------------------------------------------------------------
1 | module calculateMany
2 |
3 | language icedust
4 |
5 | fixture [[
6 |
7 | module calculateMany
8 |
9 | config
10 | backend: Javascript
11 |
12 | model
13 |
14 | entity Node {
15 | name : String
16 | }
17 |
18 | relation Node.from <-> Node.to
19 | relation Node.reachable * = to ++ to.reachable <-> Node
20 |
21 | data
22 |
23 | a : Node {
24 | name = "a"
25 | to = b {
26 | name = "b"
27 | to = c {
28 | name = "c"
29 | }
30 | }
31 | }
32 |
33 | execute
34 | a.name
35 | b.name
36 | c.name
37 | a.to.name
38 | a.from.name
39 | a.to.to.name
40 | a.to.to.to.name
41 | a.reachable.name
42 | [[...]]
43 | ]]
44 |
45 | test correctly flatten derived relation [[]] transform "SPT -> Build" to
46 | "a
47 | b
48 | c
49 | [b]
50 | []
51 | [c]
52 | []
53 | [b,c]
54 | "
55 |
56 |
57 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/javascript/features/expressions/cast/cast.spt:
--------------------------------------------------------------------------------
1 | module javascript-features-expressions-cast
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module cast
7 |
8 | config
9 | backend: Javascript
10 |
11 | execute
12 | concat(5.1 as String + " " + true as String + " " + 5 as String ++ no value as String)
13 | [[...]]
14 | ]]
15 |
16 | test cast [[ ]] transform "SPT -> Build" to
17 | "5.1 true 5
18 | "
19 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/javascript/features/expressions/datetime/datetime.spt:
--------------------------------------------------------------------------------
1 | module javascript-features-expressions-datetime
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module datetime
7 |
8 | config
9 | backend: Javascript
10 |
11 | execute
12 |
13 | (2015-01-01 00:00:00 - 2014-12-31 00:00:00) /. 3600
14 | 2017-03-05 10:00:00 - 2017-03-05 08:00:00
15 | 2017-03-05 10:00:00 > 2017-03-05 08:00:00
16 | 2017-03-05 10:00:00 >= 2017-03-05 08:00:00
17 | 2017-03-05 10:00:00 >= 2017-03-05 10:00:00
18 | 2017-03-05 10:00:00 < 2017-03-05 08:00:00
19 | 2017-03-05 10:00:00 <= 2017-03-05 08:00:00
20 | 2017-03-05 10:00:00 <= 2017-03-05 10:00:00
21 | 2017-09-05 18:00:00 == 2017-09-05 18:00:00
22 | //
23 | [[...]]
24 | ]]
25 |
26 | test javascript datetime [[ ]] transform "SPT -> Build" to
27 | "24
28 | 7200
29 | true
30 | true
31 | true
32 | false
33 | false
34 | true
35 | true
36 | "
37 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/javascript/features/expressions/elemAt/elemAt.spt:
--------------------------------------------------------------------------------
1 | module javascript-features-expressions-elemAt
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module ElemAt
7 |
8 | config
9 | backend: Javascript
10 |
11 | execute
12 | 1.elemAt(0)
13 | (1 ++ 2).elemAt(0)
14 | (1 ++ 2 ++ 3).elemAt(1 + 1)
15 | (1 ++ 2 ++ 3).elemAt(3)
16 | [[...]]
17 | ]]
18 |
19 |
20 | test first [[ ]] transform "SPT -> Build" to
21 | "null
22 | 1
23 | 3
24 | null
25 | "
26 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/javascript/features/expressions/find/find.spt:
--------------------------------------------------------------------------------
1 | module javascript-features-expressions-find
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module Find
7 |
8 | config
9 | backend: Javascript
10 |
11 | execute
12 | (1 ++ 2 ++ 3 ++ 4).find(x => x > 2)
13 | (1 ++ 2 ++ 3 ++ 4).find(x => x > 4)
14 | 1.find(x => x >= 0)
15 | 1.find(x => x > 1)
16 | [[...]]
17 | ]]
18 |
19 |
20 | test find [[ ]] transform "SPT -> Build" to
21 | "3
22 | null
23 | 1
24 | null
25 | "
26 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/javascript/features/expressions/first/first.spt:
--------------------------------------------------------------------------------
1 | module javascript-features-expressions-first
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module First
7 |
8 | config
9 | backend: Javascript
10 |
11 | execute
12 | (1 ++ 2 ++ 3 ++ 4).first()
13 | (1 ++ 2 ++ 3 ++ 4).first(0)
14 | (1 ++ 2 ++ 3 ++ 4).first(1)
15 | (1 ++ 2 ++ 3 ++ 4).first(2)
16 | (1 ++ 2 ++ 3 ++ 4).first(3)
17 | (1 ++ 2 ++ 3 ++ 4).first(4)
18 | [[...]]
19 | ]]
20 |
21 |
22 | test first [[ ]] transform "SPT -> Build" to
23 | "1
24 | []
25 | [1]
26 | [1,2]
27 | [1,2,3]
28 | [1,2,3,4]
29 | "
30 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/javascript/features/expressions/indexOf/indexOf.spt:
--------------------------------------------------------------------------------
1 | module javascript-features-expressions-indexOf
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module IndexOf
7 |
8 | config
9 | backend: Javascript
10 |
11 | execute
12 | 1.indexOf(0)
13 | (1 ++ 2).indexOf(0)
14 | (1 ++ 2 ++ 3).indexOf(1 + 1)
15 | [[...]]
16 | ]]
17 |
18 |
19 | test indexOf [[ ]] transform "SPT -> Build" to
20 | "null
21 | -1
22 | 1
23 | "
24 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/javascript/features/expressions/logic/logic.spt:
--------------------------------------------------------------------------------
1 | module javascript-features-expressions-logic
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module logic (on-demand)
7 |
8 | config
9 | backend: Javascript
10 |
11 | model
12 | entity X {
13 | val : Int = (42 >= 4 && !false ? "a" : "b") == "a" ? 5 : 88 + 4
14 | }
15 |
16 | data
17 | x : X {}
18 |
19 | execute
20 | x.val
21 | [[...]]
22 | ]]
23 |
24 | test logic [[ ]] transform "SPT -> Build" to
25 | "5
26 | "
27 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/javascript/features/expressions/math/math.spt:
--------------------------------------------------------------------------------
1 | module javascript-features-expressions-math
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module math
7 |
8 | config
9 | backend: Javascript
10 |
11 | model
12 | entity X {
13 | val : Int ? = 42 * 6 % 10 /. (5 - 10) + 4 - 3 * 8 /. -1 + (3 / 2) as Int
14 | }
15 |
16 | data
17 | x : X {}
18 |
19 | execute
20 | x.val
21 | [[...]]
22 | ]]
23 |
24 | test math [[ ]] transform "SPT -> Build" to
25 | "29
26 | "
27 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/javascript/features/expressions/multiplicities/multiplicities.spt:
--------------------------------------------------------------------------------
1 | module javascript-features-expressions-multiplicities
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module multiplicities
7 |
8 | config
9 | backend: Javascript
10 |
11 | model
12 | entity Foo{
13 | input1 : Int = 5
14 | input2 : Int?
15 | value : Int = input2 <+ input1
16 | }
17 |
18 | data
19 | f : Foo {}
20 |
21 | execute
22 | f.input1 ++ f.input2
23 |
24 | 42 \ 42
25 | 42 \ 43
26 | no value \ 42
27 | 42 \ no value
28 | 42 \ (42 ++ 43)
29 | 42 \ (43 ++ 44)
30 |
31 | (42 ++ 43) \ 42
32 | (42 ++ 43) \ 44
33 | (42 ++ 43) \ no value
34 | (42 ++ 43) \ (41 ++ 42)
35 | (42 ++ 43) \ (43 ++ 44)
36 | (42 ++ 43 ++ 44) \ (42 ++ 43)
37 | (42 ++ 43 ++ 44) \ (42 ++ 43 ++ 44)
38 | (42 ++ 42) \ 42
39 |
40 | [[...]]
41 | ]]
42 |
43 | test javascript multiplicities [[ ]] transform "SPT -> Build" to
44 | "[5]
45 | null
46 | 42
47 | null
48 | 42
49 | null
50 | 42
51 | [43]
52 | [42,43]
53 | [42,43]
54 | [43]
55 | [42]
56 | [44]
57 | []
58 | []
59 | "
60 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/javascript/features/expressions/nestedIf/nestedIf.spt:
--------------------------------------------------------------------------------
1 | module javascript-features-expressions-nestedIf
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module nestedIf
7 |
8 | config
9 | backend: Javascript
10 |
11 | model
12 |
13 | entity Z{
14 | b : Boolean
15 | c : Boolean = (if(b) this else this).b
16 | }
17 |
18 | data
19 |
20 | z:Z{b=true}
21 |
22 | execute
23 |
24 | z.c
25 | [[...]]
26 | ]]
27 |
28 |
29 | test nestedIf [[ ]] transform "SPT -> Build" to
30 | "true
31 | "
32 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/javascript/features/expressions/orderBy/orderBy.spt:
--------------------------------------------------------------------------------
1 | module javascript-features-expressions-orderBy
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module OrderBy
7 |
8 | config
9 | backend: Javascript
10 |
11 | model
12 |
13 | entity A {
14 | name: String
15 | }
16 |
17 | data
18 | a1: A{name="a1"}
19 | a2: A{name="a2"}
20 | a3: A{name="a3"}
21 | a4: A{name="a4"}
22 | a5: A{name="a5"}
23 | a6: A{name="a6"}
24 | a7: A{name="a7"}
25 | a8: A{name="a8"}
26 |
27 | execute
28 | (a3 ++ a1 ++a7 ++ a4 ++ a8 ++ a6 ++ a2 ++ a5).orderBy(x => x.name).name
29 | [[...]]
30 | ]]
31 |
32 |
33 | test orderBy [[ ]] transform "SPT -> Build" to
34 | "[a1,a2,a3,a4,a5,a6,a7,a8]
35 | "
36 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/javascript/features/expressions/references/references.spt:
--------------------------------------------------------------------------------
1 | module javascript-features-expressions-references
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module references
7 |
8 | config
9 | backend: Javascript
10 |
11 | model
12 | entity Foo{
13 | input1 : Int = 5
14 | input2 : Int?
15 | value : Int = input1
16 | }
17 |
18 | data
19 | f : Foo {}
20 |
21 | execute
22 | f.value
23 | [[...]]
24 | ]]
25 |
26 | test Expressions References execute-java [[ ]] transform "SPT -> Build" to
27 | "5
28 | "
29 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/javascript/features/filter/filter.spt:
--------------------------------------------------------------------------------
1 | module javascript-features-expressions-filter
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module Filter
7 |
8 | config
9 | backend: Javascript
10 |
11 | execute
12 | (1 ++ 2 ++ 3 ++ 4).filter(x => x > 2)
13 | (1 ++ 2 ++ 3 ++ 4).filter(x => x > 4)
14 | 1.filter(x => x >= 0)
15 | 1.filter(x => x > 1)
16 | [[...]]
17 | ]]
18 |
19 |
20 | test first [[ ]] transform "SPT -> Build" to
21 | "[3,4]
22 | []
23 | 1
24 | null
25 | "
26 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/javascript/features/html/html-target.spt:
--------------------------------------------------------------------------------
1 | module html-target
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module htmltarget
7 |
8 | config
9 | backend: Javascript
10 | phase: generate
11 | target: html
12 |
13 | execute
14 | 42
15 | [[...]]
16 | ]]
17 |
18 | test generate html target [[ ]] transform "SPT -> Build"
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/javascript/features/stringinterpolation/stringinterpolation.spt:
--------------------------------------------------------------------------------
1 | module javascript-features-stringinterpolation
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module stringinterpolation (on-demand)
7 |
8 | config
9 |
10 | backend: Javascript
11 |
12 | model
13 |
14 | entity Assignment{
15 | name : String?
16 | displayName : String = name<+"Assignment"
17 | displayLine : String = "\n* ${displayName}"
18 | description : String = "${displayName} consists of the following sub assignments:${children.displayLine}"
19 | }
20 |
21 | relation Assignment.children * <-> ? Assignment.parent
22 |
23 | data
24 |
25 | math:Assignment{
26 | name = "Math"
27 | children =
28 | {name="Exam"},
29 | {name="Lab"}
30 | }
31 |
32 | execute
33 |
34 | math.description
35 | [[...]]
36 | ]]
37 |
38 | test String interpolation execute-javascript [[ ]] transform "SPT -> Build" to
39 | "Math consists of the following sub assignments:
40 | * Exam
41 | * Lab
42 | "
43 |
--------------------------------------------------------------------------------
/icedust.test/dynamic-semantics/javascript/programs/helloworld/helloworld.spt:
--------------------------------------------------------------------------------
1 | module javascript-programs-helloworld
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module helloworld
7 |
8 | config
9 | backend: Javascript
10 | phase: [[...]]
11 |
12 |
13 | model
14 | entity Message {
15 | text : String
16 | }
17 |
18 | data
19 | hello : Message {
20 | text="Hello World!"
21 | }
22 |
23 | execute
24 | hello.text
25 | ]]
26 |
27 |
28 |
29 |
30 | test Hello World generate-javascript [[ generate ]] transform "SPT -> Build"
31 |
32 | test Hello World execute-javascript [[ execute ]] transform "SPT -> Build" to
33 | "Hello World!
34 | "
35 |
36 |
--------------------------------------------------------------------------------
/icedust.test/metaborg.yaml:
--------------------------------------------------------------------------------
1 | id: org.metaborg:icedust.test:1.0.1-SNAPSHOT
2 | name: IceDust
3 | dependencies:
4 | compile:
5 | - org.metaborg.lang:icedust:1.0.1-SNAPSHOT
6 | - org.metaborg:org.metaborg.meta.lang.spt:${metaborgVersion}
7 | runtime:
8 | nabl2:
9 | debug: # resolution ## enable to see custom analysis info
10 | build:
11 | useBuildSystemSpec: true
12 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/api/attributes.spt:
--------------------------------------------------------------------------------
1 | module api-attributes
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | entity Foo {
9 | b : Int
10 | [[...]]
11 | }
12 | ]]
13 |
14 | test Query attribute entity name [[ [[bla]] : Int ]] run attributename-get-entityname-test on #1 to "Foo"
15 | test Query attribute expr [[ [[bla]] : Int = 5 ]] run attributename-get-expr-test on #1 to Int("5")
16 | test Query attribute expr2 [[ [[bla]] : Int = 77 (default) ]] run attributename-get-expr-test on #1 to Int("77")
17 | test Query attribute type [[ [[bla]] : Int = 77 (default) ]] run name-get-type-test on #1 to Int()
18 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/api/entities.spt:
--------------------------------------------------------------------------------
1 | module api-entities
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | relation [[...]]{
9 | i : Int
10 | j : Int
11 | Foo.someInverse * -> someRole
12 | Foo.someInverse2 * -> someRole2
13 | someRole.someShortcut <-> someRole2.someShortcut2
14 | }
15 | relation Foo.foos <-> Foo.foos2
16 | ]]
17 |
18 | test Query entity attribute names [[Foo]] run entityname-get-attributenames-test to !ATerm["i","j"]
19 | test Query entity relation names [[Foo]] run entityname-get-relationnames-test to !ATerm["foos","foos2"]
20 | test Query entity role names [[Foo]] run entityname-get-rolenames-test to !ATerm["someRole","someRole2"]
21 | test Query entity inverse names [[Foo]] run entityname-get-inversenames-test to !ATerm["someInverse","someInverse2"]
22 | test Query entity shortcut names [[Foo]] run entityname-get-shortcutnames-test to !ATerm["someShortcut","someShortcut2"]
23 | test Query entity relroleinv names [[Foo]] run entityname-get-relroleinvnames-test to !ATerm["foos","foos2","someRole","someRole2","someInverse","someInverse2"]
24 | test Query entity member names [[Foo]] run entityname-get-membernames-test to !ATerm["i","j","foos","foos2","someRole","someRole2","someInverse","someInverse2","someShortcut","someShortcut2"]
25 | test Query entity module name [[Foo]] run entityname-get-modulename-test to "test"
26 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/api/entityinstances.spt:
--------------------------------------------------------------------------------
1 | module api-entityinstances
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | entity Student{}
9 | entity Course{}
10 | relation Student.courses <-> Course.students
11 | data
12 | math:Course{
13 | students=
14 | [[...]]{},
15 | bob{}
16 | }
17 | ]]
18 |
19 | // test ei member values [[math]] run entityinstancename-get-membervaluenames-test to "" // selection selects whole module...
20 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/api/flowsto.spt:
--------------------------------------------------------------------------------
1 | module api-flowsto
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | entity Foo {
9 | a : Int 1 // note without the one this is also run on One()
10 | [[...]] : Int = a
11 | c : Int = b
12 | }
13 | ]]
14 |
15 | test Query attribute depends on [[b]] run name-get-dependson-pathexprs-test to !ATerm[Ref("a")]
16 | test Query attribute flows to [[b]] run name-get-flowsto-pathexprs-test to !ATerm[Ref("c")]
17 | test Query attribute toposort [[b]] run name-get-toposort-test to 2
18 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/api/flowsto2.spt:
--------------------------------------------------------------------------------
1 | module api-flowsto2
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | entity Student {
9 | foo : Int
10 | [[...]] : Int = count(courses.students) + foo
11 | }
12 | entity Course { }
13 | relation Student.courses <-> Course.students
14 | ]]
15 |
16 | test Query attribute depends on 2 [[b]] run name-get-dependson-pathexprs-test to !ATerm[
17 | MemberAccess(Ref("courses"),"students"),
18 | Ref("courses"),
19 | Ref("foo")
20 | ]
21 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/api/flowsto3.spt:
--------------------------------------------------------------------------------
1 | module api-flowsto3
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 |
8 | functions
9 |
10 | accessField (bar : Bar 1) : Int 1 = bar.i1
11 | accessParentField(bar : Bar 1) : Int 1 = bar.parent.accessField() <+ 4
12 |
13 | model
14 |
15 | entity Bar {
16 | i1 : Int = 4
17 |
18 | [[...]] : Int = accessParentField(this)
19 | }
20 |
21 | relation Bar.parent ? <-> Bar.children
22 | ]]
23 |
24 | test Query attribute depends on 3 [[i2]] run name-get-dependson-pathexprs-test to !ATerm[
25 | MemberAccess(Ref("parent"),"i1"),
26 | Ref("parent")
27 | ]
28 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/api/flowsto4.spt:
--------------------------------------------------------------------------------
1 | module api-flowsto4
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 |
8 | model
9 |
10 | entity Assignment {
11 | subsForGrade : Submission* = submissions.filter(x => x.forGrade) (inline)
12 | [[...]] : Int = subsForGrade.pass.countTrue()
13 | }
14 |
15 | entity Submission {
16 | forGrade : Boolean
17 | pass : Boolean
18 | }
19 |
20 | relation Assignment.submissions * <-> 1 Submission.assignment
21 |
22 | functions
23 |
24 | countTrue(bs : Boolean *) : Int = bs.filter(b=>b).count()
25 |
26 | ]]
27 |
28 | test Query attribute depends on 4 [[numPass]] run name-get-dependson-pathexprs-test to !ATerm[
29 | MemberAccess(Ref("submissions"),"pass"),
30 | MemberAccess(Ref("submissions"),"forGrade"),
31 | Ref("submissions")
32 | ]
33 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/api/flowsto5.spt:
--------------------------------------------------------------------------------
1 | module api-flowsto5
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 |
8 | model
9 |
10 | entity Assignment {
11 | x : Int
12 | y : Int
13 | z : Int
14 | [[...]] : Int = plus(x, x+y + plus(x, z))
15 | }
16 |
17 | functions
18 |
19 | plus(i:Int, j:Int) : Int = i+j
20 |
21 | ]]
22 |
23 | test Query attribute depends on 5 [[numPass]] run name-get-dependson-pathexprs-test to !ATerm[
24 | Ref("y"),
25 | Ref("x"),
26 | Ref("z")
27 | ]
28 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/api/flowsto7.spt:
--------------------------------------------------------------------------------
1 | module api-flowsto7
2 |
3 |
4 | language icedust
5 |
6 | fixture [[
7 | module test
8 |
9 | model
10 |
11 | entity Bar {
12 | i1 : Int = 4
13 | [[...]]: Int = this.grandParent().grandParent().i1 <+ 3
14 | }
15 |
16 | relation Bar.parent ? <-> Bar.children
17 |
18 | functions
19 |
20 | grandParent (bar : Bar) : Bar? = bar.parent.parent
21 |
22 | ]]
23 |
24 | test Query attribute depends on 7 [[i4]] run name-get-dependson-pathexprs-test to !ATerm[
25 | MemberAccess(MemberAccess(MemberAccess(MemberAccess(Ref("parent"),"parent"),"parent"),"parent"),"i1"),
26 | MemberAccess(MemberAccess(MemberAccess(Ref("parent"),"parent"),"parent"),"parent"),
27 | MemberAccess(MemberAccess(Ref("parent"),"parent"),"parent"),
28 | MemberAccess(Ref("parent"),"parent"),
29 | Ref("parent")
30 | ]
31 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/api/flowsto8.spt:
--------------------------------------------------------------------------------
1 | module api-flowsto8
2 |
3 |
4 | language icedust
5 |
6 | fixture [[
7 | module test
8 |
9 | model
10 |
11 | entity Bar {
12 | i1 : Int = 4
13 | i2 : Int = 5
14 | i5 : Int = this.children.children.orderBy(x => x.children.children.i1.sum()).children.children.first().i2 <+ 0
15 | [[...]]: Int = this.grandChildren() .orderBy(x => x.grandChildren() .i1.sum()).grandChildren() .first().i2 <+ 0
16 | }
17 |
18 | relation Bar.parent ? <-> Bar.children
19 |
20 | functions
21 |
22 | grandChildren(bar : Bar) : Bar* = bar.children.children
23 |
24 | ]]
25 |
26 | test Query attribute depends on 8 [[i5v2]] run name-get-dependson-pathexprs-test to !ATerm[
27 | MemberAccess(MemberAccess(MemberAccess(MemberAccess(Ref("children"),"children"),"children"),"children"),"i2"),
28 | MemberAccess(MemberAccess(MemberAccess(MemberAccess(Ref("children"),"children"),"children"),"children"),"i1"),
29 | MemberAccess(MemberAccess(MemberAccess(Ref("children"),"children"),"children"),"children"),
30 | MemberAccess(MemberAccess(Ref("children"),"children"),"children"),
31 | MemberAccess(Ref("children"),"children"),
32 | Ref("children")
33 | ]
34 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/api/functions.spt:
--------------------------------------------------------------------------------
1 | module api-entities
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 |
8 | functions
9 |
10 | [[...]](i:Int 1, j:Int 1) : Int 1 = 5
11 |
12 | ]]
13 |
14 | test Query function param names [[foo]] run functionname-get-paramnames-test to !ATerm["i","j"]
15 | test Query function expr [[foo]] run functionname-get-expr-test to Int("5")
16 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/api/inlining.spt:
--------------------------------------------------------------------------------
1 | module api-inlining
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | entity Foo {
9 | b : Int
10 | [[...]]
11 | }
12 | ]]
13 |
14 | test Query attribute inlining [[ [[bla]] : Int = 5 ]] run name-get-inlining-test on #1 to NotInline()
15 | test Query attribute inlining 2 [[ [[bla]] : Int = 5 (inline) ]] run name-get-inlining-test on #1 to Inline()
16 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/api/membervalues.spt:
--------------------------------------------------------------------------------
1 | module api-membervalues
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | entity Student{}
9 | entity Course{}
10 | relation Student.courses <-> Course.students
11 | data
12 | math:Course{
13 | [[...]]=
14 | alice{},
15 | bob{}
16 | }
17 | ]]
18 |
19 | // test memv get origin [[students]] run membervaluename-get-origin-test to "" // selection selects whole module...
20 |
21 |
22 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/api/modules.spt:
--------------------------------------------------------------------------------
1 | module api-moduls //modules creates a parse error
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module [[...]]
7 | model
8 | entity Foo {
9 | i : Int ?
10 | a : Int = i <+ 0
11 | }
12 | entity Bar {}
13 | entity Baz {}
14 | relation Bar.baz <-> Baz.bar
15 | data
16 | foo:Foo{}
17 | bar:Bar{
18 | baz=baz{}
19 | }
20 | execute
21 | foo.a
22 | 1+1
23 | ]]
24 |
25 | test module entity names [[test]] run modulename-get-entitynames-test to !ATerm["Bar","Baz","Foo"]
26 | test module entityinstance names [[test]] run modulename-get-entityinstancenames-test to !ATerm["bar","baz","foo"]
27 | test module attribute names [[test]] run modulename-get-attributenames-test to !ATerm["a","i"]
28 | //test module attribute names topo [[test]] run modulename-get-attributenames-topo-test to !ATerm[ ["i"],["a"] ] http://yellowgrass.org/issue/SPTWithCore/26
29 | test module exprs [[test]] run modulename-get-exprs-test to !ATerm[MemberAccess(Ref("foo"),"a"),Addition(Int("1"),Int("1"))]
30 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/api/relations.spt:
--------------------------------------------------------------------------------
1 | module api-relations
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | entity Foo {
9 | b : Int
10 | }
11 |
12 | entity Bar { }
13 |
14 | [[...]]
15 | ]]
16 |
17 | test Query relation entity name [[ relation Foo.[[bar]] <-> Bar.foo ]] run attributename-get-entityname-test on #1 to "Foo"
18 | test Query relation entity name 2 [[ relation Foo.bar <-> Bar.[[foo]] ]] run attributename-get-entityname-test on #1 to "Bar"
19 | test Query relation type [[ relation Foo.[[bar]] <-> Bar.foo ]] run name-get-type-test on #1 to "Bar"
20 | test Query relation type 2 [[ relation Foo.bar <-> Bar.[[foo]] ]] run name-get-type-test on #1 to "Foo"
21 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/api/roleinverse.spt:
--------------------------------------------------------------------------------
1 | module api-roleinverse
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | entity Foo {
9 | b : Int
10 | }
11 |
12 | entity Bar { }
13 |
14 | relation XYZ {
15 | Foo.xyz -> foo
16 | [[...]]
17 |
18 | }
19 | ]]
20 |
21 | test Query inverse entity name [[ Bar.[[xyz]] -> bar ]] run attributename-get-entityname-test on #1 to "Bar"
22 | test Query role entity name [[ Bar.xyz -> [[bar]] ]] run attributename-get-entityname-test on #1 to "XYZ"
23 | test Query inverse type [[ Bar.[[xyz]] -> bar ]] run name-get-type-test on #1 to "XYZ"
24 | test Query role type [[ Bar.xyz -> [[bar]] ]] run name-get-type-test on #1 to "Bar"
25 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/api/shortcuts.spt:
--------------------------------------------------------------------------------
1 | module api-shortcuts
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | entity Student {
9 | }
10 | entity Course { }
11 | relation Enrollment {
12 | Student *
13 | Course *
14 |
15 | course.[[...]] <-> student.courses
16 | }
17 | ]]
18 |
19 | test shortcut rolename [[students]] run shortcutname-get-rolename-test to "student"
20 | test shortcut inversename [[students]] run shortcutname-get-inversename-test to "enrollment"
21 |
22 | test shortcut rolename1 [[students]] run shortcutname-get-rolename1-test to "course"
23 | test shortcut rolename2 [[students]] run shortcutname-get-rolename2-test to "student"
24 |
25 | test shortcut entityname [[students]] run shortcutname-get-entityname-test to "Course"
26 |
27 | test shortcut type [[students]] run name-get-type-test to "Student"
28 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/api/traits/entities.spt:
--------------------------------------------------------------------------------
1 | module api-traits-entities
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | entity A{
9 | a : Float
10 | }
11 | entity [[...]] extends A{
12 | b : Int
13 | }
14 | ]]
15 |
16 | test Query entity arri names defined [[Foo]] run entityname-get-arrinames-defined-test to !ATerm["b"]
17 | test Query entity attribute names visible [[Foo]] run entityname-get-attributenames-test to !ATerm["a","b"]
18 |
19 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/api/traits/memberparents.spt:
--------------------------------------------------------------------------------
1 | module api-traits-memberparents
2 |
3 | language icedust
4 |
5 | test Query attribute has parent yes [[
6 | module test
7 | model
8 | entity A {
9 | i : Int
10 | }
11 | entity B extends A {
12 | [[i]] : Int
13 | }
14 | ]] run name-has-parent-test on #1 to "yes"
15 |
16 | test Query attribute has parent no [[
17 | module test
18 | model
19 | entity A {
20 | [[i]] : Int
21 | }
22 | entity B extends A {
23 | i : Int
24 | }
25 | ]] run name-has-parent-test on #1 to "no"
26 |
27 | test Query attribute root entity [[
28 | module test
29 | model
30 | entity A {
31 | [[i]] : Int
32 | }
33 | entity B extends A {
34 | i : Int
35 | }
36 | ]] run attributename-get-root-get-entityname-test on #1 to "A"
37 |
38 | test Query attribute root entity 2 [[
39 | module test
40 | model
41 | entity A {
42 | i : Int
43 | }
44 | entity B extends A {
45 | [[i]] : Int
46 | }
47 | ]] run attributename-get-root-get-entityname-test on #1 to "A"
48 |
49 | test Query attribute root entity 3 [[
50 | module test
51 | model
52 | entity A {
53 | i : Int
54 | }
55 | entity B extends A {
56 | i : Int
57 | }
58 | entity C extends B {
59 | [[i]] : Int
60 | }
61 | ]] run attributename-get-root-get-entityname-test on #1 to "A"
62 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/config/config-section.spt:
--------------------------------------------------------------------------------
1 | module config-config-section
2 |
3 | language icedust
4 |
5 | test error on duplicate config section [[
6 | module test
7 |
8 | config
9 |
10 | backend : Java
11 |
12 | [[config]]
13 |
14 | ]] 1 error at #1
15 |
16 | test error on duplicate backend section [[
17 | module test
18 |
19 | config
20 |
21 | backend : Java
22 |
23 | [[backend : Java]]
24 |
25 | ]] 1 error at #1
26 |
27 | test error on duplicate language features section [[
28 | module test
29 |
30 | config
31 |
32 | language features : derived relations, inlines, strategies, subtyping
33 |
34 | [[language features : derived relations, inlines, strategies, subtyping]]
35 |
36 | ]] 1 error at #1
37 |
38 |
39 | test error on eventual with java backend [[
40 | module test
41 |
42 | config
43 |
44 | backend : Java
45 |
46 | language features : derived relations, inlines, strategies, subtyping, [[eventual calculation]]
47 |
48 | ]] 1 error at #1
49 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/config/derived-relations.spt:
--------------------------------------------------------------------------------
1 | module config-derived-relations
2 |
3 | language icedust
4 |
5 | test no error on derived relations enabled [[
6 | module test
7 |
8 | config
9 |
10 | language features : derived relations
11 |
12 | model
13 |
14 | entity Node { }
15 |
16 | relation Node.forward <-> Node.backward
17 |
18 | relation Node.twice = forward.forward <-> Node.twiceInv
19 | ]] 0 errors
20 |
21 | test error on derived relation disabled [[
22 | module test
23 |
24 | config
25 |
26 | language features :
27 |
28 | model
29 |
30 | entity Node { }
31 |
32 | relation Node.forward <-> Node.backward
33 |
34 | [[relation Node.twice = forward.forward <-> Node.twiceInv]]
35 | ]] 1 error at #1
36 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/config/eventual.spt:
--------------------------------------------------------------------------------
1 | module config-eventual
2 |
3 | language icedust
4 |
5 | test no error on eventual enabled [[
6 | module test
7 |
8 | config
9 |
10 | backend : WebDSL
11 |
12 | model
13 |
14 | entity Foo {
15 | a : Int
16 | b : Int = a (eventual)
17 | }
18 | ]] 0 errors
19 |
20 | test error on eventual disabled [[
21 | module test
22 |
23 | config
24 |
25 | model
26 |
27 | entity Foo {
28 | a : Int
29 | b : Int = a [[(eventual)]]
30 | }
31 | ]] 1 error at #1
32 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/config/first-class-relations.spt:
--------------------------------------------------------------------------------
1 | module config-first-class-relations
2 |
3 | language icedust
4 |
5 | test no error on first-class relations enabled [[
6 | module test
7 |
8 | config
9 |
10 | language features : first-class relations
11 |
12 | model
13 |
14 | entity Student { }
15 |
16 | relation Enrollment {
17 | Student
18 | Course
19 | }
20 |
21 | entity Course { }
22 |
23 | data
24 |
25 | bob : Student {
26 | course = math{}
27 | }
28 | ]] 0 errors
29 |
30 | test error on first-class relation disabled [[
31 | module test
32 |
33 | config
34 |
35 | language features :
36 |
37 | model
38 |
39 | entity Student { }
40 |
41 | [[relation Enrollment {
42 | Student
43 | Course
44 | }]]
45 |
46 | entity Course { }
47 |
48 | data
49 |
50 | bob : Student {
51 | course = [[]]math{}
52 | }
53 | ]] 2 errors at #1, #2
54 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/config/inlines.spt:
--------------------------------------------------------------------------------
1 | module config-inlines
2 |
3 | language icedust
4 |
5 | test no error on inlines enabled [[
6 | module test
7 |
8 | config
9 |
10 | language features : inlines
11 |
12 | model
13 |
14 | entity Foo {
15 | a : Int
16 | b : Int = a (inline)
17 | }
18 | ]] 0 errors
19 |
20 | test error on inlines disabled [[
21 | module test
22 |
23 | config
24 |
25 | language features :
26 |
27 | model
28 |
29 | entity Foo {
30 | a : Int
31 | [[b : Int = a (inline)]]
32 | }
33 | ]] 1 error at #1
34 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/config/strategies.spt:
--------------------------------------------------------------------------------
1 | module config-strategies
2 |
3 | language icedust
4 |
5 | test no error on strategies enabled [[
6 | module test
7 |
8 | config
9 |
10 | language features : strategies
11 |
12 | model
13 |
14 | entity Foo {
15 | a : Int
16 | b : Int = a (on-demand)
17 | }
18 | ]] 0 errors
19 |
20 | test error on strategies disabled [[
21 | module test
22 |
23 | config
24 |
25 | language features :
26 |
27 | model
28 |
29 | entity Foo {
30 | a : Int
31 | b : Int = a [[(on-demand)]]
32 | }
33 | ]] 1 error at #1
34 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/config/subtyping.spt:
--------------------------------------------------------------------------------
1 | module config-subtyping
2 |
3 | language icedust
4 |
5 | test no error on subtyping enabled [[
6 | module test
7 |
8 | config
9 |
10 | language features : subtyping
11 |
12 | model
13 |
14 | entity Person { }
15 |
16 | entity Student extends Person { }
17 | ]] 0 errors
18 |
19 | test error on subtyping disabled [[
20 | module test
21 |
22 | config
23 |
24 | language features :
25 |
26 | model
27 |
28 | entity Person { }
29 |
30 | entity Student [[extends Person]] { }
31 | ]] 1 error at #1
32 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/desugar/auto-inverses.spt:
--------------------------------------------------------------------------------
1 | module desugar-auto-inverses
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 |
8 | model
9 |
10 | entity Node { }
11 |
12 | relation Tree {
13 | Node * -> parent
14 | Node ? -> child
15 | }
16 |
17 | entity Foo{}
18 | entity Bar{}
19 | relation Rel{Foo * Bar *}
20 |
21 | data
22 |
23 | n : Node {}
24 | foo : Foo {}
25 |
26 | execute
27 | 3
28 | [[...]]
29 | ]]
30 |
31 | test auto inverse on self relation [[n.treeAsParent]] run get-type2 to "Tree"
32 | test auto inverse on other relation [[foo.rel ]] run get-type2 to "Rel"
33 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/desugar/auto-relations.spt:
--------------------------------------------------------------------------------
1 | module desugar-auto-relations
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 |
8 | [[...]]
9 | ]]
10 |
11 | test auto relation type [[
12 | model
13 |
14 | entity Course {}
15 |
16 | entity Student {}
17 |
18 | relation Course <-> Student
19 |
20 | data
21 |
22 | alice : Student { }
23 |
24 | execute
25 |
26 | 3
27 | [[alice.course]]
28 | ]] run get-type2 on #1 to "Course"
29 |
30 | test auto relation name resolution [[
31 | model
32 |
33 | entity Course {}
34 |
35 | entity Student {}
36 |
37 | relation Course <-> [[Student]]
38 |
39 | data
40 |
41 | alice : Student { }
42 |
43 | execute
44 |
45 | 3
46 | alice.[[course]]
47 | ]] resolve #2 to #1
48 |
49 | test auto relation name resolution 2 [[
50 | model
51 |
52 | entity Node{}
53 |
54 | relation Node.parent ? <-> Node.children
55 |
56 | relation Node.root 1 = parent.root <+ this <-> [[Node]]
57 |
58 | data
59 |
60 | n:Node{}
61 |
62 | execute
63 |
64 | n.[[rootInverse]]
65 | ]] resolve #2 to #1
66 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/desugar/auto-shortcuts.spt:
--------------------------------------------------------------------------------
1 | module desugar-auto-shortcuts
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 |
9 | entity Student {
10 | age : Int = 3
11 | }
12 |
13 | entity Course {
14 |
15 | }
16 |
17 | relation Enrollment{
18 | Student *
19 | Course +
20 | }
21 |
22 | data
23 | s : Student {}
24 | c : Course{}
25 | e : Enrollment {
26 | student = s
27 | course = c
28 | }
29 | execute
30 | 3
31 | [[...]]
32 | ]]
33 |
34 | test auto shortcut type of inverse role [[c.enrollment.student]] run get-type2 to "Student"
35 | test auto shortcut type of shortcut [[c.student]] run get-type2 to "Student"
36 | test auto shortcut type of inverse role2 [[s.enrollment.course]] run get-type2 to "Course"
37 | test auto shortcut type of shortcut2 [[s.course]] run get-type2 to "Course"
38 |
39 | test auto shortcut type of shortcut.shortcut [[s.course.student]] run get-type2 to "Student"
40 |
41 | test auto shortcut multiplicity of inverse role [[c.enrollment.student]] run get-multiplicity to OneOrMore()
42 | test auto shortcut multiplicity of shortcut [[c.student]] run get-multiplicity to OneOrMore()
43 | test auto shortcut multiplicity of inverse role2 [[s.enrollment.course]] run get-multiplicity to ZeroOrMore()
44 | test auto shortcut multiplicity of shortcut2 [[s.course]] run get-multiplicity to ZeroOrMore()
45 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/names/builtin.spt:
--------------------------------------------------------------------------------
1 | module names-builtin
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | execute
8 | [[...]]
9 | ]]
10 |
11 | test Error on wrong number of arguments for built-in function [[
12 | [[first(1++2,3,4)]]
13 | ]] >= 1 error at #1
14 |
15 | test No error on correct number of arguments for built-in function [[
16 | first(1++2,3)
17 | ]] 0 errors
18 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/names/data.spt:
--------------------------------------------------------------------------------
1 | module names-data
2 |
3 | language icedust
4 |
5 | test Resolve attribute in entity instance without type [[
6 | module test
7 | model
8 | entity Foo {
9 | [[i]] : Int
10 | }
11 | relation Foo.foreward <-> Foo.backward {}
12 | data
13 | foo : Foo {
14 | i = 5
15 | foreward =
16 | innerFoo {
17 | [[i]] = 7
18 | }
19 | }
20 | ]] resolve #2 to #1
21 |
22 | test Error on non existing attribute in entity instance without type [[
23 | module test
24 | model
25 | entity Foo {
26 | i : Int
27 | }
28 | relation Foo.foreward <-> Foo.backward {}
29 | data
30 | foo : Foo {
31 | i = 5
32 | foreward =
33 | innerFoo {
34 | i = 7
35 | [[j = 7]]
36 | }
37 | }
38 | ]] >= 1 error at #1
39 |
40 | test No error on existing attribute in entity instance without type [[
41 | module test
42 | config
43 | language features : first-class relations
44 | model
45 | entity Foo {
46 | i : Int
47 | }
48 | relation Foo.foreward <-> Foo.backward {}
49 | data
50 | foo : Foo {
51 | i = 5
52 | foreward =
53 | innerFoo {
54 | i = 7
55 | }
56 | }
57 | ]] 0 errors
58 |
59 |
60 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/names/entities.spt:
--------------------------------------------------------------------------------
1 | module names-entities
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | [[...]]
9 | ]]
10 |
11 | test Duplicate entity type fails [[
12 | entity [[User]] {}
13 | entity [[User]] {}
14 | ]] 2 errors at #1,#2
15 |
16 | test Duplicate relation fails [[
17 | entity User{}
18 | entity Book{}
19 | relation [[Owns]]{
20 | User *
21 | Book 1
22 | }
23 | relation [[Owns]]{
24 | User.x * -> user1
25 | Book.y 1 -> book1
26 | }
27 | config
28 | language features : first-class relations
29 | ]] 2 errors at #1,#2
30 |
31 | test Resolve relation member to entity [[
32 | entity [[User]]{}
33 | entity Book{}
34 | relation Owns{
35 | [[User]] *
36 | Book 1
37 | }
38 | ]] resolve #2 to #1
39 |
40 | test Resolve invalid relation member fails [[
41 | entity User{}
42 | entity Book{}
43 | relation Owns{
44 | User *
45 | Paper 1
46 | }
47 | ]] >= 1 error
48 |
49 |
50 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/names/entityinstances.spt:
--------------------------------------------------------------------------------
1 | module names-entityinstances
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | entity User{}
9 |
10 | [[...]]
11 | ]]
12 |
13 | test Duplicate entity fails [[
14 | data
15 | [[u]] : User {}
16 | [[u]] : User {}
17 | ]] 2 errors at #1,#2
18 |
19 | test Resolve Identifier to entity [[
20 | data
21 | [[u]] : User {}
22 | execute
23 | [[u]]
24 | ]] resolve #2 to #1
25 |
26 | test Resolve invalid Identifier fails [[
27 | data
28 | u : User {}
29 | execute
30 | [[v]]
31 | ]] >= 1 error at #1
32 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/names/filter.spt:
--------------------------------------------------------------------------------
1 | module names-filter
2 |
3 | language icedust
4 |
5 | test Resolve find variable [[
6 | module test
7 | model
8 |
9 | entity Assignment {}
10 | entity Submission {}
11 | entity Student {}
12 |
13 | relation Assignment.parent ? <-> * Assignment.children
14 | relation Submission.student 1 <-> * Student.submissions
15 | relation Submission.assignment 1 <-> * Assignment.submissions
16 | relation Submission.parent ? =
17 | assignment.parent.submissions.find([[x]] => [[x]].student == student)
18 | <-> * Submission.children
19 | ]] resolve #2 to #1
20 |
21 | test Resolve filter variable [[
22 | module test
23 | model
24 |
25 | entity Assignment {}
26 | entity Submission {}
27 | entity Student {}
28 |
29 | relation Assignment.parent ? <-> * Assignment.children
30 | relation Submission.student 1 <-> * Student.submissions
31 | relation Submission.assignment 1 <-> * Assignment.submissions
32 | relation Submission.children * =
33 | assignment.children.submissions.filter([[x]] => [[x]].student == student)
34 | <-> ? Submission.parent
35 | ]] resolve #2 to #1
36 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/names/functions.spt:
--------------------------------------------------------------------------------
1 | module names-functions
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | [[...]]
8 | ]]
9 |
10 | test Error on duplicate function name [[
11 | functions
12 | [[test]]() : Int 1 = 5
13 | [[test]]() : Int 1 = 5
14 | ]] >= 1 errors at #1
15 | >= 1 errors at #2
16 |
17 | test Resolve function name [[
18 | functions
19 | [[test]]() : Int 1 = 5
20 | execute
21 | [[test]]()
22 | ]] resolve #2 to #1
23 |
24 | test Error on call to non existing function [[
25 | functions
26 | test() : Int 1 = 5
27 | execute
28 | [[foo()]]
29 | ]] >= 1 error at #1
30 |
31 | test Error on call with wrong number of arguments [[
32 | functions
33 | test() : Int 1 = 5
34 | execute
35 | test([[123]])
36 | ]] >= 1 error at #1
37 |
38 | test Error on call with wrong number of arguments 2 [[
39 | functions
40 | test(a: Int 1) : Int 1 = 5
41 | execute
42 | [[test()]]
43 | ]] >= 1 error at #1
44 |
45 | test Error on call with wrong type [[
46 | functions
47 | test(a: Int 1) : Int 1 = 5
48 | execute
49 | [[test(5.5)]]
50 | ]] >= 1 error at #1
51 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/names/inlining.spt:
--------------------------------------------------------------------------------
1 | module names-inlining
2 |
3 | language icedust
4 |
5 | test Error on overriding inline [[
6 | module test
7 | model
8 |
9 | entity Foo {
10 | a : Int = 42 (inline)
11 | }
12 |
13 | entity Bar extends Foo {
14 | [[a]] : Int = 21 * 2
15 | }
16 | ]] 1 error at #1
17 |
18 | test Error on overriding with inline [[
19 | module test
20 | model
21 |
22 | entity Foo {
23 | a : Int = 42
24 | }
25 |
26 | entity Bar extends Foo {
27 | [[a]] : Int = 21 * 2 (inline)
28 | }
29 | ]] 1 error at #1
30 |
31 | test Error on inline cycle [[
32 | module test
33 | model
34 |
35 | entity Foo {
36 | a : Int = 42
37 | [[b : Int = 5 + a + b (inline)]]
38 | }
39 |
40 | ]] >= 1 error at #1
41 |
42 | test Error on inline cycle 2 [[
43 | module test
44 | model
45 |
46 | entity Foo {
47 | [[a : Int = b (inline)]]
48 | [[b : Int = a (inline)]]
49 | }
50 |
51 | ]] >= 1 error at #1
52 | >= 1 error at #2
53 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/names/inverses.spt:
--------------------------------------------------------------------------------
1 | module names-inverses
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module inverses
7 |
8 | model
9 |
10 | entity Course{}
11 |
12 | [[...]]
13 | ]]
14 |
15 | test Resolve inverse [[
16 | entity Student{
17 | numCourses : Int = count(this.[[enrollments]])
18 | }
19 |
20 | relation Enrollment{
21 | Student.[[enrollments]] * -> student
22 | Course.enrollments + -> course
23 | }
24 | ]] resolve #1 to #2
25 |
26 | test Resolve invalid inverse fails [[
27 | entity Student{
28 | numCourses : Int = [[count(this.iDoNotExist)]]
29 | }
30 |
31 | relation Enrollment{
32 | Student.enrollments * -> student
33 | Course.enrollments + -> course
34 | }
35 | ]] >= 1 error at #1
36 |
37 | test error on duplicate inverse [[
38 | entity Node {}
39 | relation Edge {
40 | Node.[[edge]] 1 -> a
41 | Node.[[edge]] 1 -> b
42 | a.b <-> b.a
43 | }
44 | config
45 | language features : first-class relations
46 | ]] 2 errors at #1,#2
47 |
48 | test error on duplicate inverse by desugaring [[
49 | entity Node {}
50 | relation Edge {
51 | [[Node]] 1
52 | [[Node]] 1
53 |
54 | node.c <-> node.d
55 | }
56 | ]] >= 2 errors at #1,#2 // always also results in duplicate shorcuts
57 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/names/roles.spt:
--------------------------------------------------------------------------------
1 | module names-roles
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | [[...]]
9 | ]]
10 |
11 | test Duplicate role fails [[
12 | entity Node {
13 | }
14 | relation Edge{
15 | Node.x * -> [[in]]
16 | Node * -> [[in]]
17 |
18 | in.c <-> in.d
19 | }
20 | ]] >= 2 errors at #1,#2
21 |
22 | test Resolve role [[
23 | entity Node {
24 | name : String = concat(this.in.[[out]].name)
25 | }
26 | relation Edge{
27 | Node.in + -> in
28 | Node.out * -> [[out]]
29 | in.a <-> out.b
30 | }
31 | ]] resolve #1 to #2
32 |
33 | test Resolve inverse [[
34 | entity Node {
35 | name : String = concat(this.[[in]].out.name)
36 | }
37 | relation Edge{
38 | Node.[[in]] + -> in
39 | Node.out * -> out
40 | in.a <-> out.b
41 | }
42 | ]] resolve #1 to #2
43 |
44 | test error on duplicate role [[
45 | entity Node {}
46 | relation Edge {
47 | Node.a 1 -> [[node]]
48 | Node.b 1 -> [[node]]
49 |
50 | node.[[c]] <-> node.[[d]]
51 | }
52 | ]] >= 2 errors at #1, #2
53 |
54 | test error on duplicate role by desugaring [[
55 | entity Node {}
56 | relation Edge {
57 | [[Node]] 1
58 | [[Node]] 1
59 |
60 | node.c <-> node.d
61 | }
62 | ]] >= 2 errors at #1, #2
63 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/names/shortcutrel.spt:
--------------------------------------------------------------------------------
1 | module names-shortcutrel
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | [[...]]
8 | ]]
9 |
10 | test Resolve to shortcut [[
11 | model
12 |
13 | entity Node{
14 |
15 | }
16 |
17 | relation Node.[[parent]] ? <-> * Node.children {
18 | weight : Int
19 | }
20 |
21 | data
22 |
23 | node1 : Node {}
24 |
25 | execute
26 |
27 | node1.[[parent]]
28 | ]] resolve #2 to #1
29 |
30 | test Resolve invalid role in shortcut fails [[
31 | model
32 |
33 | entity Node{
34 |
35 | }
36 |
37 | relation Node.parent ? <-> * Node.children {
38 | weight : Int
39 | }
40 |
41 | data
42 |
43 | node1 : Node {}
44 |
45 | execute
46 |
47 | [[node1.iDoNotExist]]
48 | ]] >= 1 error at #1
49 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/names/traits/concat.spt:
--------------------------------------------------------------------------------
1 | module names-traits-concat
2 |
3 | language icedust
4 |
5 | test resolve concat super type derefence [[
6 | module test
7 | model
8 |
9 | entity Assignment {
10 | [[grade]] : Float?
11 | }
12 |
13 | entity LeafAssignment extends Assignment {
14 | grade : Float?
15 | }
16 |
17 | entity CollectionAssignment extends Assignment {
18 | grade : Float? = avg(children.grade)
19 | }
20 |
21 | relation CollectionAssignment.children * <-> ? Assignment.parent
22 |
23 | entity Foo {
24 | grade : Float? = avg((collections ++ leaves).[[grade]])
25 | }
26 | relation Foo.collections <-> CollectionAssignment.foos
27 | relation Foo.leaves <-> LeafAssignment.foos
28 | ]] resolve #2 to #1
29 |
30 |
31 | test resolve concat super type not root derefence [[
32 | module test
33 | model
34 |
35 | entity HasGrade {
36 | grade : Float?
37 | }
38 |
39 | entity Assignment extends HasGrade {
40 | [[grade]] : Float?
41 | }
42 |
43 | entity LeafAssignment extends Assignment {
44 | grade : Float?
45 | }
46 |
47 | entity CollectionAssignment extends Assignment {
48 | grade : Float? = avg(children.grade)
49 | }
50 |
51 | relation CollectionAssignment.children * <-> ? Assignment.parent
52 |
53 | entity Foo {
54 | grade : Float? = avg((collections ++ leaves).[[grade]])
55 | }
56 | relation Foo.collections <-> CollectionAssignment.foos
57 | relation Foo.leaves <-> LeafAssignment.foos
58 | ]] resolve #2 to #1
59 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/names/traits/cycle.spt:
--------------------------------------------------------------------------------
1 | module names-traits-cycle
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | [[...]]
9 | ]]
10 |
11 | test error on cyclic traits [[
12 | entity Foo extends Bar {
13 |
14 | }
15 |
16 | entity Bar extends Foo {
17 |
18 | }
19 | ]] >= 1 error
20 |
21 | test no error on acyclic traits [[
22 | entity Foo extends Bar {
23 | }
24 |
25 | entity Bar {
26 | }
27 | ]] 0 errors
28 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/names/traits/filtertype.spt:
--------------------------------------------------------------------------------
1 | module names-traits-filtertype
2 |
3 | language icedust
4 |
5 | test resolve filter type expression member access [[
6 | module test
7 | model
8 |
9 | entity Assignment {
10 | grade : Float?
11 | a : Float? = this.filter(:CollectionAssignment).[[grade]]
12 | }
13 |
14 | entity LeafAssignment extends Assignment {
15 |
16 | }
17 |
18 | entity CollectionAssignment extends Assignment {
19 | [[grade]] : Float? = avg(children.grade)
20 | }
21 |
22 | relation CollectionAssignment.children * <-> ? Assignment.parent
23 | ]] resolve #1 to #2
24 |
25 | test resolve filter type [[
26 | module test
27 | model
28 |
29 | entity Assignment {
30 | grade : Float?
31 | a : Float? = this.filter(:[[CollectionAssignment]]).grade
32 | }
33 |
34 | entity LeafAssignment extends Assignment {
35 |
36 | }
37 |
38 | entity [[CollectionAssignment]] extends Assignment {
39 | grade : Float? = avg(children.grade)
40 | }
41 |
42 | relation CollectionAssignment.children * <-> ? Assignment.parent
43 | ]] resolve #1 to #2
44 |
45 | test resolve filter type 2 [[
46 | module test
47 | model
48 |
49 | entity Assignment {
50 | }
51 |
52 | entity LeafAssignment extends Assignment {
53 | }
54 |
55 | entity [[CollectionAssignment]] extends Assignment {
56 | }
57 |
58 | relation CollectionAssignment.children * <-> ? Assignment.parent
59 |
60 | relation Assignment.root 1 = parent.root.filter(:[[CollectionAssignment]]) <+ this <-> Assignment
61 |
62 | ]] resolve #2 to #1
63 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/names/traits/members-multiple.spt:
--------------------------------------------------------------------------------
1 | module names-traits-members-multiple
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | [[...]]
9 | ]]
10 |
11 | //test error on duplicate attributes in multiple parents [[ //test disabled: only supporting single inheritance for now
12 | // trait HasName {
13 | // name : String
14 | // }
15 | //
16 | // trait Foo{
17 | // name : String
18 | // }
19 | //
20 | // entity Bar [[extends HasName, Foo]]{
21 | //
22 | // }
23 | //]] >= 1 errors at #1
24 | //
25 | //test no error on non conflicting multiple parents [[ //test disabled: only supporting single inheritance for now
26 | // trait HasName {
27 | // name : String
28 | // }
29 | //
30 | // trait HasSize{
31 | // size : Int
32 | // }
33 | //
34 | // entity Bar extends HasName, HasSize{
35 | //
36 | // }
37 | //]] 0 errors
38 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/names/traits/members.spt:
--------------------------------------------------------------------------------
1 | module names-traits-members
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | [[...]]
9 | ]]
10 |
11 | test resolve attribute subtype [[
12 | entity Assignment {
13 | [[name]] : String
14 | }
15 |
16 | entity AssignmentCollection extends Assignment {
17 | bla : String = [[name]]
18 | }
19 | ]] resolve #2 to #1
20 |
21 | test unresolved member error [[
22 | entity Assignment {
23 | }
24 |
25 | entity AssignmentCollection extends Assignment {
26 | bla : String = [[name]]
27 | }
28 | ]] >= 1 error at #1
29 |
30 | test resolve attribute subsubtype [[
31 | entity HasName {
32 | [[name]] : String
33 | }
34 |
35 | entity Assignment extends HasName {
36 | }
37 |
38 | entity AssignmentCollection extends Assignment {
39 | bla : String = [[name]]
40 | }
41 | ]] resolve #2 to #1
42 |
43 | test resolve relation subtype [[
44 | entity Photo{
45 | name : String
46 | }
47 |
48 | entity HasPhoto{}
49 |
50 | relation HasPhoto.[[photo]] 1 <-> Photo
51 |
52 | entity Page extends HasPhoto {
53 | photoName : String = [[photo]].name
54 | }
55 | ]] resolve #2 to #1
56 |
57 | test resolve relation attribute subtype [[
58 | entity Photo{
59 | [[name]] : String
60 | }
61 |
62 | entity HasPhoto{}
63 |
64 | relation HasPhoto 1 <-> Photo
65 |
66 | entity Page extends HasPhoto {
67 | photoName : String = photo.[[name]]
68 | }
69 | ]] resolve #2 to #1
70 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/names/traits/parents-multiple.spt:
--------------------------------------------------------------------------------
1 | module names-traits-parents-multiple
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | [[...]]
9 | ]]
10 |
11 | //test resolve parent multiple [[ //test disabled: only supporting single inheritance for now
12 | // trait [[Assignment]] {
13 | // }
14 | //
15 | // entity AssignmentCollection extends [[Assignment]], Foo {
16 | // }
17 | //
18 | // trait Foo{}
19 | //]] resolve #2 to #1
20 | //
21 | //test error on conflicting trait imports shadowed [[ //test disabled: only supporting single inheritance for now
22 | //model
23 | //
24 | // trait Named {
25 | // name : String
26 | // }
27 | //
28 | // trait HasName {
29 | // name : String
30 | // }
31 | //
32 | // entity Foo [[extends Named, HasName]] {
33 | // name : String
34 | // }
35 | //]] >= 1 error at #1
36 | //
37 | //test error on conflicting trait imports not shadowed [[ //test disabled: only supporting single inheritance for now
38 | //model
39 | //
40 | // trait Named {
41 | // name : String
42 | // }
43 | //
44 | // trait HasName {
45 | // name : String
46 | // }
47 | //
48 | // entity Foo extends Named, HasName {
49 | // }
50 | //]] >= 1 error
51 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/names/traits/parents.spt:
--------------------------------------------------------------------------------
1 | module names-traits-parents
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | [[...]]
9 | ]]
10 |
11 | test resolve parent [[
12 | entity [[Assignment]] {
13 | }
14 |
15 | entity AssignmentCollection extends [[Assignment]] {
16 | }
17 | ]] resolve #2 to #1
18 |
19 | test unresolved parent error [[
20 | entity Assignment {
21 | }
22 |
23 | entity AssignmentCollection [[extends Foo]] {
24 | }
25 | ]] >= 1 error at #1
26 |
27 | //test error on extending non-trait [[
28 | // entity Assignment {
29 | // }
30 | //
31 | // entity AssignmentCollection extends Assignment {
32 | // }
33 | //]] >= 1 error
34 | //
35 | //test no error on extending trait [[
36 | // trait Assignment {
37 | // }
38 | //
39 | // entity AssignmentCollection extends Assignment {
40 | // }
41 | //]] 0 errors
42 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/prettyprint/program1.spt:
--------------------------------------------------------------------------------
1 | module prettyprint-program1
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module [[...]]
7 |
8 | config
9 |
10 | language features : first-class relations
11 |
12 | model
13 | entity Foo {
14 | i : Int ?
15 | a : Int = i <+ 0
16 | }
17 | entity Bar {}
18 | entity Baz {}
19 | relation Bar.baz <-> Baz.bar
20 | data
21 | foo:Foo{}
22 | bar:Bar{
23 | baz=baz{}
24 | }
25 | execute
26 | foo.a
27 | 1+1
28 | ]]
29 |
30 | test pretty printer not crashing [[test]] transform "Syntax -> Format" to
31 | "module test
32 |
33 | config
34 |
35 | language features : first-class relations
36 |
37 | model
38 |
39 | entity Foo {
40 | i : Int?
41 | a : Int = i <+ 0
42 | }
43 |
44 | entity Bar {
45 | }
46 |
47 | entity Baz {
48 | }
49 |
50 | relation Bar.baz <-> Baz.bar
51 |
52 | data
53 |
54 | foo : Foo { }
55 | bar : Bar {
56 | baz =
57 | baz {
58 | }
59 | }
60 |
61 | execute
62 |
63 | foo.a
64 | 1 + 1
65 | "
66 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/syntax/data.spt:
--------------------------------------------------------------------------------
1 | module syntax-data
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 |
8 | model
9 | entity User{
10 | name : String
11 | }
12 | entity Post{
13 | title: String
14 | body : String
15 | }
16 | relation UserPost{
17 | User *
18 | Post 1
19 | }
20 |
21 | data
22 |
23 | [[...]]
24 | ]]
25 |
26 | test Blog data [[
27 | alice : User{
28 | name = "Alice"
29 | }
30 | bob : User{
31 | name = "Bob"
32 | post =
33 | p1 : Post{
34 | title="First Post"
35 | body="Some text"
36 | }
37 | }
38 | ]] parse succeeds
39 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/syntax/literals-layout.spt:
--------------------------------------------------------------------------------
1 | module literals-layout
2 |
3 |
4 | language icedust
5 |
6 | fixture [[
7 | module test
8 |
9 | execute
10 |
11 | 3
12 | [[...]]
13 | ]]
14 |
15 | test literal String whitespace [[" Asdf "]] parse to LitString(" Asdf ")
16 |
17 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/types/casts.spt:
--------------------------------------------------------------------------------
1 | module types-logic
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | execute
8 | 3
9 | [[...]]
10 | ]]
11 |
12 | test type of as Float [[5 as Float ]] run get-type2 to Float()
13 | test type of as Int [[5.0 as Int ]] run get-type2 to Int()
14 | test type of as String[[5.0 as String]] run get-type2 to String()
15 |
16 | test error on cast to same type [[ [[5 as Int]] ]] 1 error at #1
17 | test error on cast to boolean [[ [[5 as Boolean]] ]] 1 error at #1
18 |
19 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/types/collections.spt:
--------------------------------------------------------------------------------
1 | module collections
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module collections
7 |
8 | model
9 | entity A {
10 | s: String
11 | i: Int
12 | b: Boolean
13 | }
14 |
15 | relation A.aa * <-> A.a
16 |
17 | data
18 | a1: A{
19 | s = "s"
20 | i = 42
21 | b = false
22 | }
23 | execute
24 | [[...]]
25 | ]]
26 |
27 | test multiplicity of first OneOrMore [[ [[a1]].first() ]] 1 warning at #1
28 | test multiplicity of first(n) OneOrMore [[ [[a1]].first(0) ]] 1 warning at #1
29 | test multiplicity of first ZeroOrMore [[ a1.aa.first() ]] run get-multiplicity to ZeroOrOne()
30 | test multiplicity of first(2) ZeroOrMore [[ a1.aa.first(2) ]] run get-multiplicity to ZeroOrMore()
31 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/types/data2.spt:
--------------------------------------------------------------------------------
1 | module types-data2
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | [[...]]
8 | ]]
9 |
10 | test no errors on within multiplicity bounds [[
11 | model
12 |
13 | entity Foo{}
14 | entity Bar{}
15 | relation Foo 1 <-> + Bar
16 |
17 | data
18 |
19 | bar:Bar{}
20 | foo1:Foo{bar=bar}
21 | foo2:Foo{bar=bar}
22 | foo3:Foo{bar=bar}
23 | ]] 0 errors
24 |
25 | test error on violating multiplicity bounds with inverse assignments [[
26 | model
27 |
28 | entity Foo{}
29 | entity Bar{}
30 | relation Foo 1 <-> ? Bar
31 |
32 | data
33 |
34 | [[bar]]:Bar{}
35 | foo1:Foo{bar=bar}
36 | foo2:Foo{bar=bar}
37 | foo3:Foo{bar=bar}
38 | ]] 1 error at #1
39 |
40 | test no error on omitting derived relation [[
41 | model
42 |
43 | entity Node {
44 | }
45 |
46 | relation Node.parent ? <-> Node.children
47 |
48 | relation Node.root 1 = parent.root <+ this <-> Node
49 |
50 | data
51 |
52 | node1:Node {
53 |
54 | }
55 | ]] 0 errors
56 |
57 | test error on omitting non-derived relation [[
58 | model
59 |
60 | entity Node {
61 | }
62 |
63 | relation Node.parent ? <-> Node.children
64 |
65 | relation Node.root 1 <-> Node
66 |
67 | data
68 |
69 | [[node1]]:Node {
70 |
71 | }
72 | ]] >=1 error at #1
73 |
74 | test error on supplying derived relation [[
75 | model
76 |
77 | entity Node {
78 | }
79 |
80 | relation Node.parent ? <-> Node.children
81 |
82 | relation Node.root 1 = parent.root <+ this <-> Node
83 |
84 | data
85 |
86 | node1:Node {
87 | [[root]] = node1
88 | }
89 | ]] >=1 error at #1
90 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/types/literals.spt:
--------------------------------------------------------------------------------
1 | module types-literals
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | data
9 | execute
10 | 3
11 | [[...]]
12 | ]]
13 |
14 | test type of Literal Int [[1]] run get-type2 to Int()
15 | test type of Literal Float [[1.4]] run get-type2 to Float()
16 | test type of literal String [["Asdf"]] run get-type2 to String()
17 | test type of literal Datetime [[2015-01-01 0:00:00]] run get-type2 to Datetime()
18 | test type of literal Datetime2[[2015-12-31 23:59:59]] run get-type2 to Datetime()
19 | test type of literal No Value [[no value]] run get-type2 to NoValue()
20 |
21 | test multiplicity of Literal Int [[1]] run get-multiplicity to One()
22 | test multiplicity of literal String [["Asdf"]] run get-multiplicity to One()
23 | test multiplicity of literal No Value [[no value]] run get-multiplicity to ZeroOrOne() //there is no Zero representation
24 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/types/references-entities.spt:
--------------------------------------------------------------------------------
1 | module types-references-entities
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | [[...]]
8 | ]]
9 |
10 |
11 | test type of ref entity this [[
12 | model
13 | entity X{
14 | i : Int = [[this]].i (default)
15 | }
16 |
17 | data
18 | x : X {
19 | i=8
20 | }
21 | ]] run get-type2 on #1 to "X"
22 |
23 | test type of ref entity Identifier [[
24 | model
25 | entity X{
26 | i : Int
27 | }
28 |
29 | data
30 | x : X {
31 | i=6
32 | }
33 |
34 | execute
35 | [[x]].i
36 | ]] run get-type2 on #1 to "X"
37 |
38 |
39 | test multiplicity of ref this [[
40 | model
41 | entity X{
42 | i : Int = [[this]].i (default)
43 | }
44 |
45 | data
46 | x : X {
47 | i=8
48 | }
49 | ]] run get-multiplicity on #1 to One()
50 |
51 | test multiplicity of ref entity Identifier [[
52 | model
53 | entity X{
54 | i : Int
55 | }
56 |
57 | data
58 | x : X {
59 | i=5
60 | }
61 |
62 | execute
63 | 4
64 | [[x]].i
65 | ]] run get-multiplicity on #1 to One()
66 |
67 |
68 | test ordering of ref this [[
69 | model
70 | entity X{
71 | i : Int = [[this]].i (default)
72 | }
73 |
74 | data
75 | x : X {
76 | i=8
77 | }
78 | ]] run get-multiplicity on #1 to One() // is ordered
79 |
80 | test ordering of ref entity Identifier [[
81 | model
82 | entity X{
83 | i : Int = 55 (default)
84 | }
85 |
86 | data
87 | x : X {
88 | i=5
89 | }
90 |
91 | execute
92 | 4
93 | [[x]].i
94 | ]] run get-multiplicity on #1 to One() // is ordered
95 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/types/references-relations.spt:
--------------------------------------------------------------------------------
1 | module types-references-relations
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | entity Node{}
9 | relation Node.maybe ? <-> 1 Node.one
10 | relation Node.star * <-> + (ordered) Node.plus
11 | data
12 | n : Node {
13 | maybe = n2 { }
14 | star = n2
15 | one = n2
16 | plus = n2
17 | }
18 | execute
19 | 3
20 | [[...]]
21 | ]]
22 |
23 | test type of relation [[n.maybe]] run get-type2 to "Node"
24 | test type of relation relation [[n.maybe.one]] run get-type2 to "Node"
25 | test type of relation relation relation [[n.maybe.one.star]] run get-type2 to "Node"
26 |
27 | test multiplicity of relation ZeroOrOne [[n.maybe]] run get-multiplicity to ZeroOrOne()
28 | test multiplicity of relation One [[n.one]] run get-multiplicity to One()
29 | test multiplicity of relation ZeroOrMore [[n.star]] run get-multiplicity to ZeroOrMore()
30 | test multiplicity of relation OneOrMore [[n.plus]] run get-multiplicity to OneOrMoreOrdered()
31 |
32 | test multiplicity of relation relation ZeroOrOne [[n.maybe.maybe]] run get-multiplicity to ZeroOrOne()
33 | test multiplicity of relation relation ZeroOrOne 2 [[n.maybe.one]] run get-multiplicity to ZeroOrOne()
34 |
35 | test ordering of relation Unordered [[n.star]] run get-multiplicity to ZeroOrMore() // is unordered
36 | test ordering of relation Ordered [[n.plus]] run get-multiplicity to OneOrMoreOrdered() // is ordered
37 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/types/references-this.spt:
--------------------------------------------------------------------------------
1 | module types-references-this
2 |
3 | language icedust
4 |
5 | test type error on this [[
6 | module debug
7 |
8 | model
9 |
10 | entity Z{
11 | b : Boolean
12 | d : Boolean = [[this]]
13 | }
14 | ]] 1 error at #1
15 |
16 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/types/strategy-composition-assignments.spt:
--------------------------------------------------------------------------------
1 | module types-strategy-composition-assignments
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 |
8 | config
9 |
10 | backend : WebDSL
11 |
12 | [[...]]
13 | ]]
14 |
15 | test error on assign on-demand to incremenal [[
16 | model
17 |
18 | entity Foo{
19 | i : Int
20 | j : Int = i * 500 (on-demand)
21 | k : Int = [[j + 9]] (incremental)
22 | }
23 | ]] 1 error at #1
24 |
25 | test error on assign eventual to incremenal [[
26 | model
27 |
28 | entity Foo{
29 | i : Int
30 | j : Int = i * 500 (eventual)
31 | k : Int = [[j + 9]] (incremental)
32 | }
33 | ]] 1 error at #1
34 |
35 | test error on assign eventual to on-demand [[
36 | model
37 |
38 | entity Foo{
39 | i : Int
40 | j : Int = i * 500 (eventual)
41 | k : Int = [[j + 9]] (on-demand)
42 | }
43 | ]] 1 error at #1
44 |
45 | test no error on assign eventual to on-demand eventual [[
46 | model
47 |
48 | entity Foo{
49 | i : Int
50 | j : Int = i * 500 (eventual)
51 | k : Int = j + 9 (on-demand eventual)
52 | }
53 | ]] 0 errors
54 |
55 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/types/strategy-composition.spt:
--------------------------------------------------------------------------------
1 | module types-strategy-composition
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 | model
8 | entity X{
9 | a : Int
10 | b : Int = a (on-demand)
11 | c : Int = a (incremental)
12 | d : Int = a (eventual)
13 | e : Int = a + b + c + d (on-demand eventual)
14 | f : Int = [[...]] (on-demand eventual)
15 | }
16 | data
17 | x : X {
18 | a = 5
19 | }
20 | execute
21 | 3
22 | ]]
23 |
24 | test calculation strategy of base-value field [[a]] run get-strategy to Incremental()
25 | test calculation strategy of on-demand field [[b]] run get-strategy to OnDemand()
26 | test calculation strategy of incremental field [[c]] run get-strategy to Incremental()
27 | test calculation strategy of eventual field [[d]] run get-strategy to Eventual()
28 | test calculation strategy of on-demand eventual field [[e]] run get-strategy to OnDemandEventual()
29 |
30 | test base-value and on-demand [[a + b]] run get-strategy to OnDemand()
31 | test base-value and incremental [[a * c]] run get-strategy to Incremental()
32 | test base-value and eventual [[a - d]] run get-strategy to Eventual()
33 | test on-demand and eventual [[b + d]] run get-strategy to OnDemandEventual()
34 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/types/stringinterpolation.spt:
--------------------------------------------------------------------------------
1 | module types-stringinterpolation
2 |
3 | language icedust
4 |
5 | fixture [[
6 | module test
7 |
8 | execute
9 | 3
10 | [[...]]
11 | ]]
12 |
13 | test type of string interpolation 1 [["${1 + 2}"]] run get-type2 to String()
14 | test type of string interpolation 2 [["${1 ++ 2}"]] run get-type2 to String()
15 | test type of string interpolation 3 [["${"hello" ++ "world"}"]] run get-type2 to String()
16 |
17 | test type of nested string interpolation [["${"hello" ++ "world ${4 + 6}"} asdf ${true} and some ${"${"${"super nested thing"}"}"}"]] run get-type2 to String()
18 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/types/traits/concat.spt:
--------------------------------------------------------------------------------
1 | module names-traits-concat
2 |
3 | language icedust
4 |
5 | test resolve concat super type derefence [[
6 | module test
7 | model
8 |
9 | entity Assignment {
10 | grade : Float?
11 | }
12 |
13 | entity LeafAssignment extends Assignment {
14 | grade : Float?
15 | }
16 |
17 | entity CollectionAssignment extends Assignment {
18 | grade : Float? = avg(children.grade)
19 | }
20 |
21 | relation CollectionAssignment.children * <-> ? Assignment.parent
22 |
23 | entity Foo {
24 | grade : Float? = avg([[(collections ++ leaves)]].grade)
25 | }
26 | relation Foo.collections <-> CollectionAssignment.foos
27 | relation Foo.leaves <-> LeafAssignment.foos
28 | ]] run get-type2 on #1 to "Assignment"
29 |
30 |
31 | test resolve concat super type not root derefence [[
32 | module test
33 | model
34 |
35 | entity HasGrade {
36 | grade : Float?
37 | }
38 |
39 | entity Assignment extends HasGrade {
40 | grade : Float?
41 | }
42 |
43 | entity LeafAssignment extends Assignment {
44 | grade : Float?
45 | }
46 |
47 | entity CollectionAssignment extends Assignment {
48 | grade : Float? = avg(children.grade)
49 | }
50 |
51 | relation CollectionAssignment.children * <-> ? Assignment.parent
52 |
53 | entity Foo {
54 | grade : Float? = avg([[(collections ++ leaves)]].grade)
55 | }
56 | relation Foo.collections <-> CollectionAssignment.foos
57 | relation Foo.leaves <-> LeafAssignment.foos
58 | ]] run get-type2 on #1 to "Assignment"
59 |
--------------------------------------------------------------------------------
/icedust.test/static-semantics/types/traits/filtertype.spt:
--------------------------------------------------------------------------------
1 | module types-traits-filtertype
2 |
3 | language icedust
4 |
5 | test resolve filter type [[
6 | module test
7 | model
8 |
9 | entity Assignment {
10 | grade : Float?
11 | a : Float? = [[this.filter(:CollectionAssignment)]].grade
12 | }
13 |
14 | entity LeafAssignment extends Assignment {
15 |
16 | }
17 |
18 | entity CollectionAssignment extends Assignment {
19 | grade : Float? = avg(children.grade)
20 | }
21 |
22 | relation CollectionAssignment.children * <-> ? Assignment.parent
23 | ]] run get-type2 on #1 to "CollectionAssignment"
24 |
--------------------------------------------------------------------------------
/icedust/.gitignore:
--------------------------------------------------------------------------------
1 | /.cache
2 | /bin
3 | /src-gen
4 | /target
5 |
6 | /.classpath
7 | /.project
8 | /.settings
9 |
--------------------------------------------------------------------------------
/icedust/.mvn/extensions.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | org.metaborg
5 | spoofax-maven-plugin-pomless
6 | 2.4.0
7 |
8 |
9 |
--------------------------------------------------------------------------------
/icedust/.mvn/jvm.config:
--------------------------------------------------------------------------------
1 | -Xmx2G -Xss16m
2 |
--------------------------------------------------------------------------------
/icedust/.mvn/maven.config:
--------------------------------------------------------------------------------
1 | --global-settings .mvn/settings.xml
2 |
--------------------------------------------------------------------------------
/icedust/editor/Analysis.esv:
--------------------------------------------------------------------------------
1 | module Analysis
2 |
3 | imports
4 |
5 | nabl2/Menus
6 |
7 | language
8 |
9 | observer : editor-analyze (constraint)
10 |
11 | references
12 |
13 | reference _ : editor-resolve
14 | hover _ : editor-hover
15 |
--------------------------------------------------------------------------------
/icedust/editor/Colorer.esv:
--------------------------------------------------------------------------------
1 | module Colorer
2 |
3 | colorer Entity and Role namespaces
4 |
5 | // _.Entity : 0 64 128 italic bold //how to only color the name?
6 | _.EntityType: 0 64 128 italic bold
7 | _.MemberValue: 0 64 128 italic
8 |
9 | colorer Multiplicity
10 |
11 | Multiplicity : 160 0 0 bold
12 | MultiplicityOrdering: 160 0 0 bold
13 |
14 | colorer Primitive types
15 |
16 | _.LitString: 0 0 255
17 |
18 | colorer built-in functions
19 |
20 | BuiltInFunction : 127 0 85 bold
21 |
22 | colorer strategies
23 |
24 | Strategy : 127 127 127
25 |
26 | colorer Default, token-based highlighting
27 |
28 | keyword : 127 0 85 bold
29 | identifier : default
30 | string : blue
31 | number : darkgreen
32 | var : 255 0 100 italic
33 | operator : 0 0 128
34 | layout : 63 127 95 italic
35 |
36 | colorer System colors
37 |
38 | darkred = 128 0 0
39 | red = 255 0 0
40 | darkgreen = 0 128 0
41 | green = 0 255 0
42 | darkblue = 0 0 128
43 | blue = 0 0 255
44 | cyan = 0 255 255
45 | magenta = 255 0 255
46 | yellow = 255 255 0
47 | white = 255 255 255
48 | black = 0 0 0
49 | gray = 128 128 128
50 | grey = gray
51 | orange = 255 165 0
52 | pink = 255 105 180
53 | brown = 139 69 19
54 | default = _
55 |
56 |
--------------------------------------------------------------------------------
/icedust/editor/Main.esv:
--------------------------------------------------------------------------------
1 | module Main
2 |
3 | imports
4 |
5 | Syntax
6 | Analysis
7 | Colorer
8 | Menus
9 |
10 | language
11 |
12 | extensions : ice
13 |
14 | provider : target/metaborg/stratego.ctree
15 | provider : target/metaborg/stratego-javastrat.jar
16 | provider : lib-js/nashorn.jar
--------------------------------------------------------------------------------
/icedust/editor/Syntax.esv:
--------------------------------------------------------------------------------
1 | module Syntax
2 |
3 | imports
4 |
5 | completion/colorer/icedust-cc-esv
6 |
7 | language
8 |
9 | table : target/metaborg/sdf.tbl
10 | start symbols : Start
11 |
12 | line comment : "//"
13 | block comment : "/*" * "*/"
14 | fences : [ ] ( ) { }
15 |
16 | menus
17 |
18 | menu: "Syntax" (openeditor)
19 |
20 | action: "Format" = editor-format (source)
21 | action: "Show parsed AST" = debug-show-aterm (source)
22 | action: "Show desugared AST" = debug-show-desugared (source)
23 | action: "Show desugared prettyprint" = debug-show-desugared-pp (source)
24 |
25 |
26 | menu: "Debug"
27 |
28 | action: "debug-get-ast-value" = debug-get-ast-value
29 | action: "Count entities, attributes, relations, and functions" = debug-count-constructs (openeditor)
30 |
31 | views
32 |
33 | outline view: editor-outline (source)
34 | expand to level: 3
35 |
--------------------------------------------------------------------------------
/icedust/icons/arrow-blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/arrow-blue.png
--------------------------------------------------------------------------------
/icedust/icons/arrowleft-red.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/arrowleft-red.gif
--------------------------------------------------------------------------------
/icedust/icons/arrowleft-red.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/arrowleft-red.graffle
--------------------------------------------------------------------------------
/icedust/icons/arrowleftright-red.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/arrowleftright-red.gif
--------------------------------------------------------------------------------
/icedust/icons/arrowleftright-red.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/arrowleftright-red.graffle
--------------------------------------------------------------------------------
/icedust/icons/arrowright-red.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/arrowright-red.gif
--------------------------------------------------------------------------------
/icedust/icons/arrowright-red.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/arrowright-red.graffle
--------------------------------------------------------------------------------
/icedust/icons/circle-green.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/circle-green.png
--------------------------------------------------------------------------------
/icedust/icons/data.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/data.png
--------------------------------------------------------------------------------
/icedust/icons/diamond-yellow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/diamond-yellow.png
--------------------------------------------------------------------------------
/icedust/icons/execute.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/execute.png
--------------------------------------------------------------------------------
/icedust/icons/icedust-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/icedust-32x32.png
--------------------------------------------------------------------------------
/icedust/icons/icedust-48x48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/icedust-48x48.png
--------------------------------------------------------------------------------
/icedust/icons/icedust-640x640.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/icedust-640x640.png
--------------------------------------------------------------------------------
/icedust/icons/icedust-64x64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/icedust-64x64.png
--------------------------------------------------------------------------------
/icedust/icons/icedust.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/icedust.graffle
--------------------------------------------------------------------------------
/icedust/icons/icedust.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/icedust.pdf
--------------------------------------------------------------------------------
/icedust/icons/icedust.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/icedust.png
--------------------------------------------------------------------------------
/icedust/icons/model.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/model.png
--------------------------------------------------------------------------------
/icedust/icons/module.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/module.png
--------------------------------------------------------------------------------
/icedust/icons/page-arrow-white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/page-arrow-white.png
--------------------------------------------------------------------------------
/icedust/icons/square-gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/square-gray.png
--------------------------------------------------------------------------------
/icedust/icons/square-red.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/square-red.png
--------------------------------------------------------------------------------
/icedust/icons/triangle-blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/icons/triangle-blue.png
--------------------------------------------------------------------------------
/icedust/lib-js/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 |
--------------------------------------------------------------------------------
/icedust/lib-js/dependencies/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 |
--------------------------------------------------------------------------------
/icedust/lib-js/dependencies/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "icedust-runner",
3 | "version": "0.1.0",
4 | "description": "",
5 | "scripts": {
6 | "build": "webpack --progress --colors"
7 | },
8 | "author": "besuikerd",
9 | "license": "ISC",
10 | "dependencies": {
11 | "immutable": "4.0.0-rc.2",
12 | "jsface": "2.4.9",
13 | "lodash": "4.17.4",
14 | "moment": "2.18.1",
15 | "prop-types": "15.5.10",
16 | "react": "15.6.1",
17 | "react-dom": "15.6.1",
18 | "redux": "3.6.0"
19 | },
20 | "devDependencies": {
21 | "expose-loader": "0.7.3",
22 | "webpack": "3.0.0"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/icedust/lib-js/dependencies/src/index.js:
--------------------------------------------------------------------------------
1 | module.exports['immutable'] = require('immutable');
2 | module.exports['jsface'] = require('jsface');
3 | module.exports['lodash'] = require('lodash');
4 | module.exports['moment'] = require('moment');
5 | module.exports['prop-types'] = require('prop-types');
6 | module.exports['react'] = require('react');
7 | module.exports['react-dom'] = require('react-dom');
8 | module.exports['react-dom-server'] = require('react-dom/server');
9 | module.exports['redux'] = require('redux');
--------------------------------------------------------------------------------
/icedust/lib-js/dependencies/webpack.config.js:
--------------------------------------------------------------------------------
1 | var path = require('path');
2 | var webpack = require('webpack');
3 |
4 | module.exports = {
5 |
6 | entry: {
7 | libraries: 'index'
8 | },
9 | output: {
10 | libraryTarget: 'commonjs2',
11 | path: path.join(__dirname, 'target'),
12 | filename: '[name].generated.js'
13 | },
14 | devtool: 'inline-source-map',
15 | resolve: {
16 | modules: [
17 | "node_modules",
18 | path.join(__dirname, 'src')
19 | ]
20 | },
21 |
22 | plugins: [
23 | // new webpack.optimize.UglifyJsPlugin({
24 | // compress: {
25 | // warnings: false,
26 | // drop_console: false
27 | // }
28 | // }),
29 | // new webpack.DefinePlugin({
30 | // 'process.env.NODE_ENV': '"production"'
31 | // })
32 | ]
33 | };
--------------------------------------------------------------------------------
/icedust/lib-js/nashorn.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/lib-js/nashorn.jar
--------------------------------------------------------------------------------
/icedust/lib-js/src/nashorn-polyfill.js:
--------------------------------------------------------------------------------
1 | console = {
2 | log: print,
3 | warn: print,
4 | error: print
5 | };
6 |
7 | process = {
8 | env: {
9 | NODE_ENV:'production'
10 | }
11 | };
--------------------------------------------------------------------------------
/icedust/lib-js/src/runtime/constants.js:
--------------------------------------------------------------------------------
1 | var EMPTY_ARRAY = [];
2 | var EMPTY_OBJECT = {};
3 |
4 | module.exports = {
5 | EMPTY_ARRAY: EMPTY_ARRAY,
6 | EMPTY_OBEJCT: EMPTY_OBJECT
7 | };
--------------------------------------------------------------------------------
/icedust/lib-js/src/runtime/lib/functions.js:
--------------------------------------------------------------------------------
1 | function tryRenameFunctionName(fn, name){
2 | var descriptor = Object.getOwnPropertyDescriptor(fn, 'name');
3 | if(descriptor.configurable){
4 | Object.defineProperty(fn, 'name', {value: name});
5 | }
6 | }
7 |
8 | module.exports = {
9 | tryRenameFunctionName: tryRenameFunctionName
10 | };
--------------------------------------------------------------------------------
/icedust/lib-js/src/runtime/loadModule.js:
--------------------------------------------------------------------------------
1 | function loadModule(program){
2 | var scope = {
3 | exports: {}
4 | };
5 | program(require, scope);
6 | return scope.exports;
7 | }
8 | module.exports = loadModule;
--------------------------------------------------------------------------------
/icedust/lib-js/src/runtime/pixiedust/components/Lifted.js:
--------------------------------------------------------------------------------
1 | var Class = require('jsface').Class;
2 | var PixieDustComponent = require('./PixieDustComponent');
3 | var Functions = require('lib/functions');
4 |
5 |
6 | function Lifted(render){
7 |
8 | function constructor(props, context){
9 | this.materialize(props, context);
10 | }
11 |
12 | var LiftedComponent = Class(PixieDustComponent, {
13 | constructor: constructor,
14 |
15 | componentWillReceiveProps: function(props, context){
16 | this.materialize(props, context);
17 | },
18 |
19 | materialize: function(props, context){
20 | var state = context.store.getState();
21 | var rendered = render(props, state);
22 | this.materialized = rendered.result;
23 | if(rendered.state !== state){
24 | this.stateUpdate(context, rendered.state);
25 | }
26 | },
27 |
28 | stateUpdate: function(context, newState){
29 | context.store.dispatch({type: 'state_update', newState: newState})
30 | },
31 |
32 | render: function(){
33 | return this.materialized;
34 | }
35 | });
36 | Functions.tryRenameFunctionName(LiftedComponent, 'Lifted[' + render.name + ']');
37 | return LiftedComponent;
38 | }
39 |
40 | module.exports = Lifted;
--------------------------------------------------------------------------------
/icedust/lib-js/src/runtime/pixiedust/components/PixieDustComponent.js:
--------------------------------------------------------------------------------
1 | var React = require('react');
2 | var PropTypes = require('prop-types');
3 | var Class = require('jsface').Class;
4 |
5 | var PixieDustComponent = Class(React.Component, {
6 | constructor: function PixieDustComponent(props){
7 |
8 | },
9 |
10 | dispatch: function(action){
11 | this.context.store.dispatch(action);
12 | }
13 | });
14 |
15 | PixieDustComponent.contextTypes = {
16 | store: PropTypes.object
17 | };
18 |
19 | module.exports = PixieDustComponent;
--------------------------------------------------------------------------------
/icedust/lib-js/src/runtime/pixiedust/components/PixieDustProvider.js:
--------------------------------------------------------------------------------
1 | var React = require('react');
2 | var PropTypes = require('prop-types');
3 | var Class = require('jsface').Class;
4 |
5 | var PixieDustProvider = Class(React.Component, {
6 | constructor: function PixieDustProvider(props){
7 |
8 | },
9 | componentDidMount: function(){
10 | this.props.store.subscribe(this.forceUpdate.bind(this));
11 | },
12 | getChildContext: function(){
13 | return {
14 | store: this.props.store
15 | };
16 | },
17 | render: function(){
18 | return React.Children.only(this.props.children)
19 | }
20 | });
21 | PixieDustProvider.childContextTypes = {
22 | store: PropTypes.object
23 | };
24 |
25 | module.exports = PixieDustProvider;
--------------------------------------------------------------------------------
/icedust/lib-js/src/runtime/pixiedust/components/Result.js:
--------------------------------------------------------------------------------
1 | var React = require('react');
2 | var Class = require('jsface').Class;
3 |
4 | var ResultEntry = require('./ResultEntry')
5 |
6 |
7 | var Result = Class(React.Component, {
8 | constructor: function Result(props){
9 |
10 | },
11 | render: function(){
12 | var result = this.props.result;
13 | var entries = result.map(function(r, i){
14 | return React.createElement(ResultEntry, {
15 | key: i,
16 | result: r
17 | });
18 | });
19 | return React.createElement('div', {}, entries);
20 | }
21 | });
22 |
23 | module.exports = Result;
--------------------------------------------------------------------------------
/icedust/lib-js/src/runtime/pixiedust/index.js:
--------------------------------------------------------------------------------
1 | var React = require('react');
2 | var ReactDOMServer = require('react-dom-server');
3 | var PixieDustProvider = require('./components/PixieDustProvider');
4 |
5 | function renderToString(store, element){
6 | var wrappedElement = React.createElement(PixieDustProvider, {
7 | store: store
8 | }, element);
9 | return ReactDOMServer.renderToStaticMarkup(wrappedElement);
10 | }
11 |
12 | module.exports = {
13 | renderToString: renderToString
14 | };
--------------------------------------------------------------------------------
/icedust/lib-js/src/runtime/pixiedust/runner.js:
--------------------------------------------------------------------------------
1 | var loadModule = require('../loadModule');
2 | var React = require('react');
3 | var ReactDOM = require('react-dom');
4 |
5 | var Result = require('./components/Result');
6 | var PixieDustProvider = require('./components/PixieDustProvider');
7 | var PixieDustComponent = require('./components/PixieDustComponent');
8 |
9 | var runtime = require('./runtime');
10 |
11 | function runner(program, container){
12 | var module = loadModule(program);
13 | var state = module.emptyState;
14 | var init = module.init(state);
15 | var store = runtime.makeStore(module.reducer, init.state);
16 | var execute = module.execute(store, init.ids);
17 |
18 | var element = React.createElement(
19 | PixieDustProvider,
20 | {
21 | store: store
22 | },
23 | React.createElement(
24 | Result,
25 | {
26 | result: execute
27 | }
28 | )
29 | );
30 | ReactDOM.render(element, container);
31 | console.log('result', execute);
32 | console.log('state', store.getState().toJS());
33 |
34 | }
35 |
36 | module.exports = runner;
--------------------------------------------------------------------------------
/icedust/lib-js/src/runtime/runner.js:
--------------------------------------------------------------------------------
1 | var loadModule = require('./loadModule');
2 | var _ = require('lodash');
3 | var runtime = require('./pixiedust/runtime');
4 | // var native = require('././index');
5 |
6 | function runner(program){
7 | var module = loadModule(program);
8 | // if(module.Component !== undefined){
9 | // _.assign(module.Component, native);
10 | // }
11 | var state = module.emptyState;
12 | var init = module.init(state);
13 | var store = runtime.makeStore(module.reducer, init.state);
14 | var execute = module.execute(store, init.ids);
15 | for(var i = 0 ; i < execute.length ; i++){
16 | console.log(valueToString(execute[i].value));
17 | }
18 | }
19 |
20 | function valueToString(value){
21 | if(_.isArray(value)){
22 | return '[' + _.toString(value) + ']';
23 | } else if(_.isPlainObject(value)){
24 | return JSON.stringify(value);
25 | } else{
26 | return '' + value;
27 | }
28 | }
29 |
30 | module.exports = runner;
--------------------------------------------------------------------------------
/icedust/lib-webdsl/lib/icedust/eventually-consistent-ac.app:
--------------------------------------------------------------------------------
1 | module lib/icedust/eventually-consistent-ac
2 |
3 | access control rules
4 |
5 | rule page flagalldirty() { true }
6 | rule page flagdirty(entity:String, attribute:String) { true }
7 | rule page enableupdates() { true }
8 | rule page disableupdates() { true }
9 |
--------------------------------------------------------------------------------
/icedust/lib/StrategoWebDSL.tbl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/lib/StrategoWebDSL.tbl
--------------------------------------------------------------------------------
/icedust/lib/java/pp/class/enum-declaration.meta:
--------------------------------------------------------------------------------
1 | Meta([Syntax("Stratego-Box")])
2 |
--------------------------------------------------------------------------------
/icedust/lib/java/pp/class/enum-declaration.str:
--------------------------------------------------------------------------------
1 | module java/pp/class/enum-declaration
2 | rules
3 |
4 | java-to-box:
5 | EnumDec(head, body) -> box |[ V hs=0 [~head ~body] ]|
6 |
7 | java-to-box:
8 | EnumDecHead(mods, Id(name), implements)
9 | ->
10 | box |[ H hs=1 [~*mods KW["enum"] ~lit:name ~implements] ]|
11 |
12 | java-to-box:
13 | EnumBody(consts, body) -> (1, [consts2, body2])
14 | where
15 | consts => consts2
16 | ; (!body => None() < ![] + ![body]) => body2
17 |
18 | java-to-box:
19 | EnumConst(Id(s), None(), None()) -> box |[ s ]|
20 |
21 | java-to-box:
22 | EnumConst(Id(s), Some(args), None()) -> box |[ H hs=0 [s ~args'] ]|
23 | where
24 | args => args'
25 |
26 | java-to-box:
27 | EnumConst(Id(s), args, Some(body)) -> box |[ V vs=0 [~enum ~body] ]|
28 | where
29 | !EnumConst(Id(s), args, None()) => enum
30 |
31 | java-to-box:
32 | EnumBodyDecs(decs) -> box |[ V vs=1 [";" ~*decs] ]|
33 |
--------------------------------------------------------------------------------
/icedust/lib/java/pp/class/method-declaration.meta:
--------------------------------------------------------------------------------
1 | Meta([Syntax("Stratego-Box")])
2 |
--------------------------------------------------------------------------------
/icedust/lib/java/pp/class/method-declaration.str:
--------------------------------------------------------------------------------
1 | module java/pp/class/method-declaration
2 | rules
3 |
4 | java-to-box:
5 | MethodDec(dec, b@Block(_)) -> V vs=0 [~dec b]
6 |
7 | java-to-box:
8 | MethodDec(dec, NoMethodBody()) -> H hs=0 [~dec ";"]
9 |
10 | java-to-box:
11 | MethodDecHead(mods, type-params, type, Id(n), params, None())
12 | ->
13 | box |[ H hs=1 [~*foo ~type H hs=0 [~lit:n ~args]] ]|
14 | where
15 | params => args
16 | ; type-params => targboxes
17 | ; !Conc(mods, targboxes) => foo
18 |
19 | java-to-box:
20 | MethodDecHead(mods, type-params, type, Id(n), params, Some(throws))
21 | ->
22 | box |[ H hs=1 [~*foo ~type H hs=0 [~lit:n ~args] ~throws] ]|
23 | where
24 | params => args
25 | ; type-params => targboxes
26 | ; !Conc(mods, targboxes) => foo
27 |
28 | java-to-box:
29 | DeprMethodDecHead(mods, type-params, type, Id(n), params, dims, throws)
30 | ->
31 | H hs=1 [~*mods ~type b* H hs=0 [~lit:n ~args] H hs=0 [~*dims] ~throws]
32 | where
33 | params => args
34 | ; type-params => b*
35 |
36 | rules
37 |
38 | java-to-box:
39 | Param(mods, type, vardecid) -> H hs=1 [~*mods ~type ~vardecid]
40 |
41 | java-to-box:
42 | VarArityParam(mods, type, vardecid) -> H hs=1 [~*mods ~type "..." ~vardecid]
43 |
44 | rules
45 |
46 | java-to-box:
47 | ThrowsDec(exceptions) -> H hs=1 [KW["throws"] ~excs]
48 | where
49 | exceptions => excs
50 |
51 | rules
52 |
53 | java-to-box:
54 | Void() -> box |[ KW["void"] ]|
55 |
56 |
--------------------------------------------------------------------------------
/icedust/lib/java/pp/expression.meta:
--------------------------------------------------------------------------------
1 | Meta([Syntax("Stratego-Box")])
2 |
--------------------------------------------------------------------------------
/icedust/lib/java/pp/helpers.meta:
--------------------------------------------------------------------------------
1 | Meta([Syntax("Stratego-Box")])
2 |
--------------------------------------------------------------------------------
/icedust/lib/java/pp/interface/annotation-type.meta:
--------------------------------------------------------------------------------
1 | Meta([Syntax("Stratego-Box")])
2 |
--------------------------------------------------------------------------------
/icedust/lib/java/pp/interface/annotation-type.str:
--------------------------------------------------------------------------------
1 | module java/pp/interface/annotation-type
2 | rules
3 |
4 | java-to-box :
5 | AnnoDec(head, decs) -> box |[ V hs=0 [~head ~decs'] ]|
6 | where
7 | (1, decs) => decs'
8 |
9 | java-to-box:
10 | AnnoDecHead(mods, Id(name))
11 | ->
12 | box |[
13 | V vs=0 [
14 | ~*annos
15 | H hs=1 [~*mods' KW["@interface"] ~lit:name ]
16 | ]
17 | ]|
18 | where
19 | < split-fetch-keep(not(is-Java-Anno))
20 | ; \ (l1, t, l2) -> (l1, [t | l2]) \
21 |
22 | <+ !(