├── ~prototype ├── .mps │ ├── .name │ ├── misc.xml │ ├── vcs.xml │ ├── modules.xml │ ├── libraries.xml │ └── migration.xml ├── images │ ├── SU-26.png │ ├── types1.gif │ ├── types2.gif │ ├── reorder1.gif │ ├── subMenu1.gif │ ├── typeArg1.png │ ├── verbose1.gif │ ├── buildFirst.png │ ├── duplicate1.gif │ ├── emptyEditor.png │ ├── settingsMPS.gif │ ├── settingsMPS.png │ ├── addLocation1.gif │ ├── importScoping.gif │ ├── settingsCheck.gif │ ├── settingsMPS2.png │ ├── typeArgError.png │ ├── changeLocation1.gif │ ├── importDeclaration.gif │ ├── moduleDeclaration.gif │ ├── projectionalEditing.png │ └── moduleDeclarationExplorer.png ├── languages │ └── elm │ │ ├── icons │ │ ├── elm.png │ │ ├── elm16x16.ico │ │ └── elm32x32.ico │ │ ├── sandbox │ │ ├── elm.sandbox.msd │ │ └── models │ │ │ ├── elm.sandbox.mps │ │ │ └── elm.sandbox.examples.mps │ │ ├── generator │ │ └── template │ │ │ └── main@generator.mps │ │ ├── models │ │ ├── elm.core.mps │ │ ├── elm.actions.mps │ │ └── elm.intentions.mps │ │ └── elm.mpl ├── .gitignore ├── .gitattributes ├── solutions │ ├── elm.stubs │ │ ├── elm.stubs.msd │ │ └── models │ │ │ └── elm.stubs.stubs.mps │ └── elm.runtime │ │ ├── elm.runtime.msd │ │ └── models │ │ └── elm.runtime.ui.mps ├── LICENSE └── README.md ├── .gitignore ├── Resources.md ├── .gitattributes ├── Grammar.md └── README.md /~prototype/.mps/.name: -------------------------------------------------------------------------------- 1 | elm -------------------------------------------------------------------------------- /~prototype/images/SU-26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/SU-26.png -------------------------------------------------------------------------------- /~prototype/images/types1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/types1.gif -------------------------------------------------------------------------------- /~prototype/images/types2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/types2.gif -------------------------------------------------------------------------------- /~prototype/images/reorder1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/reorder1.gif -------------------------------------------------------------------------------- /~prototype/images/subMenu1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/subMenu1.gif -------------------------------------------------------------------------------- /~prototype/images/typeArg1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/typeArg1.png -------------------------------------------------------------------------------- /~prototype/images/verbose1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/verbose1.gif -------------------------------------------------------------------------------- /~prototype/images/buildFirst.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/buildFirst.png -------------------------------------------------------------------------------- /~prototype/images/duplicate1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/duplicate1.gif -------------------------------------------------------------------------------- /~prototype/images/emptyEditor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/emptyEditor.png -------------------------------------------------------------------------------- /~prototype/images/settingsMPS.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/settingsMPS.gif -------------------------------------------------------------------------------- /~prototype/images/settingsMPS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/settingsMPS.png -------------------------------------------------------------------------------- /~prototype/images/addLocation1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/addLocation1.gif -------------------------------------------------------------------------------- /~prototype/images/importScoping.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/importScoping.gif -------------------------------------------------------------------------------- /~prototype/images/settingsCheck.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/settingsCheck.gif -------------------------------------------------------------------------------- /~prototype/images/settingsMPS2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/settingsMPS2.png -------------------------------------------------------------------------------- /~prototype/images/typeArgError.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/typeArgError.png -------------------------------------------------------------------------------- /~prototype/images/changeLocation1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/changeLocation1.gif -------------------------------------------------------------------------------- /~prototype/languages/elm/icons/elm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/languages/elm/icons/elm.png -------------------------------------------------------------------------------- /~prototype/images/importDeclaration.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/importDeclaration.gif -------------------------------------------------------------------------------- /~prototype/images/moduleDeclaration.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/moduleDeclaration.gif -------------------------------------------------------------------------------- /~prototype/images/projectionalEditing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/projectionalEditing.png -------------------------------------------------------------------------------- /~prototype/languages/elm/icons/elm16x16.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/languages/elm/icons/elm16x16.ico -------------------------------------------------------------------------------- /~prototype/languages/elm/icons/elm32x32.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/languages/elm/icons/elm32x32.ico -------------------------------------------------------------------------------- /~prototype/images/moduleDeclarationExplorer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-ember/elmMPS/HEAD/~prototype/images/moduleDeclarationExplorer.png -------------------------------------------------------------------------------- /~prototype/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | workspace.xml 3 | 4 | _spreferences 5 | artifacts 6 | tmp 7 | **/source_gen 8 | **/source_gen.caches 9 | **/classes_gen 10 | build-languages.xml 11 | build 12 | -------------------------------------------------------------------------------- /~prototype/.mps/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /~prototype/.mps/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | MPS 2 | .idea 3 | workspace.xml 4 | 5 | _spreferences 6 | artifacts 7 | tmp 8 | **/source_gen 9 | **/source_gen.caches 10 | **/classes_gen 11 | build-languages.xml 12 | build 13 | 14 | *~ 15 | *.swp 16 | libavoid-debug.svg 17 | config 18 | system -------------------------------------------------------------------------------- /~prototype/.gitattributes: -------------------------------------------------------------------------------- 1 | trace.info text merge=mps 2 | generated text merge=mps 3 | dependencies text merge=mps 4 | *.mpl text merge=mps 5 | *.msd text merge=mps 6 | *.devkit text merge=mps 7 | *.mpr text merge=mps 8 | *.mpsr text merge=mps 9 | *.model text merge=mps 10 | *.mps text merge=mps 11 | -------------------------------------------------------------------------------- /Resources.md: -------------------------------------------------------------------------------- 1 | Just some pointers to the most relevant resources about MPS and Elm. 2 | 3 | ### MPS 4 | 5 | * [MPS home](https://www.jetbrains.com/mps/) 6 | * [MPS Slack](jetbrains-mps.slack.com) 7 | * [mps.rocks](https://mps.rocks/): a collection of "everything MPS" 8 | 9 | 10 | ### Elm 11 | 12 | * [Elm home](https://elm-lang.org/) 13 | * [Elm Slack](elmlang.slack.com) 14 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | trace.info text merge=mps 2 | generated text merge=mps 3 | dependencies text merge=mps 4 | *.mpl text merge=mps 5 | *.msd text merge=mps 6 | *.devkit text merge=mps 7 | *.mpr text merge=mps 8 | *.mpsr text merge=mps 9 | *.model text merge=mps 10 | *.mps text merge=mps 11 | *.jar filter=lfs diff=lfs merge=lfs -text 12 | MPS/2021.3/jbr/lib/modules filter=lfs diff=lfs merge=lfs -text 13 | MPS/2021.3/lib/platform-impl.jar filter=lfs diff=lfs merge=lfs -text 14 | MPS/2021.3/lib/3rd-party.jar filter=lfs diff=lfs merge=lfs -text 15 | -------------------------------------------------------------------------------- /~prototype/.mps/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /~prototype/.mps/libraries.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 17 | -------------------------------------------------------------------------------- /~prototype/.mps/migration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /~prototype/solutions/elm.stubs/elm.stubs.msd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /~prototype/languages/elm/sandbox/elm.sandbox.msd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | c0931ad6-74fd-4fe7-af37-a5307cd2a095(elm.stubs) 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /~prototype/languages/elm/generator/template/main@generator.mps: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /~prototype/languages/elm/models/elm.core.mps: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Grammar.md: -------------------------------------------------------------------------------- 1 | # About 2 | 3 | This file tries to document how the elm language grammar / its primitives are understood and implemented in this project. A main resource for this is [ElmParser.bnf](https://github.com/klazuka/intellij-elm/blob/master/src/main/grammars/ElmParser.bnf) from the IntelliJ Elm plugin. 4 | Since MPS does not use/generate parsers, we need to translate the abstract syntax into the **structure** language aspect, and the concrete syntax into the **editor** aspect. 5 | Feedback about issues is always welcome. 6 | 7 | # Notation 8 | 9 | I try using a EBNF-like notation to document the grammar here, to avoid technical boilerplate and give me some leeway in how accurate this description has to be (it is just meant to be consumed by humans, not machines). 10 | 11 | # Module 12 | 13 | The only root concept. It corresponds to "elm files" in the textual world. 14 | 15 | ``` 16 | Module := 17 | moduleDeclaration=AModuleDeclaration? // ? means optional (zero-to-one cardinality) 18 | importStatements+=ImportStatement* // * means zero-to-many cardinality 19 | exposables+=IExposable* // I use the term "exposable" over top-level-declaration or similar, it helps with implementing scoping for what can be exposed; these semantics are hard to express in EBNF-like syntaxes, however 20 | 21 | AModuleDeclaration implements IExpose := 22 | EffectModuleDeclaration | 23 | ModuleDeclaration 24 | 25 | // this is actually not yet implemented 26 | EffectModuleDeclaration := 27 | 'effect' 'module' name=ID 'where' recordExpr=RecordExpr exposure=Exposure 28 | 29 | ModuleDeclaration := 30 | isPort?='port'? 'module' name=ID exposure=Exposure 31 | ``` 32 | 33 | # ImportStatement 34 | 35 | ``` 36 | ImportStatement implements IExpose := 37 | 'import' moduleDeclarationTarget=[AModuleDeclaration|ID] alias=AliasDeclaration? exposure=Exposure? 38 | 39 | ``` 40 | 41 | # IExposable 42 | 43 | tbd. 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This repository is about to be restructured. 2 | Please refer to the [prototype's readme](https://github.com/digital-ember/elmMPS/blob/master/~prototype/README.md) for more details for now. 3 | 4 | # Contributing 5 | 6 | Contributors are welcome! Just contact me here, on [elmlang Slack](elmlang.slack.com) (user: digital-ember), or on [MPS Slack](jetbrains-mps.slack.com) (user: Robert Walter). 7 | 8 | ## Required software 9 | 10 | We use 11 | 12 | - MPS 2021.3.1 ([win exe downloader](https://download.jetbrains.com/mps/2021.3/MPS-2021.3.1.exe?_ga=2.221642456.1330314823.1669652849-1666225210.1667657022&_gl=1*cuvhz1*_ga*MTY2NjIyNTIxMC4xNjY3NjU3MDIy*_ga_9J976DJZ68*MTY2OTY1Mjg0OC4xMi4xLjE2Njk2NTI4NjYuMC4wLjA.), [MacOS dmg](https://download.jetbrains.com/mps/2021.3/MPS-2021.3.1-macos.dmg?_ga=2.249950278.1330314823.1669652849-1666225210.1667657022&_gl=1*kneijr*_ga*MTY2NjIyNTIxMC4xNjY3NjU3MDIy*_ga_9J976DJZ68*MTY2OTY1Mjg0OC4xMi4xLjE2Njk2NTI4NjYuMC4wLjA.), [MacOS Apple Silicon dmg](https://download.jetbrains.com/mps/2021.3/MPS-2021.3.1-macos-aarch64.dmg?_ga=2.249950278.1330314823.1669652849-1666225210.1667657022&_gl=1*kneijr*_ga*MTY2NjIyNTIxMC4xNjY3NjU3MDIy*_ga_9J976DJZ68*MTY2OTY1Mjg0OC4xMi4xLjE2Njk2NTI4NjYuMC4wLjA.), [Linux tar.gz](https://download.jetbrains.com/mps/2021.3/MPS-2021.3.1.tar.gz?_ga=2.205451728.1330314823.1669652849-1666225210.1667657022&_gl=1*1pvpjcz*_ga*MTY2NjIyNTIxMC4xNjY3NjU3MDIy*_ga_9J976DJZ68*MTY2OTY1Mjg0OC4xMi4xLjE2Njk2NTI4NjYuMC4wLjA.)) 13 | - [MPS extensions](https://artifacts.itemis.cloud/repository/maven-mps/de/itemis/mps/extensions/2021.3.2478.32dbb86/extensions-2021.3.2478.32dbb86.zip): Download this zip file, extract it some place on your machine, and [add it later to the project dependencies](https://github.com/digital-ember/elmMPS/blob/master/~prototype/README.md#setting-up-the-environment--opening-the-project) 14 | - OpenJDK 11 (which comes with at least the Windows installer) 15 | 16 | 17 | # Missing language concepts 18 | 19 | - `effect` ModuleDeclaration 20 | - Top Level 21 | - TypeAnnotation 22 | - PortAnnotation 23 | - InfixDeclaration 24 | 25 | -------------------------------------------------------------------------------- /~prototype/solutions/elm.runtime/elm.runtime.msd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 498d89d2-c2e9-11e2-ad49-6cf049e62fe5(MPS.IDEA) 16 | 8865b7a8-5271-43d3-884c-6fd1d9cfdd34(MPS.OpenAPI) 17 | 6354ebe7-c22a-4a0f-ac54-50b52ab9b065(JDK) 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /~prototype/languages/elm/sandbox/models/elm.sandbox.mps: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /~prototype/languages/elm/models/elm.actions.mps: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /~prototype/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /~prototype/languages/elm/elm.mpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 2d3c70e9-aab2-4870-8d8d-6036800e4103(jetbrains.mps.kernel) 64 | 6354ebe7-c22a-4a0f-ac54-50b52ab9b065(JDK) 65 | 24c96a96-b7a1-4f30-82da-0f8e279a2661(de.itemis.mps.editor.celllayout.styles) 66 | f3061a53-9226-4cc5-a443-f952ceaf5816(jetbrains.mps.baseLanguage) 67 | 7a5dda62-9140-4668-ab76-d5ed1746f2b2(jetbrains.mps.lang.typesystem) 68 | 2b0e8709-a9bb-4866-b55c-b010c03a2564(elm.runtime) 69 | 1ed103c3-3aa6-49b7-9c21-6765ee11f224(MPS.Editor) 70 | c1f84ca7-1d95-4edc-a710-47d158ac5985(elm) 71 | 5dae8159-ab99-46bb-a40d-0cee30ee7018(jetbrains.mps.lang.constraints.rules.kinds) 72 | 34e84b8f-afa8-4364-abcd-a279fddddbe7(jetbrains.mps.editor.runtime) 73 | 8865b7a8-5271-43d3-884c-6fd1d9cfdd34(MPS.OpenAPI) 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 2b0e8709-a9bb-4866-b55c-b010c03a2564(elm.runtime) 143 | 144 | 145 | 146 | 147 | -------------------------------------------------------------------------------- /~prototype/solutions/elm.stubs/models/elm.stubs.stubs.mps: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | -------------------------------------------------------------------------------- /~prototype/README.md: -------------------------------------------------------------------------------- 1 | # Table of Contents 2 | 3 | 1. [elmMPS](#elmMPS) 4 | 1. [Disclaimer](#disclaimer) 5 | 1. [What (not) to expect](#what-not-to-expect) 6 | 1. [Please don't ...](#please-dont-) 7 | 1. [Examples](#examples) 8 | 1. [Projectional editing - Basics](#projectional-editing---basics) 9 | 1. [Empty Elm-Module](#empty-elm-module) 10 | 1. [Adding a module declaration](#adding-a-module-declaration) 11 | 1. [_Aside:_ about the two name properties](#aside-about-the-two-name-properties) 12 | 1. [Adding an import declaration](#adding-an-import-declaration) 13 | 1. [The substitution menu (aka code completion)](#the-substitution-menu-aka-code-completion) 14 | 1. [_Aside:_ Substitution menu tipp](#aside-substitution-menu-tipp) 15 | 1. [Types and Type Aliases](#types-and-type-aliases) 16 | 1. [Merits of explicitly editing structure](#merits-of-explicitly-editing-structure) 17 | 1. [Duplicating nodes by pressing CTRL+D](#duplicating-nodes-by-pressing-ctrld) 18 | 1. [Reordering sequences by pressing CTRL+ALT+UP/DOWN](#reordering-sequences-by-pressing-ctrlaltupdown) 19 | 1. [Having multiple projections](#having-multiple-projections) 20 | 1. [Exploring the project yourself](#exploring-the-project-yourself) 21 | 1. [Required software](#required-software) 22 | 1. [Setting up the environment / opening the project](#setting-up-the-environment--opening-the-project) 23 | 1. [Check to see if MPS-extensions is loaded successfully](#check-to-see-if-MPS-extensions-is-loaded-successfully) 24 | 1. [Building project for the first time](#building-project-for-the-first-time) 25 | 26 | # elmMPS 27 | A prototypical implementation of the [elm language](https://elm-lang.org/) with [JetBrains MPS](https://www.jetbrains.com/mps/), sporting a projectional editor. 28 | 29 | [tl;dr: _jump to examples_](#examples) 30 | 31 | # Disclaimer 32 | 33 | This project currently has three selfish purposes: 34 | 1. To get more familiar with Elm 35 | 2. To learn how to implement nice editor experiences in MPS 36 | 3. To experiment with implementing a typesystem in MPS 37 | 38 | Still, if you are interested in looking into this project and provide feedback or ask questions, you are more then welcome to do so. 39 | 40 | ## What (not) to expect 41 | This project does not have the goal to become a fully fledged implementation of Elm for folks to rely upon and use in production. It is really meant to explore the projectional editor and, to a certain degree, the typesystem aspect of MPS. Things like code generation or the import of textual Elm source code are currently out of scope. 42 | ** Update Novemebr 2022 ** 43 | While above was true for the original prototype, I decided to revive the project with some more ambitious goals, which I will share shortly. 44 | 45 | ## Please don't ... 46 | This is not meant to spawn a general discussion on what's better, projectional or textual editing. I don't see a point in discussing such questions without having a confined context. 47 | 48 | # Examples 49 | Since most people are not familiar with JetBrains MPS and it is not so straightforward to "just get started", I decided to put some GIFs in this Readme to demonstrate some of the editor's capabilites. If you are still interested how to browse the MPS project and play with the editor yourself, refer to [this section](README.md#exploring-the-project-yourself). 50 | 51 | Before I want to explore higher levels of abstraction in the language and the editor, I wanted to try and build a projection that is very close to the concrete syntax of Elm (v0.19.1). 52 | There will be some slight changes sprinkled in here and there, either for the purpose of teasing ideas, or because the projectional editor requires them. 53 | 54 | ## Projectional editing - Basics 55 | [tl;dr: _show me the examples already_](README.md#empty-Elm-Module) 56 | 57 | For those not familiar with projectional editors, here is a nice illustration by Markus Völter that compares textual editing (left) with projectional editing (right). 58 | 59 | ![projectional editing](images/projectionalEditing.png) 60 | 61 | When you write code as text, a parser is involved to translate your text into a data structure, usually called an Abstract Syntax Tree (AST). Broadly speaking, this data structure is fed into other parts of a compiler to perform certain tasks like semantic analysis, code optimization, translation, and the like. In a projectional world, there is no parser! You create programs by directly manipulating the AST of your program. The "projection" is what exposes the AST to you in one way or the other on a screen. We'll see how this can look like for Elm next, so let's move on and look at specific examples. 62 | 63 | ## Empty Elm-Module 64 | Since MPS allows you to create an manipulate the AST (tree!) directly, the first class citizen a use ris interacting with in every language are **Nodes**. Nodes live under a (MPS-)model, and each root node can be opened in a separate editor. So I decided to make a _Elm-Module_ a root node. When we create a new Elm-Module, an empty editor looks like this: 65 | 66 | ![emptyEditor](images/emptyEditor.png) 67 | 68 | It features three placeholders, which could also be hidden, but it is a good practice in projectional editing to work with "placeholder hints" to let users know where a cursor can be placed and the program can be manipulated. Remember, this is not a text file! Think of it as a form-like canvas with context-sensitive interactions. 69 | 70 | ## Adding a module declaration 71 | Though we are not using a textual editor, the concrete syntax of Elm we try to mimic is textual, so it is only natural to start out with a projectional editor that behaves similarly to a textual editor in many contexts. Declaring a module signature, for example. 72 | 73 |
74 | Show/Hide example 75 | 76 | ![moduleDeclaration](images/moduleDeclaration.gif) 77 |
78 | 79 | With the cursor at our placeholder, we can just type "module_Demo", where "\_" indicates a SPACE, to add a node of type **ModuleDeclaration** and the name property "Demo". 80 | 81 | Adding the **Exposing** node already contains a bit of projectional editing magic. With the cursor at the of our module name, we can continue typing "\_e". The space indicates we finished our module name (just like we do it in a textual editor), but subsequently pressing the "e" key triggers a so-called "side transformation" in MPS. This transformation automatically adds an **Exposure** node to the **ModuleDeclaration**, and since we are in a projectional editor, this node gets rendered on screen immediately. 82 | 83 | Now, one can ask why the module itself does not have the same behavior (pressing "m" at the very beginning magically adding the **ModuleDeclaration**). No specific reason other then being able to demonstrate both capabilities in one "line" of code. 84 | 85 | Another question that might come up: Why isn't the **Exposure** node immediatly added to the **ModuleDeclaration**, since it is mandatory. While this is true and it could be easily achieved, I erred on the side of a more fluent editing experience, since this is the focus of this project. 86 | 87 | Let's look at MPS' _Node Explorer_ for this simple example to verify that we are building a AST. A node in MPS can have **properties**, **children**, and **references**. The node explorer allows us to inspect the structure of a node. In this case, we look at the root node of type (a.k.a. concept) **Module**. Remember that the root node is the "complete editor". 88 | 89 | ![moduleDeclarationExplorer](images/moduleDeclarationExplorer.png) 90 | 91 | The root node **Module** with the name "Demo" has one child. It's a **ModuleDeclaration** node, also with the a name property of value "Demo". The **Exposue** node is a child of the **ModuleDeclaration** and contains no properties, references, or children. 92 | ___ 93 | ### _Aside:_ about the two name properties 94 | The two name properties are not really redundant. Since a **Module** in Elm does not necessarily have a **ModuleDeclaraion**, the user can still provide a name to the **Module** if required, providing a 'filename' so to speak. However, if there does exist a **ModuleDeclaration**, its name overrides a potential **Module** name, so that the name of the **ModuleDeclaration**, if existent, also automatically determines the "file name". 95 | ___ 96 | 97 | ## Adding an import declaration 98 | Let me use the import statement to demonstrate the fluent, text-like input capabilities once more: 99 | 100 |
101 | Show/Hide example 102 | 103 | ![importDeclaration](images/importDeclaration.gif) 104 |
105 | 106 | Similarly to the **Exposure** node in the **ModuleDeclaration**, adding a **Alias** node is triggered by a side transformation when the user types "\_a" after the name of the imported module (in this case "Html"). 107 | Notice that the "Html" module is just a stub module, another root node I declared for demoing purposes. 108 | 109 | More interesting is that "Html" is not a name property, but an actual reference to another (**Module**) node, defined in a different MPS model. Again, this one is just a stub, but it demonstrates that **scoping** is also part of the language: 110 | 111 |
112 | Show/Hide example 113 | 114 | ![importScoping](images/importScoping.gif) 115 |
116 | 117 | ## The substitution menu (aka code completion) 118 | One of the powerful features of MPS is the built-in and customizable sustitution menu. Within a editable cell one can invoke a context-sensitive menu by pressing CTRL+SPACE. This will present you a list of elements that are available ("in scope") in the given context. This menu can be filtered by typing: 119 | 120 |
121 | Show/Hide example 122 | 123 | ![subMenu1](images/subMenu1.gif) 124 |
125 | 126 | This works for references (see import statement), properties (see import alias name), and of course for adding new children (see function declaration). 127 | 128 | ___ 129 | ### _Aside:_ Substitution menu tipp 130 | One of many nice things about the substitution menu is that you can use the filtering ability even before you invoke the substitution menu. In the next section about types and type aliases, I start out by writing "ta", knowing that this narrows down the scope to one hit (**type alias**) and press CTRL+SPACE only then. This immediately inserts the corresponding node into our program, since it is unambiguous to MPS what my intention is. 131 | ___ 132 | 133 | ## Types and Type Aliases 134 | While still certainly not 100% correct, one can already define basic types and type aliases. 135 | 136 |
137 | Show/Hide example 138 | 139 | ![types1](images/types1.gif) 140 |
141 | 142 | One thing we see is that the formatting is "fixed". Again, this is not a text editor. Instead, the position of the cells for each editor is predetemined. Luckily, this doesn't mean there is no flexibility how cells can be layed out. Rather, the layout of each element in the editor can be defined context sensitive as well, something we will see in a later example. 143 | 144 | This example is rather here to show 145 | a) how fluently the editor can be used, and 146 | b) that there exists no need for rename refactorings 147 | 148 | I want to emphasize the second point: Since this is an AST we are interacting with, all references are _real references_. Names (technically) don't matter. Renaming a definition will **automagically update all reference projections**, since that's all they are: projections of the same piece of data, i.e. the name of a declaration. 149 | 150 | ## Merits of explicitly editing structure 151 | Let's consider a slightly more complex example. 152 | 153 | ![typeArg1](images/typeArg1.png) 154 | 155 | Imagine we would like to enhance the "Regular" variant of the **User** type by a **Location** argument type. Due to Elm's concrete syntax, just writing something like "Location String" in a text editor would result in a compiler error: 156 | 157 | ![typeArgError](images/typeArgError.png) 158 | 159 | In our projectional editor, we cannot just type in "Location String", can we? Well, yes and no. We CANNOT make the mistake of forgetting the parentheses, since our editor knows the structure of the language. So, when we add a reference to a node with type arguments, like **Location**, the required fields are added automatically! 160 | The parentheses are also added automatically and just visual aid for the reader. The AST does not care about this kind punctuation, since it has structure. 161 | 162 |
163 | Show/Hide example 164 | 165 | ![addLocation1](images/addLocation1.gif) 166 |
167 | 168 | Still, what if the signature of a declaration changes? Let's imagine **Location** gets a second argument called "b". Let's see what happens: 169 | 170 |
171 | Show/Hide example 172 | 173 | ![changeLocation1](images/changeLocation1.gif) 174 |
175 | 176 | We see that, as soon as the declaration of **Location** changes, the reference is marked with an error. We could just add the missing argument manually, but I want to show the intention/quickfix feature. Pressing ALT+ENTER opens another context sensitive menu that offers actions that can be arbitrarily complex. In our case, we just use it to "fix" the **Location** reference by adding a second, initially "empty" type. 177 | 178 | We will see more sophisticated examples of the intentions menu later. 179 | 180 | Some other nice features that are generally baked in into MPS editors: 181 | 182 | ### Duplicating nodes by pressing CTRL+D 183 | 184 |
185 | Show/Hide example 186 | 187 | ![duplicate1](images/duplicate1.gif) 188 |
189 | 190 | MPS is smart about which nodes it can duplicate, so it won't allow me to duplicate the module declaration, for example, since there can only be one. 191 | 192 | ### Reordering sequences by pressing CTRL+ALT+UP/DOWN 193 | 194 |
195 | Show/Hide example 196 | 197 | ![reorder1](images/reorder1.gif) 198 |
199 | 200 | This can be very handy to reorganize your code! 201 | 202 | ### Having multiple projections 203 | Using the **TypeDeclaration** once more, I want to demonstrate another powerful capability of projectional editors, namely multiple projections. Nothing is stopping us to project our AST in different ways. This is particularly powerful for languages of higher levels of abstraction, but it can also be used for educational purposes, by showing or hiding certain things, or just displaying them differently. 204 | For example, to make it more explicit that a constructor is actually defining a function with a signature, I implemented a more "verbose" version of the type editor: 205 | 206 |
207 | Show/Hide example 208 | 209 | ![verbose1](images/verbose1.gif) 210 |
211 | 212 | Notice the _Inspector_ window on the bottom. It's a context sensitive window where additional information can be put. It is not necessary to put the "switch" for toggling between available editors there, it's just one way of doing it. 213 | 214 | Here is another, slightly longer example of what you can do in a projecitonal editor: 215 | 216 |
217 | Show/Hide example 218 | 219 | ![types2](images/types2.gif) 220 |
221 | 222 | # Exploring the project yourself 223 | Notice that this should work for both Windows and MacOS. However, people with OSX reported issues opening the project or setting up the MPS-extensions library. I try to provide a description that works, but let me know if you still face issues getting the project up and running. 224 | 225 | ## Required software 226 | - [MPS 2021.3.1](https://www.jetbrains.com/mps/download/) 227 | - notice that, depending on when you read this, version 2021.3.1 might be available for download only from the [previous releases page](https://www.jetbrains.com/mps/download/previous.html) 228 | - download the [MPS-extensions](https://artifacts.itemis.cloud/repository/maven-mps/de/itemis/mps/extensions/2021.3.2478.32dbb86/extensions-2021.3.2478.32dbb86.zip), a collection of useful libraries I make use of in this project 229 | - unzip the archive to a locaiton of your choice; it's recommended to put it close to your MPS installation folder, maybe next to it below a common root folder, to easier find it. 230 | - [Git LFS](https://git-lfs.github.com/) to handle larger files 231 | 232 | ## Setting up the environment / opening the project 233 | - clone/download [this repository](https://github.com/digital-ember/elmMPS) 234 | - start the MPS application (might take a few seconds) 235 | - once started use **Open Project...** and select the root folder of your local copy of this project 236 | - after loading the project for the first time, a path variable that points to the MPS-extensions library is missing, so you cannot successfully build the project yet 237 | - if you get a little notification on the bottom right that looks like the one below, use the link to open the settings directly 238 | 239 | ![settingsMPS2](images/settingsMPS2.png) 240 | 241 | - otherwise, open the settings manually: 242 | - **Windows**: in the main menu, open "File->Settings..." 243 | - **MacOS**: in the main menu, open "MPS->Preferences..." 244 | - in the top left search bar, enter "path" to filter the settings navigation to easier find the "Path Variables" section 245 | - in this section use the little "+" Button (find it on the top right for Windows or the bottom left for MacOS) to add a new entry called "mps-extensions" and a value that points to the root directory of the MPS-extensions on your machine 246 | - if you are prompted to reload the project, agree to that, otherwise you have to close the project and re-open it again manually 247 | 248 | ### Check to see if MPS-extensions is loaded successfully 249 | - in the project navigator on the left side of MPS, go to **Module Pool** at the botton and see if there are entries under *Languages->com* and *Languages->de* 250 | - if yes, the MPS-extensions have been set up successfully 251 | - if no, please contact me and I will try to help you get set-up 252 | 253 |
254 | Show/Hide example 255 | 256 | ![settingsCheck](images/settingsCheck.gif) 257 |
258 | 259 | ## Building project for the first time 260 | You should now be ready to build the language for the first time: 261 | 262 | ![buildFirst](images/buildFirst.png) 263 | 264 | In the project pane, open the context menu for the language module "elm" (yellow icon with a 'L') and select "Rebuild Language 'elm'". 265 | Ignore errors the checker might have found and force MPS to build the project. 266 | 267 | 268 | 269 | _More information on the the project itself yet to come :(_ 270 | -------------------------------------------------------------------------------- /~prototype/languages/elm/sandbox/models/elm.sandbox.examples.mps: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | -------------------------------------------------------------------------------- /~prototype/solutions/elm.runtime/models/elm.runtime.ui.mps: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | -------------------------------------------------------------------------------- /~prototype/languages/elm/models/elm.intentions.mps: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | --------------------------------------------------------------------------------