Skip to content

🔨 Simple, intuitive, and powerful DSL inspired by multiple popular programming languages.

Notifications You must be signed in to change notification settings

andstor/mush-dsl

Repository files navigation

Mush logo

Mush DSL

Simple, intuitive, and powerful DSL inspired by multiple popular programming languages.

Mush is a DSL / Programming Language for writing in a pseudocode like style. The language is created with Ecore and Xtext. Mush features a compiler, which compiles Mush code down to Java code. Editing support for Eclipse is also available.

Examples - Documentation - Wiki

Table of Contents

Getting Started

There are multiple ways to get started using Mush. You may install the plugin using the prebuilt jar files. See the installation instructions below. You may also manually build the project(s) and launch a new Eclipse application. See the build section.

Once you have installed Mush into Eclipse, you may create a new mush file. This is a file with the extension name mush. For example HelloWorld.mush.

The following Mush code produces a Hello, world program:

executable HelloWorld()
    print "Hello, world!"

This compiles down to the following runnable Java code:

public class HelloWorld {
    public static void run() {
        System.out.print("Hello, world!");
    }
    
    public static void main(final String[] args) {
        run();
    }
}

Mush ships with several examples. These are found in the tdt4250.mush.examples project.

Install

You can download the latest archive build here.

This needs to be manually installed into Eclipse:

  1. Go to your Eclipse's dropins directory
  2. Create a subfolder (name doesn't matter)
  3. Uncompress .zip file here
  4. Restart Eclipse

Rationale

Most programming languages has a very crude syntax, including a lot of specific symbols and characters. These are often hard to understand for a person without much programming experience. We therefore wanted to make a language that could be expressed in a more natural style. The result of this was Mush. Mush provides a more pseudocode like syntax, without a lot of syntactical clutter.

Due to the language’s nature, it makes a great candidate for beginners to learn programming. Yet, it is powerful enough to express complex algorithms. Algorithms are often expressed in a pseudo like syntax. Mush would allow implementation of such "pseudo algorithms" in a more straight forward way. In particular, we have used the book "Introduction to Algorithms by Thomas H. Cormen et al., 3rd Edition” as inspiration for the syntax.

Xtext provides several features for easy integration with the Java ecosystem, for example Java types. It also provides a ready made grammar called Xbase. However, to get a better unnderstanding of Ecore and Xtext, we have choosen to not make use of such functionallity.

Structure

tdt4250.mush.model - Model for the Mush language.

tdt4250.mush.xtext - Mush core Xtext project based on Mush model.

tdt4250.mush.xtext.tests - Tests for Mush core Xtext project.

tdt4250.mush.xtext.ide - Mush Xtext IDE project.

tdt4250.mush.xtext.ui - Mush tests for Xtext UI project.

tdt4250.mush.xtext.ui.tests - Mush tests for Xtext UI project (TODO).

tdt4250.mush.examples - Mush example project.

Build

In order to build the project(s) you first need to import all the modules in this repository into your Eclipse workspace.

Eclipse should build class files automatically. Ensure that the Project -> Build Automatically is checked.

Right click on the GenerateMush.mwe2 in the core xtext bundle, and select Run As -> MWE2 Workflow.

In order to test the new build, a second Eclipse application should be launched with the Mush bundles installed. This is done by creating a new Eclipse run configuration.

Se the build instructions in the tdt4250.mush.xtext project and the Running Eclipse Plugin section in the tdt4250.mush.xtext.ui project for more detailed instructions.

License

Copyright © André Storhaug and Annabelle Solem Almås

About

🔨 Simple, intuitive, and powerful DSL inspired by multiple popular programming languages.

Topics

Resources

Stars

Watchers

Forks