├── .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 | <+ !(, []) 23 | 24 | <+ !([], ) 25 | > mods => (annos, mods') 26 | 27 | java-to-box : 28 | AnnoMethodDec(mods, type, Id(name), default) 29 | -> 30 | box |[ H hs=1 [~*mods ~type ~lit:name "(" ")" ~*default' ";"] ]| 31 | where 32 | let default-to-boxes = 33 | \ None() -> [] \ 34 | + \ Some(d) -> [d] \ 35 | 36 | in default => default' 37 | end 38 | 39 | java-to-box : 40 | DefaultVal(val) -> box |[ H hs=1 [KW["default"] ~val] ]| 41 | -------------------------------------------------------------------------------- /icedust/lib/java/pp/interface/annotation.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("Stratego-Box")]) 2 | -------------------------------------------------------------------------------- /icedust/lib/java/pp/interface/annotation.str: -------------------------------------------------------------------------------- 1 | module java/pp/interface/annotation 2 | 3 | 4 | rules 5 | 6 | java-to-box: 7 | MarkerAnno(name) -> box |[ H hs=0 ["@" ~name ] ]| 8 | 9 | java-to-box: 10 | SingleElemAnno(name, val) -> box |[ H hs=0 ["@" ~name "(" ~val ")"] ]| 11 | 12 | java-to-box: 13 | Anno(name, pairs) -> box |[ H hs=0 ["@" ~name "(" ~pairs' ")"] ]| 14 | where 15 | pairs => pairs' 16 | 17 | rules 18 | 19 | java-to-box: 20 | ElemValPair(Id(s), val) -> box |[ H hs=1 [s "=" ~val] ]| 21 | 22 | java-to-box: 23 | ElemValArrayInit(vals) -> ArrayInit(vals) 24 | 25 | strategies 26 | 27 | is-Java-Anno = 28 | ?MarkerAnno(_) 29 | + ?SingleElemAnno(_, _) 30 | + ?Anno(_, _) 31 | -------------------------------------------------------------------------------- /icedust/lib/java/pp/literal.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("Stratego-Box")]) 2 | -------------------------------------------------------------------------------- /icedust/lib/java/pp/main.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("Stratego-Box")]) 2 | -------------------------------------------------------------------------------- /icedust/lib/java/pp/modifier.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("Stratego-Box")]) 2 | -------------------------------------------------------------------------------- /icedust/lib/java/pp/modifier.str: -------------------------------------------------------------------------------- 1 | module java/pp/modifier 2 | 3 | strategies 4 | 5 | java-to-box: Public() -> box |[ KW["public"] ]| 6 | java-to-box: Private() -> box |[ KW["private"] ]| 7 | java-to-box: Protected() -> box |[ KW["protected"] ]| 8 | java-to-box: Abstract() -> box |[ KW["abstract"] ]| 9 | java-to-box: Final() -> box |[ KW["final"] ]| 10 | java-to-box: Static() -> box |[ KW["static"] ]| 11 | java-to-box: Native() -> box |[ KW["native"] ]| 12 | java-to-box: Transient() -> box |[ KW["transient"] ]| 13 | java-to-box: Volatile() -> box |[ KW["volatile"] ]| 14 | java-to-box: Synchronized() -> box |[ KW["synchronized"] ]| 15 | java-to-box: StrictFP() -> box |[ KW["strictfp"] ]| 16 | 17 | -------------------------------------------------------------------------------- /icedust/lib/java/pp/name.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("Stratego-Box")]) 2 | -------------------------------------------------------------------------------- /icedust/lib/java/pp/statement.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("Stratego-Box")]) 2 | -------------------------------------------------------------------------------- /icedust/lib/java/pp/type/parameterized.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("Stratego-Box")]) 2 | -------------------------------------------------------------------------------- /icedust/lib/java/pp/type/parameterized.str: -------------------------------------------------------------------------------- 1 | module java/pp/type/parameterized 2 | rules 3 | 4 | type-args-to-boxes : 5 | None() -> [] 6 | 7 | type-args-to-boxes : 8 | Some(TypeArgs(types)) -> [ box |[ H hs=0 ["<" b ">"] ]| ] 9 | where 10 | types => b 11 | 12 | rules 13 | 14 | java-to-box : 15 | Wildcard(None()) -> box |[ "?" ]| 16 | 17 | java-to-box : 18 | Wildcard(Some(bound)) -> box |[ H hs=1 ["?" ~bound] ]| 19 | 20 | java-to-box : 21 | WildcardUpperBound(type) -> box |[ H hs=1 [KW["extends"] ~type] ]| 22 | 23 | java-to-box : 24 | WildcardLowerBound(type) -> box |[ H hs=1 [KW["super"] ~type] ]| 25 | -------------------------------------------------------------------------------- /icedust/lib/java/pp/type/primitive.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("Stratego-Box")]) 2 | -------------------------------------------------------------------------------- /icedust/lib/java/pp/type/primitive.str: -------------------------------------------------------------------------------- 1 | module java/pp/type/primitive 2 | strategies 3 | 4 | java-to-box: Boolean() -> box |[ KW["boolean"] ]| 5 | java-to-box: Byte() -> box |[ KW["byte"] ]| 6 | java-to-box: Short() -> box |[ KW["short"] ]| 7 | java-to-box: Int() -> box |[ KW["int"] ]| 8 | java-to-box: Long() -> box |[ KW["long"] ]| 9 | java-to-box: Char() -> box |[ KW["char"] ]| 10 | java-to-box: Float() -> box |[ KW["float"] ]| 11 | java-to-box: Double() -> box |[ KW["double"] ]| 12 | -------------------------------------------------------------------------------- /icedust/lib/java/pp/type/reference.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("Stratego-Box")]) 2 | -------------------------------------------------------------------------------- /icedust/lib/java/pp/type/reference.str: -------------------------------------------------------------------------------- 1 | module java/pp/type/reference 2 | strategies 3 | 4 | java-to-box: 5 | ClassOrInterfaceType(b1, type-args) -> box |[ H hs=0 [b1 b2*] ]| 6 | where 7 | type-args => b2* 8 | 9 | java-to-box: 10 | ClassType(b1, type-args) -> box |[ H hs=0 [ b1 b2*] ]| 11 | where 12 | type-args => b2* 13 | 14 | java-to-box: 15 | InterfaceType(b1, type-args) -> box |[ H hs=0 [ b1 b2*] ]| 16 | where 17 | type-args => b2* 18 | 19 | java-to-box: 20 | ArrayType(t) -> box |[ H hs=0 [~t "[" "]"] ]| 21 | 22 | // java-to-box: 23 | // TypeVar(x) -> x 24 | 25 | 26 | -------------------------------------------------------------------------------- /icedust/lib/java/pp/type/variable.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("Stratego-Box")]) 2 | -------------------------------------------------------------------------------- /icedust/lib/java/pp/type/variable.str: -------------------------------------------------------------------------------- 1 | module java/pp/type/variable 2 | rules 3 | 4 | java-to-box: 5 | TypeParams(params) -> box |[ H hs=0 ["<" ~parameters ">"] ]| 6 | where 7 | params => parameters 8 | 9 | type-params-to-boxes : 10 | None() -> [] 11 | 12 | type-params-to-boxes : 13 | Some(p@TypeParams(_)) -> [p] 14 | 15 | rules 16 | 17 | java-to-box: 18 | TypeParam(var, None()) -> var 19 | 20 | java-to-box: 21 | TypeParam(var, Some(bound)) -> box |[ H hs=1 [~var ~bound] ]| 22 | 23 | java-to-box: 24 | TypeBound(bounds) -> box |[ H hs=1 ["extends" ~*bounds' ] ]| 25 | where 26 | bounds => bounds' 27 | -------------------------------------------------------------------------------- /icedust/lib/java/pretty-print.str: -------------------------------------------------------------------------------- 1 | /** 2 | * Main interface for pretty-printing. 3 | * 4 | * @author Martin Bravenboer 5 | */ 6 | module pretty-print 7 | 8 | imports 9 | 10 | java/pp/main 11 | 12 | strategies 13 | 14 | /** 15 | * Pretty-prints the Java AST to a string. 16 | * 17 | * @type Java -> String 18 | */ 19 | pp-java-string = 20 | pp-java5-to-string 21 | 22 | /** 23 | * Pretty-prints the Java AST to the Stream. 24 | * 25 | * @param Stream 26 | * @type Java -> Stream 27 | */ 28 | // pp-java-stream(|stream) = 29 | // pp-java-box 30 | // ; box2text-stream(|80, stream) 31 | 32 | /** 33 | * Pretty-prints the Java AST to a Box representation. 34 | * 35 | * @type Java -> Box 36 | */ 37 | pp-java-box = 38 | pp-java-box(fail) 39 | 40 | pp-java-box(extension) = 41 | pp-java5-to-abox(extension) 42 | 43 | -------------------------------------------------------------------------------- /icedust/lib/js/js-util.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoJS")]) -------------------------------------------------------------------------------- /icedust/lib/js/js-util.str: -------------------------------------------------------------------------------- 1 | module js/js-util 2 | 3 | imports 4 | js/signatures/Expression-sig 5 | 6 | js/pp/javascript-parenthesize 7 | js/pp/javascript-pp 8 | 9 | rules 10 | 11 | pp-js-program = 12 | parenthesize-javascript 13 | ; prettyprint-javascript 14 | ; !V([], ) 15 | ; box2text-string(|120) 16 | 17 | 18 | js-string: s -> String($["[s]"]) 19 | js-escaped-string = escape ; js-string 20 | js-int: s -> IntegerLiteral(s) 21 | js-float: s -> FloatLiteral(s) 22 | 23 | 24 | js-add = !Addition(, ) 25 | js-subtract = !Substraction(, ) 26 | js-mul = !Multiplication(, ) 27 | js-div = !Division(, ) 28 | js-gt = !Greater(, ) 29 | js-gte = !GreaterEquals(, ) 30 | js-lt = !Lower(, ) 31 | js-lte = !LowerEquals(, ) 32 | js-eq = !Equals(, ) 33 | js-eqq = !EqualsStrict(, ) 34 | js-neq = !NotEquals(, ) 35 | js-neqq = !NotEqualsStrict(, ) 36 | js-and = !And(, ) 37 | js-or = !Or(, ) 38 | js-modulo = !Modulo(, ) 39 | 40 | js-not = !Not() 41 | 42 | js-null = !Null() 43 | js-undefined = !Undefined() 44 | 45 | js-var: x_var -> js-exp |[x_var]| -------------------------------------------------------------------------------- /icedust/lib/js/pp/Lexical-pp.str: -------------------------------------------------------------------------------- 1 | module js/pp/Lexical-pp 2 | 3 | imports 4 | libstratego-gpp 5 | libspoofax/sdf/pp 6 | libspoofax/term/origin 7 | libstratego-sglr 8 | js/signatures/Lexical-sig 9 | 10 | 11 | imports 12 | js/signatures/Common-sig 13 | 14 | 15 | imports 16 | js/pp/Common-pp 17 | 18 | 19 | strategies 20 | prettyprint-example = 21 | prettyprint-javascript 22 | 23 | prettyprint-javascript = 24 | fail 25 | 26 | prettyprint-javascript(|sort) = 27 | fail 28 | 29 | 30 | strategies 31 | prettyprint-SDF-start-symbols = 32 | prettyprint-javascript-start-symbols 33 | 34 | prettyprint-javascript-start-symbols = 35 | fail 36 | 37 | 38 | strategies 39 | prettyprint-javascript = 40 | prettyprint-javascript-KEYWORD 41 | 42 | prettyprint-javascript(|sort): 43 | t -> 44 | where sort 45 | 46 | prettyprint-javascript-KEYWORD = 47 | ![S()] 48 | 49 | prettyprint-javascript-KEYWORD : 50 | amb([h|hs]) -> h -------------------------------------------------------------------------------- /icedust/lib/js/signatures/Common-sig.str: -------------------------------------------------------------------------------- 1 | module js/signatures/Common-sig 2 | 3 | signature 4 | constructors 5 | : String -> ID 6 | : String -> INT 7 | : String -> FLOAT 8 | : String -> STRING 9 | : String -> StringChar 10 | : String -> AltStringChar 11 | : String -> BackSlashChar 12 | : String -> CommentChar 13 | : String -> InsideComment 14 | : String -> NewLineEOF 15 | : String -> EOF -------------------------------------------------------------------------------- /icedust/lib/js/signatures/Lexical-sig.str: -------------------------------------------------------------------------------- 1 | module js/signatures/Lexical-sig 2 | 3 | imports 4 | js/signatures/Common-sig 5 | 6 | 7 | signature 8 | constructors 9 | : String -> KEYWORD -------------------------------------------------------------------------------- /icedust/lib/js/signatures/javascript-sig.str: -------------------------------------------------------------------------------- 1 | module js/signatures/javascript-sig 2 | 3 | imports 4 | js/signatures/Common-sig 5 | js/signatures/Lexical-sig 6 | js/signatures/Expression-sig 7 | js/signatures/Statement-sig 8 | 9 | 10 | signature 11 | constructors 12 | Program : List(Statement) -> Start 13 | Start-Plhdr : Start 14 | Statement-Plhdr : Statement 15 | Start-Plhdr : COMPLETION-INSERTION -> Start 16 | Statement-Plhdr : COMPLETION-INSERTION -> Statement 17 | Statement-Opt-Plhdr : Statement -------------------------------------------------------------------------------- /icedust/lib/webdsl/pp-hql.str: -------------------------------------------------------------------------------- 1 | module org/hql/dsl/syntax/pp-hql 2 | 3 | imports 4 | libstratego-gpp // ?? 5 | 6 | strategies 7 | // 8 | // hql-to-textfile(|file) = //commented out to make IceDust build 9 | // !TextFile(file, ) 10 | // 11 | // output-hql-to-file = 12 | // let open-file = (, "w") <+ perror; 1 13 | // in where( fout := "-o" ) 14 | // ; finally( pp-hql-to-stream(|fout), fout ) 15 | // end 16 | 17 | /** 18 | * Pretty-prints the hql AST to a string. 19 | * 20 | * @type hql -> String 21 | */ 22 | pp-hql-to-string = 23 | hql-to-abox 24 | ; box2text-string(|80) 25 | 26 | /** 27 | * Pretty-prints the hql AST to a Stream. 28 | * 29 | * @param Stream 30 | * @type hql -> Stream 31 | */ 32 | pp-hql-to-stream(|stream) = 33 | hql-to-abox 34 | ; box2text-stream(|80, stream) 35 | 36 | /** 37 | * Pretty-prints the hql AST to a Box representation. 38 | * 39 | * @type hql -> Box 40 | */ 41 | 42 | hql-to-abox = 43 | ast2box(|[]) 44 | 45 | hql-pp-table = 46 | HqlPpTable 47 | <+ tbl := 48 | ; rules( HqlPpTable := tbl ) 49 | ; !tbl 50 | -------------------------------------------------------------------------------- /icedust/metaborg.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | id: org.metaborg.lang:icedust:1.0.1-SNAPSHOT 3 | name: icedust 4 | dependencies: 5 | compile: 6 | - org.metaborg:org.metaborg.meta.lang.esv:${metaborgVersion} 7 | - org.metaborg:org.metaborg.meta.lang.template:${metaborgVersion} 8 | - org.metaborg:org.metaborg.meta.nabl2.lang:${metaborgVersion} 9 | source: 10 | - org.metaborg:meta.lib.spoofax:${metaborgVersion} 11 | - org.metaborg:org.metaborg.meta.lib.analysis:${metaborgVersion} 12 | - org.metaborg:org.metaborg.meta.nabl2.shared:${metaborgVersion} 13 | - org.metaborg:org.metaborg.meta.nabl2.runtime:${metaborgVersion} 14 | java: 15 | - com.coveo:nashorn-commonjs-modules:1.0.7 16 | exports: 17 | - directory: ./ 18 | includes: 19 | - lib-java/**/* 20 | - lib-webdsl/**/* 21 | - lib/webdsl/HQL-pretty.pp.af 22 | - lib/webdsl/WebDSL-pretty.pp.af 23 | - lib-js/**/* 24 | pardonedLanguages: 25 | - EditorService 26 | - Stratego-Sugar 27 | - SDF 28 | language: 29 | sdf: 30 | sdf2table: java 31 | stratego: 32 | format: ctree 33 | args: 34 | - -la 35 | - stratego-lib 36 | - -la 37 | - stratego-sglr 38 | - -la 39 | - stratego-gpp 40 | - -la 41 | - stratego-xtc 42 | - -la 43 | - stratego-aterm 44 | - -la 45 | - stratego-sdf 46 | - -la 47 | - strc 48 | -------------------------------------------------------------------------------- /icedust/src/main/strategies/icedust/strategies/InteropRegisterer.java: -------------------------------------------------------------------------------- 1 | package icedust.strategies; 2 | 3 | import org.metaborg.util.log.ILogger; 4 | import org.metaborg.util.log.LoggerUtils; 5 | import org.spoofax.interpreter.core.IContext; 6 | import org.spoofax.interpreter.terms.IStrategoString; 7 | import org.spoofax.interpreter.terms.IStrategoTerm; 8 | import org.strategoxt.lang.Context; 9 | import org.strategoxt.lang.JavaInteropRegisterer; 10 | import org.strategoxt.lang.Strategy; 11 | 12 | import icedust.strategies.graph_topological_sort_1_0; 13 | 14 | public class InteropRegisterer extends JavaInteropRegisterer { 15 | private static final ILogger logger = LoggerUtils.logger("Javascript interpreter"); 16 | 17 | public InteropRegisterer() { 18 | super(new Strategy[] { 19 | graph_topological_sort_1_0.instance 20 | , eval_javascript_0_0.instance 21 | , read_resource_0_0.instance 22 | , open_browser_0_0.instance 23 | , make_module_tree_0_0.instance 24 | }); 25 | } 26 | 27 | public void register(IContext context, Context compiledContext) { 28 | super.register(context, compiledContext); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /icedust/src/main/strategies/icedust/strategies/Main.java: -------------------------------------------------------------------------------- 1 | package icedust.strategies; 2 | 3 | import org.strategoxt.lang.Context; 4 | 5 | public class Main { 6 | public static void init(Context context) { 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /icedust/src/main/strategies/icedust/strategies/make_module_tree_0_0.java: -------------------------------------------------------------------------------- 1 | package icedust.strategies; 2 | 3 | import java.io.IOException; 4 | 5 | import org.metaborg.util.log.ILogger; 6 | import org.metaborg.util.log.LoggerUtils; 7 | import org.spoofax.interpreter.terms.IStrategoTerm; 8 | import org.strategoxt.lang.Context; 9 | import org.strategoxt.lang.Strategy; 10 | 11 | import icedust.strategies.nashorn.NashornInitializer; 12 | 13 | public class make_module_tree_0_0 extends Strategy{ 14 | 15 | private static final ILogger logger = LoggerUtils.logger("make_module"); 16 | 17 | public static final make_module_tree_0_0 instance = new make_module_tree_0_0(); 18 | 19 | @Override 20 | public IStrategoTerm invoke(Context context, IStrategoTerm current) { 21 | String script; 22 | try { 23 | script = NashornInitializer.makeScript(context); 24 | return context.getFactory().makeString(script); 25 | } catch (IOException e) { 26 | logger.error("", e); 27 | context.popOnFailure(); 28 | return current; 29 | } 30 | 31 | } 32 | } -------------------------------------------------------------------------------- /icedust/src/main/strategies/icedust/strategies/nashorn/MergedWriter.java: -------------------------------------------------------------------------------- 1 | package icedust.strategies.nashorn; 2 | 3 | import java.io.IOException; 4 | import java.io.Writer; 5 | 6 | public class MergedWriter extends Writer{ 7 | 8 | public final Writer lhs; 9 | public final Writer rhs; 10 | 11 | public MergedWriter(Writer lhs, Writer rhs) { 12 | this.lhs = lhs; 13 | this.rhs = rhs; 14 | } 15 | 16 | @Override 17 | public void write(char[] cbuf, int off, int len) throws IOException { 18 | lhs.write(cbuf, off, len); 19 | rhs.write(cbuf, off, len); 20 | } 21 | 22 | @Override 23 | public void flush() throws IOException { 24 | lhs.flush(); 25 | rhs.flush(); 26 | 27 | } 28 | 29 | @Override 30 | public void close() throws IOException { 31 | lhs.close(); 32 | rhs.close(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /icedust/src/main/strategies/icedust/strategies/nashorn/ModuleEntry.java: -------------------------------------------------------------------------------- 1 | package icedust.strategies.nashorn; 2 | 3 | public class ModuleEntry { 4 | public final String name; 5 | public final String content; 6 | 7 | public ModuleEntry(String name, String content) { 8 | this.name = name; 9 | this.content = content; 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "ModuleEntry{" + 15 | "name='" + name + '\'' + 16 | ", content='" + content + '\'' + 17 | '}'; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /icedust/src/main/strategies/icedust/strategies/nashorn/ModuleScope.java: -------------------------------------------------------------------------------- 1 | package icedust.strategies.nashorn; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class ModuleScope { 7 | public final String name; 8 | public final ModuleScope parent; 9 | public final Map subScopes; 10 | public final Map entries; 11 | 12 | public ModuleScope(String name, ModuleScope parent, Map subScopes, Map entries) { 13 | this.name = name; 14 | this.parent = parent; 15 | this.subScopes = subScopes; 16 | this.entries = entries; 17 | } 18 | 19 | public ModuleScope(String name, ModuleScope parent) { 20 | this(name, parent, new HashMap<>(), new HashMap<>()); 21 | } 22 | 23 | @Override 24 | public String toString() { 25 | return "ModuleScope{" + 26 | "name='" + name + '\'' + 27 | ", subScopes=" + subScopes + 28 | ", entries=" + entries + 29 | '}'; 30 | } 31 | 32 | public boolean isRoot(){ 33 | return this.parent == null; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /icedust/src/main/strategies/icedust/strategies/nashorn/ModuleTree.java: -------------------------------------------------------------------------------- 1 | package icedust.strategies.nashorn; 2 | 3 | import java.util.List; 4 | 5 | public class ModuleTree { 6 | public final ModuleScope root; 7 | public final String requireScript; 8 | public final List externalDependencies; 9 | 10 | public ModuleTree(ModuleScope root, String requireScript, List externalDependencies) { 11 | this.root = root; 12 | this.requireScript = requireScript; 13 | this.externalDependencies = externalDependencies; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /icedust/syntax/Data.sdf3: -------------------------------------------------------------------------------- 1 | module Data 2 | 3 | imports 4 | 5 | Common 6 | Expressions 7 | Types 8 | 9 | context-free syntax 10 | 11 | Data = EntityInstance 12 | 13 | EntityInstance.EntityInstance = < 14 | : { 15 | <{MemberValue "\n"}*> 16 | } 17 | > 18 | 19 | EntityInstance.EntityInstanceNoType = < 20 | { 21 | <{MemberValue "\n"}*> 22 | } 23 | > 24 | 25 | RelationInstance.RelationInstance = [ 26 | < [IDSpace?]: [EntityType] { 27 | [{MemberValue "\n"}*] 28 | } > 29 | ] 30 | 31 | RelationInstance.RelationInstanceNoType = [ 32 | < [IDSpace?]{ 33 | [{MemberValue "\n"}*] 34 | } > 35 | ] 36 | 37 | MemberValue.MemberValue = < 38 | = <{Value ",\n "}+> 39 | > 40 | 41 | Value.LitVal = LitVal 42 | 43 | Value = EntityInstanceValue 44 | 45 | Value.EntityInstanceWrapper = < > 46 | 47 | EntityInstanceValue.EntityInstanceRef = ID 48 | EntityInstanceValue = EntityInstance 49 | 50 | IDSpace = < > 51 | -------------------------------------------------------------------------------- /icedust/syntax/Execute.sdf3: -------------------------------------------------------------------------------- 1 | module Execute 2 | 3 | imports 4 | 5 | Expressions 6 | Common 7 | 8 | context-free syntax 9 | 10 | Execute = Exp {longest-match} 11 | -------------------------------------------------------------------------------- /icedust/syntax/Functions.sdf3: -------------------------------------------------------------------------------- 1 | module Functions 2 | 3 | imports 4 | 5 | Common 6 | Expressions 7 | Types 8 | 9 | context-free syntax 10 | 11 | Function.Function = < 12 | (<{Parameter ", "}*>) : = 13 | > 14 | 15 | Parameter.Parameter = < : > 16 | -------------------------------------------------------------------------------- /icedust/syntax/Modules.sdf3: -------------------------------------------------------------------------------- 1 | module Modules 2 | 3 | imports 4 | 5 | Common 6 | Config 7 | Model 8 | Data 9 | Execute 10 | Functions 11 | Types 12 | 13 | context-free syntax // modules 14 | 15 | Start.Module = < 16 | module 17 | 18 | <{ModuleSection "\n\n"}*> 19 | 20 | > 21 | 22 | ModuleSection.ConfigSection = < 23 | config 24 | 25 | <{Config "\n\n"}*> 26 | > 27 | 28 | ModuleSection.ModelSection = < 29 | model 30 | 31 | <{Model "\n\n"}*> 32 | > 33 | 34 | ModuleSection.FunctionSection = < 35 | functions 36 | 37 | <{Function "\n\n"}*> 38 | > 39 | 40 | ModuleSection.DataSection = < 41 | data 42 | 43 | <{Data "\n"}*> 44 | > 45 | 46 | ModuleSection.ExecuteSection = < 47 | execute 48 | 49 | <{Execute "\n"}*> 50 | > 51 | -------------------------------------------------------------------------------- /icedust/syntax/Types.sdf3: -------------------------------------------------------------------------------- 1 | module Types 2 | 3 | imports 4 | 5 | Common 6 | 7 | context-free syntax 8 | 9 | AnyType = EntityType 10 | AnyType = PrimitiveType 11 | 12 | EntityType.EntityType = ID 13 | 14 | PrimitiveType.Boolean = 15 | PrimitiveType.Float = 16 | PrimitiveType.Datetime = 17 | PrimitiveType.Int = 18 | PrimitiveType.String = 19 | 20 | Multiplicity.One = <1> 21 | Multiplicity.ZeroOrOne = 22 | Multiplicity.OneOrMore = <+> 23 | Multiplicity.ZeroOrMore = <*> 24 | 25 | MultiplicityOrdering = Multiplicity 26 | MultiplicityOrdering.ZeroOrMoreOrdered = <* (ordered)> 27 | MultiplicityOrdering.OneOrMoreOrdered = <+ (ordered)> 28 | 29 | Strategy.OnDemand = <(on-demand)> 30 | Strategy.OnDemandIncremental = <(on-demand incremental)> 31 | Strategy.Incremental = <(incremental)> 32 | Strategy.Eventual = <(eventual)> 33 | Strategy.OnDemandEventual = <(on-demand eventual)> 34 | Strategy.Inline = <(inline)> 35 | -------------------------------------------------------------------------------- /icedust/syntax/_PrettyPrint.sdf3: -------------------------------------------------------------------------------- 1 | module _PrettyPrint 2 | 3 | imports 4 | Common 5 | Data 6 | Model 7 | Expressions 8 | Types 9 | 10 | context-free syntax 11 | 12 | MemberValue.MemberValuePP = < 13 | = 14 | <{Value ",\n "}+> 15 | > 16 | 17 | context-free syntax 18 | 19 | EntityInstance.EntityInstancePP = < 20 | : {<{MemberValue "\n"}*> } 21 | > 22 | 23 | EntityInstance.EntityInstanceNoTypePP = < 24 | {<{MemberValue "\n"}*> } 25 | > 26 | 27 | context-free syntax 28 | 29 | Member.AttributePP = < 30 | : 31 | > 32 | Member.DerivationAttributePP = < 33 | : = 34 | > 35 | Member.DerivationAttributePPMultiLine = < 36 | : = 37 | 38 | > 39 | Member.DefaultAttributePP = < 40 | : = (default) 41 | > 42 | Member.DefaultAttributePPMultiLine = < 43 | : = 44 | (default) 45 | > 46 | 47 | MyLayOut = <> 48 | 49 | context-free syntax 50 | 51 | Exp.IfPP = < 52 | if() 53 | 54 | else 55 | 56 | > {right} 57 | 58 | context-free syntax 59 | 60 | Exp.AdditionPP = < 61 | + 62 | 63 | > {left} 64 | -------------------------------------------------------------------------------- /icedust/syntax/icedust.sdf3: -------------------------------------------------------------------------------- 1 | module icedust 2 | 3 | imports 4 | 5 | Common 6 | Data 7 | Execute 8 | Expressions 9 | Model 10 | Types 11 | Modules 12 | 13 | context-free start-symbols 14 | 15 | Start 16 | 17 | -------------------------------------------------------------------------------- /icedust/trans/analysis/_constructors.str: -------------------------------------------------------------------------------- 1 | module analysis/_constructors 2 | 3 | signature constructors 4 | 5 | Attribute : NameSpace 6 | Entity : NameSpace 7 | EntityInstance : NameSpace 8 | Inverse : NameSpace 9 | Function : NameSpace 10 | MemberValue : NameSpace 11 | Module : NameSpace 12 | Parameter : NameSpace 13 | Relation : NameSpace 14 | Role : NameSpace 15 | Shortcut : NameSpace 16 | Variable : NameSpace 17 | 18 | Normal : DerivationType 19 | Derivation : DerivationType 20 | DefaultValue : DerivationType 21 | Abstract : DerivationType 22 | 23 | Left : Side 24 | Right : Side 25 | 26 | Entity : Term 27 | Relation : Term 28 | Trait : Term 29 | -------------------------------------------------------------------------------- /icedust/trans/analysis/expressions-casts.nabl2: -------------------------------------------------------------------------------- 1 | module expressions-casts 2 | 3 | rules 4 | 5 | [[ Cast(e1, t) ^ (s) : TTuple(t_type, e1_mult, e1_strat) ]] := 6 | [[ e1 ^ (s) : TTuple(e1_type, e1_mult, e1_strat) ]], 7 | [[ t ^ (s) : t_type ]], 8 | t_type s, 7 | Implicit{"this"} |-> this_def, 8 | this_def : TTuple(this_type, TOne(), this_strat_attrs). 9 | 10 | [[ Ref(r) ^ (s) : r_def_tup ]] := 11 | Member{r} -> s, 12 | Member{r} |-> r_def, 13 | r_def : r_def_tup, 14 | r_def_tup == TTuple(r_def_type, r_def_mult, r_def_strat), 15 | r_def.side := r_def_side, 16 | materialization is materialization of (r_def_strat, r_def_side), 17 | materialization == TMaterialized() | note $[Error: Right-hand side of relation is not materialized with [r_def_strat], use Incremental() or Eventual()] @r. 18 | 19 | [[ MemberAccess(expr, r) ^ (s) : TTuple(r_def_type, out_mult, out_strat) ]] := 20 | [[expr ^ (s) : TTuple(expr_type, expr_mult, expr_strat) ]], 21 | expr_type == TEntity(expr_type_entity), 22 | expr_type_entity ?=I=> entity_scope, 23 | new_scope -I-> entity_scope, 24 | Member{r} -> new_scope, 25 | Member{r} |-> r_def, 26 | r_def : r_def_tup, 27 | r_def_tup == TTuple(r_def_type, r_def_mult, r_def_strat), 28 | out_mult is mulOrd.lub of (expr_mult,r_def_mult), 29 | out_strat is strat.lub of (expr_strat,r_def_strat), 30 | new new_scope. 31 | -------------------------------------------------------------------------------- /icedust/trans/analysis/functions2.nabl2: -------------------------------------------------------------------------------- 1 | module functions2 //functions is a nabl2 keyword 2 | 3 | rules 4 | 5 | [[ Function(f, ps, t, m, e) ^ (module_scope) ]] := 6 | Function{f} <- module_scope, 7 | Function{f} : TTuple(f_type, f_mult, e_strat), 8 | Function{f}.paramtuples := ps_tuples, 9 | Function{f}.params := ps, 10 | Function{f}.expr := e, 11 | Function{f}.ns := Function(), 12 | new f_scope, 13 | f_scope -P-> module_scope, 14 | [[ t ^ (module_scope) : f_type ]], 15 | [[ m ^ (module_scope) : f_mult ]], 16 | Map1T [[ps ^ (f_scope) : ps_tuples]], 17 | [[ e ^ (f_scope) : TTuple(e_type, e_mult, e_strat) ]], 18 | e_type init_scope, 11 | module_data_scope -P-> module_scope, 12 | Module{m} =I=> module_scope, 13 | Module{m}.ns := Module(), 14 | Module{m}.datascope := module_data_scope, 15 | Map3 [[ es ^ (module_scope, module_data_scope, m) ]], 16 | new module_scope, 17 | new module_data_scope, 18 | 19 | Implicit{"this"} <- module_scope, 20 | Implicit{"this"} : TTuple(None(), None(), m_strat), 21 | [[ st ^ (module_scope) : m_strat ]]. 22 | 23 | [[ ConfigSection(es) ^ (module_scope, module_data_scope, module_name) ]] := 24 | Map1 [[ es ^ (module_scope, module_name) ]]. 25 | 26 | [[ ModelSection(es) ^ (module_scope, module_data_scope, module_name) ]] := 27 | Map1 [[ es ^ (module_scope) ]]. 28 | 29 | [[ FunctionSection(es) ^ (module_scope, module_data_scope, module_name) ]] := 30 | Map1 [[ es ^ (module_scope) ]]. 31 | 32 | [[ DataSection(es) ^ (module_scope, module_data_scope, module_name) ]] := 33 | Map2T [[ es ^ (empty_scope, module_data_scope) : es_types ]], 34 | new empty_scope. 35 | 36 | [[ ExecuteSection(es) ^ (module_scope, module_data_scope, module_name) ]] := 37 | Map1T [[ es ^ (module_data_scope) : es_types ]]. 38 | -------------------------------------------------------------------------------- /icedust/trans/analysis/types.nabl2: -------------------------------------------------------------------------------- 1 | module types 2 | 3 | rules 4 | 5 | [[ EntityType(e) ^ (s) : TEntity(e_def) ]] := 6 | Entity{e} -> s, 7 | Entity{e} |-> e_def. 8 | 9 | [[ Boolean() ^ (s) : ty ]] := ty == TBoolean(). 10 | [[ Datetime() ^ (s) : ty ]] := ty == TDatetime(). 11 | [[ Float() ^ (s) : ty ]] := ty == TFloat(). 12 | [[ Int() ^ (s) : ty ]] := ty == TInt(). 13 | [[ String() ^ (s) : ty ]] := ty == TString(). 14 | 15 | [[ One() ^ (s) : mu ]] := mu == TOne(). 16 | [[ ZeroOrOne() ^ (s) : mu ]] := mu == TZeroOrOne(). 17 | [[ OneOrMore() ^ (s) : mu ]] := mu == TOneOrMore(). 18 | [[ ZeroOrMore() ^ (s) : mu ]] := mu == TZeroOrMore(). 19 | [[ OneOrMoreOrdered() ^ (s) : mu ]] := mu == TOneOrMoreOrdered(). 20 | [[ ZeroOrMoreOrdered() ^ (s) : mu ]] := mu == TZeroOrMoreOrdered(). 21 | 22 | [[ Some(Incremental()) ^ (s) : st ]] := st == TIncremental(). 23 | [[ Some(OnDemand()) ^ (s) : st ]] := st == TOnDemand(). 24 | [[ Some(OnDemandIncremental()) ^ (s) : st ]] := st == TOnDemandIncremental(). 25 | [[ Some(Eventual()) ^ (s) : st ]] := st == TEventual(). 26 | [[ Some(OnDemandEventual()) ^ (s) : st ]] := st == TOnDemandEventual(). 27 | [[ Some(Inline()) ^ (s) : st ]] := true. 28 | [[ None() ^ (s) : st ]] := 29 | Implicit{"this"} -> s, 30 | Implicit{"this"} |-> this_def, 31 | this_def : this_ty, 32 | this_ty == TTuple(this_type, this_mult, st). 33 | -------------------------------------------------------------------------------- /icedust/trans/analysis2/constructors.str: -------------------------------------------------------------------------------- 1 | module analysis2/constructors 2 | 3 | signature constructors 4 | 5 | Path : List(URL) -> Path 6 | Inv : Path -> Path 7 | 8 | DependsOn : DependsOn 9 | FlowsTo : FlowsTo 10 | TopoSort : TopoSort 11 | TopoSort2 : TopoSort 12 | AST : AST 13 | 14 | Assoc : Term 15 | 16 | Type : Term 17 | Mult : Term 18 | Ord : Term 19 | -------------------------------------------------------------------------------- /icedust/trans/api/_generated.str: -------------------------------------------------------------------------------- 1 | module api/_generated 2 | 3 | imports // generated language file 4 | 5 | libspoofax/term/position 6 | libspoofax/core/parse 7 | libspoofax/core/language 8 | libspoofax/resource/path 9 | 10 | rules 11 | 12 | _language = language 13 | _project-path = project-path 14 | 15 | _parse-file = parse-file 16 | _refresh-workspace-file = id //refresh-workspace-file // should not be needed anymore 17 | 18 | _parent-at-position(|position) = parent-at-position(|position) 19 | -------------------------------------------------------------------------------- /icedust/trans/api/config-api.str: -------------------------------------------------------------------------------- 1 | module api/config-api 2 | 3 | imports // constructors 4 | 5 | signatures/Config-sig 6 | signatures/Modules-sig 7 | 8 | imports // functions 9 | 10 | lib/origin 11 | 12 | rules 13 | 14 | configsection-get-backend = ?ConfigSection();filter(is-backend);Hd 15 | configsection-get-backends = ?ConfigSection();filter(is-backend) 16 | configsection-get-features = ?ConfigSection();filter(is-languagefeatures);Hd;?LanguageFeatures() 17 | configsection-get-featuress = ?ConfigSection();filter(is-languagefeatures) 18 | 19 | configsection-is-webdslbackend = ?ConfigSection(_);where(configsection-get-backend;?WebDSLBackend(_)) 20 | 21 | configsection-has-no-backend = ?ConfigSection(_);where(not(configsection-get-backend)) 22 | configsection-has-no-features = ?ConfigSection(_);where(not(configsection-get-features)) 23 | 24 | configsection-add(s) = ?t;?ConfigSection(c*);!ConfigSection([c*,]);custom-origin(|t) 25 | 26 | rules 27 | 28 | is-backend = ?JavaBackend(_) 29 | is-backend = ?WebDSLBackend(_) 30 | is-backend = ?JavascriptBackend(_, _) 31 | 32 | is-javascript-backend = ?JavascriptBackend(_, _) 33 | 34 | backend-get-phase = ?JavaBackend() 35 | backend-get-phase = ?JavascriptBackend(, _) 36 | 37 | is-languagefeatures = ?LanguageFeatures(_) 38 | 39 | languagefeatures-add(s) = ?LanguageFeatures(f*);!LanguageFeatures([f*,]) 40 | -------------------------------------------------------------------------------- /icedust/trans/api/expressions-api.str: -------------------------------------------------------------------------------- 1 | module api/expressions-api 2 | 3 | imports // signatures 4 | 5 | signatures/Expressions-sig 6 | 7 | imports // functions 8 | 9 | api/types-api 10 | 11 | rules 12 | 13 | is-expr = not(is-string);not(is-type) // identifiers inside expressions are not expressions, neither are type constructors 14 | 15 | is-literal = ?Int(_) 16 | is-literal = ?Float(_) 17 | is-literal = ?True() 18 | is-literal = ?False() 19 | is-literal = ?Datetime(_) 20 | is-literal = ?NoValue() 21 | is-literal = ?LitString(_) 22 | -------------------------------------------------------------------------------- /icedust/trans/api/expressions-names-api.str: -------------------------------------------------------------------------------- 1 | module api/expressions-names-api 2 | 3 | imports // constructors 4 | 5 | analysis/_constructors 6 | 7 | imports // functions 8 | 9 | lib/nabl2 10 | 11 | rules 12 | 13 | is-varname = where(is-string;get-property(|"Member","ns");?Variable()) 14 | is-paramname = where(is-string;get-property(|"Member","ns");?Parameter()) 15 | -------------------------------------------------------------------------------- /icedust/trans/api/functions-api.str: -------------------------------------------------------------------------------- 1 | module api/functions-api 2 | 3 | imports // constructors 4 | 5 | signatures/Functions-sig 6 | 7 | 8 | rules // functions 9 | 10 | is-function = ?Function(_,_,_,_,_) 11 | 12 | function-get-name = ?Function(, _, _, _, _) 13 | function-get-params = ?Function(_, , _, _, _) 14 | function-get-type = ?Function(_, _, , _, _) 15 | function-get-mult = ?Function(_, _, _, , _) 16 | function-get-expr = ?Function(_, _, _, _, ) 17 | 18 | function-set-mult(s) = Function(id, id, id, s, id) 19 | 20 | function-has-no-mult = where(function-get-mult;?None()) 21 | 22 | rules // params 23 | 24 | is-param = ?Parameter(_, _, _) 25 | 26 | param-get-name = ?Parameter(, _, _) 27 | param-get-type = ?Parameter(_, , _) 28 | param-get-mult = ?Parameter(_, _, ) 29 | 30 | param-set-mult(s) = Parameter(id, id, s) 31 | 32 | param-has-no-mult = where(param-get-mult;?None()) 33 | 34 | -------------------------------------------------------------------------------- /icedust/trans/api/functions-names-api.str: -------------------------------------------------------------------------------- 1 | module api/functions-names-api 2 | 3 | imports // constructors 4 | 5 | analysis2/constructors 6 | analysis/_constructors 7 | static-semantics 8 | 9 | imports // functions 10 | 11 | api/functions-api 12 | api/types-names-api 13 | lib/nabl2 14 | 15 | rules // function 16 | 17 | is-functionname = where(is-string;get-property(|"Function","ns");?Function()) 18 | 19 | functionname-get-paramnames = get-property(|"Function","params");map(param-get-name) 20 | functionname-get-expr = get-property(|"Function","expr") 21 | 22 | functionname-get-type = get-type-property(|"Function");normalize-type 23 | functionname-get-multiplicity = get-type-property(|"Function");normalize-multiplicity 24 | 25 | functionname-get-paramnum = functionname-get-paramnames;length 26 | 27 | rules // param 28 | 29 | is-paramname = where(is-string;get-property(|"Member","ns");?Parameter()) 30 | 31 | paramname-get-type = get-type-property(|"Member");normalize-type 32 | paramname-get-multiplicity = get-type-property(|"Member");normalize-multiplicity 33 | -------------------------------------------------------------------------------- /icedust/trans/api/module-api.str: -------------------------------------------------------------------------------- 1 | module api/module-api 2 | 3 | imports // constructors 4 | 5 | signatures/Modules-sig 6 | 7 | imports 8 | 9 | lib/origin 10 | lib/traverse 11 | 12 | rules 13 | 14 | is-module = ?Module(_, _, _) 15 | 16 | module-get-modulename = ?Module(, _, _) 17 | module-get-strategy = ?Module(_, , _) 18 | module-get-sections = ?Module(_, _, ) 19 | 20 | module-set-strategy(s) = Module(id, s, id) 21 | module-set-sections(s) = ?m;Module(id, id, s);custom-origin(|m) 22 | 23 | module-has-no-strategy = where(module-get-strategy;?None()) 24 | 25 | rules 26 | 27 | module-get-exprs = module-get-sections;filter(is-execute);fmap(execute-get-exprs) 28 | 29 | rules 30 | 31 | is-execute = ?ExecuteSection(_) 32 | 33 | execute-get-exprs = ?ExecuteSection() 34 | 35 | rules 36 | 37 | module-get-config-sections = module-get-sections;filter(?ConfigSection(_)) 38 | module-get-config-section = module-get-config-sections;Hd 39 | 40 | module-has-no-config-section = where(module-get-config-sections;?[]) 41 | -------------------------------------------------------------------------------- /icedust/trans/desugaring/alternatives.str: -------------------------------------------------------------------------------- 1 | module desugaring/alternatives 2 | 3 | imports // constructors 4 | 5 | signatures/Expressions-sig 6 | signatures/Types-sig 7 | 8 | imports // functions 9 | 10 | lib/origin 11 | 12 | rules 13 | 14 | desugar-alternatives = topdown(try(desugar-alternative)) 15 | 16 | desugar-alternative: If2(a,b,c) -> If(a,b,c) 17 | desugar-alternative: If3(a,b,c) -> If(a,b,c) 18 | desugar-alternative: If4(a,b,c) -> If(a,b,c) 19 | desugar-alternative: If5(a,b,c) -> If(a,b,c) 20 | desugar-alternative: If6(a,b,c) -> If(a,b,c) 21 | 22 | desugar-alternative: And2(a,b) -> And(a,b) 23 | desugar-alternative: Or2 (a,b) -> Or (a,b) 24 | 25 | desugar-alternative: Not2(a) -> Not(a) 26 | 27 | desugar-alternative: Function2(a, b, cs) -> Function(b, [a|cs]) 28 | 29 | desugar-alternative: e@IfElseNoValue(a, b) -> If(a, b, NoValue()) 30 | 31 | rules 32 | 33 | desugar-alternative: InterpolateString(e1, e2, e3) -> 34 | Addition( 35 | e1, 36 | Function("concat",[ 37 | Merge( 38 | Cast( 39 | e2, 40 | String() 41 | ), 42 | e3 43 | )] 44 | ) 45 | ) 46 | -------------------------------------------------------------------------------- /icedust/trans/desugaring/desugar.str: -------------------------------------------------------------------------------- 1 | module desugaring/desugar 2 | 3 | imports // functions 4 | 5 | desugaring/alternatives 6 | desugaring/omitted 7 | lib/origin 8 | 9 | rules 10 | 11 | desugar-before-analysis = 12 | desugar-somes; 13 | desugar-alternatives; 14 | generate-omitted; 15 | warning-on-missing-origin 16 | 17 | // desugar-after-analysis = 18 | // warning-on-missing-origin 19 | 20 | 21 | rules // general 22 | 23 | desugar-somes = bottomup(try(desugar-some)) 24 | desugar-some: Some(a) -> a where !a;not(?OnDemand());not(?Incremental());not(?Eventual());not(?OnDemandEventual());not(?OnDemandIncremental()) 25 | 26 | -------------------------------------------------------------------------------- /icedust/trans/editor/analysis.str: -------------------------------------------------------------------------------- 1 | module analysis 2 | 3 | imports 4 | 5 | nabl2/api 6 | nabl2shared 7 | nabl2runtime 8 | 9 | static-semantics 10 | 11 | editor/pp 12 | 13 | analysis/_constructors 14 | 15 | desugaring/desugar 16 | 17 | analysis2/analysis2 18 | 19 | lib/time 20 | 21 | rules // Analysis: NaBL2 hooks 22 | 23 | editor-analyze = nabl2-analyze(desugar-before-analysis) 24 | 25 | nabl2-custom-analysis-init-hook: (resource, ast) -> [] 26 | 27 | nabl2-custom-analysis-unit-hook: (resource, ast, customInitialResult) -> customUnitResult 28 | with 29 | customUnitResult := (resource, ast) 30 | 31 | nabl2-custom-analysis-final-hook(|a):(resource , customInitialResult, customUnitResult*) -> (error*, warning*, note*, customFinalResult) 32 | with 33 | ast := customUnitResult* 34 | ;ast 35 | with 36 | (error*, warning*, note*, customFinalResult) := a 37 | ; (error*, warning*, note*, customFinalResult) 38 | 39 | rules // Debugging 40 | 41 | // Prints the abstract syntax ATerm of a selection. 42 | debug-show-aterm: (selected, _, _, path, project-path) -> (filename, result) 43 | with filename := path 44 | ; result := selected 45 | 46 | // Prints the analyzed annotated abstract syntax ATerm of a selection. 47 | debug-show-analyzed: (selected, _, _, path, project-path) -> (filename, result) 48 | with filename := path 49 | ; result := selected 50 | 51 | 52 | -------------------------------------------------------------------------------- /icedust/trans/editor/build.str: -------------------------------------------------------------------------------- 1 | module editor/build 2 | 3 | imports // backends 4 | 5 | generating/java 6 | generating/webdsl 7 | generating/js/build 8 | 9 | imports // functions 10 | 11 | api/config-api 12 | api/module-api 13 | lib/index 14 | lib/nabl2 15 | nabl2/api 16 | 17 | rules // builders 18 | 19 | build = build(error-handler-editor) 20 | build-test = build(error-handler-tests) 21 | 22 | build(error-handler): (selected, position, ast, path, project-path) -> result 23 | with 24 | $[[project-path]/[path]]; 25 | analysis := ; 26 | analysis2 := analysis; 27 | <_index-set>analysis2 28 | with 29 | moduleName := selected; 30 | backend := selected; 31 | result := selected 32 | 33 | build(error-handler|backend, moduleName, relativePath) = fail // implemented by backends 34 | 35 | backend-not-enabled(|backend) = !$[The backend [backend] is not enabled.];debug 36 | 37 | rules // Error handlers (editor: report error, do not fail, tests: fail with error) 38 | 39 | error-handler-editor : msg -> ("ERROR_PLACEHOLDER", msg) 40 | with 41 | err-msg(|msg) 42 | 43 | error-handler-tests : msg -> None() 44 | with 45 | with(fail|msg) 46 | -------------------------------------------------------------------------------- /icedust/trans/editor/pp.str: -------------------------------------------------------------------------------- 1 | module pp 2 | 3 | imports 4 | 5 | libstratego-gpp 6 | // runtime/refactoring/- 7 | pp/icedust-parenthesize 8 | pp/icedust-pp 9 | prettyprinting/pp 10 | 11 | rules 12 | 13 | editor-format: 14 | (node, _, ast, path, project-path) -> (path, result) 15 | with 16 | ext := path 17 | ; result := node 18 | -------------------------------------------------------------------------------- /icedust/trans/generating/_ir/constructors.str: -------------------------------------------------------------------------------- 1 | module generating/_ir/constructors 2 | 3 | imports 4 | 5 | signature sorts 6 | 7 | TargetLanguage 8 | 9 | signature constructors 10 | 11 | Java : TargetLanguage 12 | JavaScript : TargetLanguage 13 | WebDSL : TargetLanguage 14 | WebDSLEager : TargetLanguage 15 | WebDSLEventual : TargetLanguage 16 | -------------------------------------------------------------------------------- /icedust/trans/generating/java/data.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("Stratego-Java-15")]) 2 | -------------------------------------------------------------------------------- /icedust/trans/generating/java/execute.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("Stratego-Java-15")]) 2 | -------------------------------------------------------------------------------- /icedust/trans/generating/java/execute.str: -------------------------------------------------------------------------------- 1 | module generating/java/execute 2 | 3 | imports // constructors 4 | 5 | java/Java 6 | signatures/Execute-sig 7 | signatures/Modules-sig 8 | 9 | imports // functions 10 | 11 | generating/java/expressions 12 | 13 | rules 14 | 15 | execute-expr-to-java-stm(err): exp -> result 16 | with 17 | (stms*, exp') := exp 18 | with 19 | result := java:block-stm |[ 20 | { 21 | ~stms* 22 | System.out.println(~exp'); 23 | } 24 | ]| 25 | -------------------------------------------------------------------------------- /icedust/trans/generating/java/expressions-references.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("Stratego-Java-15")]) 2 | -------------------------------------------------------------------------------- /icedust/trans/generating/java/expressions.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("Stratego-Java-15")]) 2 | -------------------------------------------------------------------------------- /icedust/trans/generating/java/functions.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("Stratego-Java-15")]) 2 | -------------------------------------------------------------------------------- /icedust/trans/generating/java/generate.str: -------------------------------------------------------------------------------- 1 | module generating/java/generate 2 | 3 | imports // constructors 4 | 5 | signatures/Modules-sig 6 | 7 | imports // functions 8 | 9 | api/module-api 10 | java/pretty-print 11 | generating/java/data 12 | generating/java/execute 13 | generating/java/model 14 | generating/java/module 15 | 16 | rules // Builders 17 | 18 | generate-java-code(err): moduleName -> (result, errors) 19 | with 20 | java-ast := moduleName; 21 | errors := msg\)>; 22 | java-ast':= []\))> java-ast; 23 | result := java-ast' 24 | -------------------------------------------------------------------------------- /icedust/trans/generating/java/model-runtime-layers.graffle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/trans/generating/java/model-runtime-layers.graffle -------------------------------------------------------------------------------- /icedust/trans/generating/java/model.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("Stratego-Java-15")]) 2 | -------------------------------------------------------------------------------- /icedust/trans/generating/java/module.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("Stratego-Java-15")]) 2 | -------------------------------------------------------------------------------- /icedust/trans/generating/java/types.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("Stratego-Java-15")]) 2 | -------------------------------------------------------------------------------- /icedust/trans/generating/js/access.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoJS")]) -------------------------------------------------------------------------------- /icedust/trans/generating/js/calculate.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoJS")]) -------------------------------------------------------------------------------- /icedust/trans/generating/js/common.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoJS")]) -------------------------------------------------------------------------------- /icedust/trans/generating/js/common.str: -------------------------------------------------------------------------------- 1 | module generating/js/common 2 | 3 | imports 4 | 5 | signatures/Types-sig 6 | api/model-names-api 7 | api/types-api 8 | generating/js/names 9 | 10 | rules 11 | 12 | 13 | 14 | exp-empty = upper-one ; exp-empty-one 15 | exp-empty = upper-many ; exp-empty-many 16 | exp-empty-one = !js-exp |[null]| 17 | exp-empty-many = empty-array 18 | 19 | exp-attribute-empty: attribute -> js-exp |[undefined]| 20 | where 21 | name-is-derived 22 | 23 | exp-attribute-empty = name-get-multiplicity ; exp-empty 24 | 25 | 26 | exp-collection : exp_elements* -> js-exp |[ 27 | [exp_elements*] 28 | ]| 29 | 30 | simplify-multiplicity : ZeroOrOne() -> One() 31 | simplify-multiplicity : OneOrMore() -> ZeroOrMore() 32 | simplify-multiplicity : ZeroOrMoreOrdered() -> ZeroOrMore() 33 | simplify-multiplicity : OneOrMoreOrdered() -> OneOrMore() 34 | simplify-multiplicity = id 35 | 36 | 37 | lub-simple: (One(), ZeroOrOne()) -> ZeroOrOne() 38 | lub-simple: (ZeroOrOne(), One()) -> ZeroOrOne() 39 | lub-simple = (upper-many, id) ; !ZeroOrMore() 40 | lub-simple = (id, upper-many) ; !ZeroOrMore() 41 | lub-simple: (x, x) -> x 42 | 43 | with-prefix: ("", str) -> str 44 | with-prefix: (prefix, str) -> $[[prefix]_[str]] 45 | 46 | -------------------------------------------------------------------------------- /icedust/trans/generating/js/data.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoJS")]) -------------------------------------------------------------------------------- /icedust/trans/generating/js/execute.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoJS")]) -------------------------------------------------------------------------------- /icedust/trans/generating/js/expression.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoJS")]) -------------------------------------------------------------------------------- /icedust/trans/generating/js/generate.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoJS")]) -------------------------------------------------------------------------------- /icedust/trans/generating/js/getter.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoJS")]) -------------------------------------------------------------------------------- /icedust/trans/generating/js/init.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoJS")]) -------------------------------------------------------------------------------- /icedust/trans/generating/js/init.str: -------------------------------------------------------------------------------- 1 | module generating/js/init 2 | 3 | imports 4 | api/module-names-api 5 | api/model-names-api 6 | js/js-util 7 | 8 | generating/js/names 9 | 10 | rules 11 | generate-init: moduleName -> js-stmt* |[ 12 | var x_scope = exp_emptyObject; 13 | var emptyState = exp_initialState; 14 | module.exports.emptyState = emptyState; 15 | ]| 16 | with 17 | x_scope := 18 | ; exp_emptyObject := 19 | ; exp_initialState := moduleName 20 | 21 | 22 | exp-initial-state : moduleName -> js-exp |[ 23 | immutable.Map({ 24 | prop_entity*, 25 | prop_initAttribute* 26 | }) 27 | ]| 28 | with 29 | entity* := moduleName 30 | ; prop_entity* := entity* 31 | ; field* := , ) 33 | ; conc 34 | )> entity* 35 | ; prop_initAttribute* := field* 36 | 37 | entityname-to-prop : entityName -> js-prop |[exp_entityName: immutable.Map()]| 38 | with 39 | exp_entityName := entityName 40 | 41 | field-to-prop: attribute -> js-prop |[exp_key : immutable.Map()]| 42 | where 43 | attributename-is-derivation <+ is-relationname 44 | with 45 | exp_key := attribute 46 | -------------------------------------------------------------------------------- /icedust/trans/generating/js/invalidation.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoJS")]) -------------------------------------------------------------------------------- /icedust/trans/generating/js/model.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoJS")]) -------------------------------------------------------------------------------- /icedust/trans/generating/js/model.str: -------------------------------------------------------------------------------- 1 | module generating/js/model 2 | 3 | imports 4 | api/model-names-api 5 | api/module-names-api 6 | 7 | lib/js/js-util 8 | 9 | signatures/Types-sig 10 | 11 | generating/js/invalidation 12 | generating/js/access 13 | generating/js/names 14 | generating/js/common 15 | generating/js/getter 16 | generating/js/setter 17 | generating/js/calculate 18 | 19 | rules 20 | 21 | generate-model-statements : moduleName -> js-stmt* |[ 22 | stmt_getters* 23 | stmt_setters* 24 | stmt_add* 25 | stmt_invalidations* 26 | stmt_calculate* 27 | ]| 28 | with 29 | attributes := moduleName 30 | ; stmt_getters* := attributes 31 | ; stmt_setters* := attributes 32 | ; stmt_add* := attributes 33 | ; stmt_invalidations* := attributes 34 | ; stmt_calculate* := attributes 35 | 36 | modulename-get-attributes = 37 | modulename-get-entitynames 38 | ; mapconcat(\e -> ( e, e)\) 39 | 40 | generate-memoize: attribute -> js-stmt |[null;]| 41 | where 42 | attributename-is-derivation 43 | with 44 | exp := attribute 45 | ; collect-om(collect-access) 46 | 47 | -------------------------------------------------------------------------------- /icedust/trans/generating/js/names.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoJS")]) -------------------------------------------------------------------------------- /icedust/trans/generating/js/reducer.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoJS")]) -------------------------------------------------------------------------------- /icedust/trans/generating/js/runner.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoJS")]) -------------------------------------------------------------------------------- /icedust/trans/generating/js/runner.str: -------------------------------------------------------------------------------- 1 | module runner 2 | 3 | imports 4 | 5 | rules 6 | runner-wrap-module: exp_program -> js-program |[ 7 | var runner = require('runner'); 8 | runner(exp_program); 9 | ]| -------------------------------------------------------------------------------- /icedust/trans/generating/js/setter.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoJS")]) -------------------------------------------------------------------------------- /icedust/trans/generating/webdsl/data.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoWebDSL")]) 2 | -------------------------------------------------------------------------------- /icedust/trans/generating/webdsl/expressions-references.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoWebDSL")]) 2 | -------------------------------------------------------------------------------- /icedust/trans/generating/webdsl/expressions.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoWebDSL")]) 2 | -------------------------------------------------------------------------------- /icedust/trans/generating/webdsl/functions.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoWebDSL")]) 2 | -------------------------------------------------------------------------------- /icedust/trans/generating/webdsl/generate.str: -------------------------------------------------------------------------------- 1 | module generating/webdsl/generate 2 | 3 | imports // constructors 4 | 5 | signatures/Modules-sig 6 | 7 | imports // functions 8 | 9 | api/module-api 10 | generating/webdsl/module 11 | webdsl/pp-webdsl 12 | webdsl/WebDSL-parenthesize 13 | 14 | rules // Builders 15 | 16 | generate-webdsl-code(err): moduleName -> (result, errors) 17 | with 18 | webdsl-ast := moduleName; 19 | errors := msg\)>; 20 | webdsl-ast' := []\))> webdsl-ast; 21 | webdsl-ast'' := webdsl-ast'; 22 | result := webdsl-ast'' 23 | -------------------------------------------------------------------------------- /icedust/trans/generating/webdsl/java/generate.str: -------------------------------------------------------------------------------- 1 | module generating/webdsl-java/generate 2 | 3 | imports // constructors 4 | 5 | signatures/Modules-sig 6 | 7 | imports // functions 8 | 9 | api/module-api 10 | java/pretty-print 11 | generating/webdsl/java/module 12 | 13 | rules // documentation 14 | 15 | /* 16 | * Generate a native java java.util.concurrent.ConcurrentLinkedQueue for each type. 17 | * Each normal page request can flag items dirty in these queues. 18 | * The central eventual consistent thread empties these queues and computes everything. 19 | * Items may be added during computation, the algorithm will do those first in order to avoid unnecessary computation (note this might lead to starvation during heavy use). 20 | */ 21 | 22 | rules // Builders 23 | 24 | generate-webdsl-java-code(err):moduleName -> (result, errors) 25 | with 26 | java-ast := moduleName; 27 | errors := msg\)>; 28 | java-ast':= []\))> java-ast; 29 | result := java-ast' 30 | -------------------------------------------------------------------------------- /icedust/trans/generating/webdsl/java/module.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("Stratego-Java-15")]) 2 | -------------------------------------------------------------------------------- /icedust/trans/generating/webdsl/js/expressions.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoJS")]) -------------------------------------------------------------------------------- /icedust/trans/generating/webdsl/js/generate.str: -------------------------------------------------------------------------------- 1 | module generating/webdsl-java/generate 2 | 3 | imports // constructors 4 | 5 | signatures/Modules-sig 6 | 7 | imports // functions 8 | 9 | libstratego-gpp 10 | api/module-api 11 | lib/js/pp/javascript-pp 12 | lib/js/pp/javascript-parenthesize 13 | generating/webdsl/java/module 14 | generating/webdsl/js/module 15 | 16 | rules // documentation 17 | 18 | /* 19 | * Generate a native java java.util.concurrent.ConcurrentLinkedQueue for each type. 20 | * Each normal page request can flag items dirty in these queues. 21 | * The central eventual consistent thread empties these queues and computes everything. 22 | * Items may be added during computation, the algorithm will do those first in order to avoid unnecessary computation (note this might lead to starvation during heavy use). 23 | */ 24 | 25 | rules // Builders 26 | 27 | pp-js-string : x -> result 28 | with 29 | result := 30 | ) 33 | ; box2text-string(|120)> x 34 | 35 | generate-webdsl-js-code: moduleName -> result 36 | with 37 | derivation-js := moduleName 38 | ; result := derivation-js 39 | -------------------------------------------------------------------------------- /icedust/trans/generating/webdsl/js/js-helper.str: -------------------------------------------------------------------------------- 1 | module generating/webdsl/js/js-helper 2 | 3 | imports // constructors 4 | 5 | lib/js/signatures/Expression-sig 6 | 7 | rules 8 | 9 | js-string: s -> String($["[s]"]) 10 | -------------------------------------------------------------------------------- /icedust/trans/generating/webdsl/js/module.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoJS")]) -------------------------------------------------------------------------------- /icedust/trans/generating/webdsl/model-runtime-layers.graffle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MetaBorgCube/IceDust/b39d9fbe3a982d864d1218a02818411dfcc0190b/icedust/trans/generating/webdsl/model-runtime-layers.graffle -------------------------------------------------------------------------------- /icedust/trans/generating/webdsl/model.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoWebDSL")]) 2 | -------------------------------------------------------------------------------- /icedust/trans/generating/webdsl/module-derivations.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoWebDSL")]) 2 | -------------------------------------------------------------------------------- /icedust/trans/generating/webdsl/module-manage.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoWebDSL")]) 2 | -------------------------------------------------------------------------------- /icedust/trans/generating/webdsl/module-ui.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoWebDSL")]) 2 | -------------------------------------------------------------------------------- /icedust/trans/generating/webdsl/module.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoWebDSL")]) 2 | -------------------------------------------------------------------------------- /icedust/trans/generating/webdsl/types.meta: -------------------------------------------------------------------------------- 1 | Meta([Syntax("StrategoWebDSL")]) 2 | -------------------------------------------------------------------------------- /icedust/trans/generating/webdsl/webdsl-helper.str: -------------------------------------------------------------------------------- 1 | module generating/webdsl/webdsl-helper 2 | 3 | imports 4 | 5 | webdsl/constructors 6 | webdsl/WebDSL 7 | 8 | rules 9 | 10 | webdsl-elem: t -> Text(t) where is-string 11 | webdsl-expr: s -> String(s) where is-string 12 | -------------------------------------------------------------------------------- /icedust/trans/icedust.str: -------------------------------------------------------------------------------- 1 | module icedust 2 | 3 | imports 4 | 5 | editor/analysis 6 | editor/build 7 | editor/builders 8 | editor/completion 9 | editor/pp 10 | editor/outline 11 | editor/services 12 | 13 | rules 14 | // debug-show-aterm: 15 | // (node, _, _, path, project-path) -> (filename, result) 16 | // with 17 | // filename := path 18 | // ; result := node 19 | -------------------------------------------------------------------------------- /icedust/trans/lib/annotations.str: -------------------------------------------------------------------------------- 1 | module lib/annotations 2 | 3 | imports 4 | 5 | rules 6 | 7 | has-annotation(|kind) = where(get-annotation(|kind)) 8 | 9 | get-annotation(|kind) = get-annos;fetch-elem(?(kind, )) 10 | 11 | set-annotations(|annos): term -> (term, annos) 12 | 13 | _rm-annotations = rm-annotations 14 | -------------------------------------------------------------------------------- /icedust/trans/lib/eq.str: -------------------------------------------------------------------------------- 1 | module lib/eq 2 | 3 | imports 4 | 5 | api/_runtime 6 | nabl2/api 7 | 8 | rules 9 | 10 | eq-no-anno(|) = ?(x,y);!x;eq-no-anno(|y) 11 | 12 | eq-no-anno(|x): y -> y 13 | where 14 | x2 := x; 15 | y2 := y; 16 | y2 17 | rules 18 | 19 | eq-no-anno-r(|) = ?(x,y);!x;eq-no-anno-r(|y) 20 | 21 | eq-no-anno-r(|x): y -> y 22 | where 23 | x2 := x; 24 | y2 := y; 25 | y2 26 | 27 | rules 28 | 29 | eq(|a) = equal(|a) 30 | 31 | rules 32 | 33 | eq-origin(|x): y -> y 34 | where 35 | x-o := x; 36 | y-o := y 37 | where 38 | y; 39 | y-o 40 | 41 | eq-origin = ?(x, y);!y;eq-origin(|x) 42 | 43 | //rules 44 | // 45 | // nabl2-ast-eq(|x) = ?y;!(x,y);nabl2-ast-eq;!y 46 | -------------------------------------------------------------------------------- /icedust/trans/lib/graph.str: -------------------------------------------------------------------------------- 1 | module lib/graph 2 | 3 | rules 4 | 5 | /* 6 | * Implements a topological sort of the strongly connected components in the graph using the Tarjan algorithm. 7 | * http://en.wikipedia.org/wiki/Tarjan's_strongly_connected_components_algorithm 8 | * http://dx.doi.org/10.1137/0201010 9 | * 10 | * @type traverse-edges a -> List(a) 11 | * @type List(a) -> List(List(a)) 12 | */ 13 | external graph-topological-sort(traverse-edges|) 14 | 15 | rules 16 | -------------------------------------------------------------------------------- /icedust/trans/lib/intlist.str: -------------------------------------------------------------------------------- 1 | module lib/intlist 2 | 3 | imports 4 | 5 | lib/eq 6 | lib/lists-tuples 7 | 8 | rules // int* 9 | 10 | zeroOne = ![0,1] 11 | 12 | zeros: length -> zeros 13 | with 14 | zeros := [] 15 | 16 | rules // int ** 17 | 18 | binary-permutations: i -> perm 19 | with 20 | l := ; // int* 21 | perm := l // int** 22 | 23 | binary-permutations-nonzeros: i -> result 24 | with 25 | perm := i; 26 | zeros := i; 27 | result := perm 28 | 29 | rules // a* -> b* -> (a,b)* 30 | 31 | product(|l1): l2 -> [] 32 | where 33 | l1 := [] 34 | 35 | product(|l1): l2 -> [rest*, i1l2*] 36 | where 37 | [i1 | t1] := l1 38 | with 39 | rest* := l2; 40 | i1l2* := l2 41 | 42 | rules // int -> a* -> a** 43 | 44 | power(|i): l -> [[]] 45 | where 46 | i := 0 47 | 48 | power(|i): l -> result 49 | with 50 | iRec := i; // int 51 | resultRec := l; // a** 52 | x := resultRec; // (a,a*)* 53 | result := x // a** 54 | 55 | rules // (a,a*) -> a* 56 | 57 | tuple-head-list: (a, a*) -> [a | a*] 58 | -------------------------------------------------------------------------------- /icedust/trans/lib/new-name.str: -------------------------------------------------------------------------------- 1 | module lib/new-name 2 | 3 | rules // alternative implementation of newname, passing the names and counters around 4 | 5 | new-name: (prefix, history) -> (name, history') 6 | with 7 | history' := (prefix, history); 8 | name := $[[prefix][(prefix, history')]] 9 | 10 | in-history : (prefix, history) -> count 11 | where 12 | [(_, count)] := history 13 | 14 | in-history-prefix(|prefix): (prefix2, count) -> 15 | where 16 | (prefix, prefix2) 17 | 18 | update-history: (prefix, history) -> [(prefix,1)|history] 19 | where 20 | not(in-history) 21 | 22 | update-history: (prefix, history) -> history 23 | where 24 | in-history 25 | 26 | update-history-prefix(|prefix): (prefix2, count) -> (prefix2, count) 27 | where 28 | (prefix, prefix2) 29 | 30 | rules 31 | 32 | test-new-name: a -> a 33 | with 34 | (name1, history1) := ("a",[]); 35 | (name2, history2) := ("a",history1); 36 | (name3, history3) := ("b",history2); 37 | (name4, history4) := ("a",history3) 38 | 39 | 40 | -------------------------------------------------------------------------------- /icedust/trans/lib/option.str: -------------------------------------------------------------------------------- 1 | module lib/option 2 | 3 | rules 4 | 5 | try-option(s) = s < !Some() + !None() 6 | 7 | flatten-option-list = filter(\Some(x) -> x\) -------------------------------------------------------------------------------- /icedust/trans/lib/search.str: -------------------------------------------------------------------------------- 1 | module lib/search 2 | 3 | imports 4 | 5 | api/_runtime 6 | 7 | //rules // find a definition ast node for a certain name (with URI annotated) 8 | // 9 | // name-to-ast(|ast) = (_nabl-uri <+ nabl-get-name;_nabl-uri); uri-to-ast(|ast) 10 | // 11 | //rules // find a definition ast node for a certain URI 12 | // 13 | // uri-to-ast(|ast) = ?target-uri;!ast;optimized-search-single(uri-to-ast-continue(|target-uri),uri-to-ast-succeed(|target-uri)) 14 | // 15 | // uri-to-ast-succeed(|target-uri): ast-node -> ast-node 16 | // where 17 | // ast-node-uri := ast-node; 18 | // (ast-node-uri, target-uri) 19 | // 20 | // uri-to-ast-continue(|target-uri): a->b 21 | // where 22 | // b := a 23 | // 24 | // uri-to-ast-continue(|target-uri): a->a 25 | // where 26 | // a 27 | // 28 | // ast-node-has-uri-which-is-prefix-to(|target-uri): ast-node -> 29 | // where 30 | // node-uri := ast-node; 31 | // node-uri-ns := <_nabl-uri-namespace>node-uri; 32 | // target-uri-chopped := <_nabl-sub-uri(|node-uri-ns)>target-uri; 33 | // (target-uri-chopped, node-uri) 34 | // 35 | // nabl-get-name = fail 36 | 37 | rules // optimized search 38 | 39 | optimized-search-single(continue,succeed): a -> a 40 | where 41 | succeed 42 | 43 | optimized-search-single(continue,succeed): a -> result 44 | where 45 | a; 46 | arguments := a; 47 | result := arguments 48 | -------------------------------------------------------------------------------- /icedust/trans/lib/time.str: -------------------------------------------------------------------------------- 1 | module lib/time 2 | 3 | rules 4 | 5 | cputime = prim("SSL_cputime") 6 | 7 | cputime-to-seconds: 8 | cputime ->
(cputime, 1000000000) 9 | 10 | measure-time(s, match) = 11 | where(before := ); 12 | s; 13 | where(after := ; !(after, before); subt;cputime-to-seconds; match) 14 | -------------------------------------------------------------------------------- /icedust/trans/prettyprinting/pp.str: -------------------------------------------------------------------------------- 1 | module prettyprinting/pp 2 | 3 | imports 4 | 5 | libstratego-gpp 6 | // runtime/refactoring/- 7 | pp/icedust-parenthesize 8 | pp/icedust-pp 9 | prettyprinting/variations 10 | 11 | pp/_PrettyPrint-pp 12 | pp/Common-pp 13 | pp/Model-pp 14 | pp/Modules-pp 15 | pp/icedust-pp 16 | pp/Data-pp 17 | pp/Execute-pp 18 | pp/Expressions-pp 19 | pp/Types-pp 20 | 21 | rules 22 | 23 | pp-icedust-string = 24 | parenthesize-icedust 25 | ; apply-pp-variation 26 | ; prettyprint-icedust-start-symbols 27 | ; !V([], ) 28 | ; box2text-string(|120) 29 | 30 | pp-partial-icedust-string = 31 | parenthesize-icedust 32 | ; apply-pp-variation 33 | ; prettyprint-icedust 34 | ; !V([], ) 35 | ; box2text-string(|120) 36 | 37 | pp-debug : 38 | ast -> result 39 | with 40 | result := ast 41 | <+ ast 42 | ; result := "" 43 | 44 | rules 45 | 46 | construct-textual-change = construct-textual-change(pp-partial-icedust-string, parenthesize, override-reconstruction, resugar) 47 | 48 | rules 49 | 50 | pp-option(pp): x -> x 51 | where 52 | not(None() := x); 53 | not(Some(_) := x) 54 | -------------------------------------------------------------------------------- /icedust/trans/tiersplit/constructors.str: -------------------------------------------------------------------------------- 1 | module tiersplit/constructors 2 | 3 | signature constructors 4 | 5 | TierSplit: STRING -> Exp 6 | TierSplit: STRING * Exp -> Exp 7 | --------------------------------------------------------------------------------