MaSH (Making Stuff Happen)

About MaSH

MaSH introduces new programmers to Java using staged subsets of the language. The system specifies several clearly specified subsets of the Java language that eliminate the boilerplate that interferes with early learning of the purely procedural aspects of the Java language and a precompiler that adds the required boilerplate to produce a working Java program. The boilerplate that the precompiler adds is specified in an auxilliary source file. Therefore programs can be created that run in diverse environments: on a console; on a robot; or in a graphical user interface.

-

Examples

Java MaSH
/*
** file:       Sum1.java
** created:    25/5/8
** author:     Andrew Rock
** purpose:    A program to read two numbers
**             and print their sum.
*/

import java.util.*;

public class Sum1 {

   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      System.out.print("Enter a number: ");
      int x = sc.nextInt();
      System.out.print("Enter a number: ");
      int y = sc.nextInt();
      int z = x + y;
      System.out.print("The sum is: ");
      System.out.println(z).
   }
   
}
/*
** file:       Sum1.mash
** created:    25/5/8
** author:     Andrew Rock
** purpose:    A program to read two numbers
**             and print their sum.
** MaSH level: statements
*/

import console;

print("Enter a number: ");
int x = readInt();
print("Enter a number: ");
int y = readInt();
int z = x + y;
print("The sum is: ");
println(z);
/*
** file:       GoUntilPush.java
** created:    25/5/8
** author:     Andrew Rock
** purpose:    A program to drive a motor until
**             a touch sensor is pushed.
*/

import josx.platform.rcx;

public class GoUntilPush {

   public static void main(String[] args) 
   throws Exception {
      Sensor.S1.setTypeAndMode(
         SensorConstants.SENSOR_TYPE_TOUCH,
         SensorConstants.SENSOR_MODE_BOOL);
      Motor.A.forward();
      while (Sensor.S1.readBooleanValue()) {
      }
      while (!Sensor.S1.readBooleanValue()) {
      }
      Motor.A.stop();
   }

}
/*
** file:       GoUntilPush.mash
** created:    25/5/8
** author:     Andrew Rock
** purpose:    A program to drive a motor until
**             a touch sensor is pushed.
** MaSH level: statements
*/

import rcx;

setUpSensor(1, TOUCH);
motorForward(A, 7);
waitForPush(1);
motorStop(A);
Degugger window for Hanoi.mash

-

Downloads

Binary bundles

All you need to download if you're a student. Pick the one for your operating system.

platform GHC version package date
Windows 32-bit 7.6.3 mash-windows.zip 2014-07-30
Mac OS X (Snow Leopard or later) 10.6.4 Intel 7.6.3 mash-mac.zip 2014-07-30
Ubuntu (10.04) Intel 7.6.3 mash-linux-i386.zip 2014-07-30

Documentation

-

License

MaSH is available for use and modification under the terms of the GNU General Public License, version 2. That means any student or teacher can download and use this software for free, though there's no guarantee that it's going to work or be useful. The source code is provided, and you may modify it. Teachers are especially encouraged to develop new MaSH environments.

If you do find MaSH useful, please let me know, and I'll let you know about MaSH developments.

If you find a bug or deficiency in the MaSH tools or environments, let me know. (I'm not implying that the bugs will be fixed on any timescale that will suit you.)

-

MaSH Online

Try MaSH Online.

-

Log of recent changes

2014-07-30

console2 environment added.

2014-06-21

javaj implemented.

2014-06-18

MaSH Online completed.

2014-06-17

Made the debugger window slightly bigger.

Made it easier to find the downloads that matter.

More math methods added to all environments except RCX.

2014-06-14

mashj tool complete.

2014-06-08

All MaSH Haskell modules compile without any warnings.

2013-06-03

Added atan2 to all environments.

2012-05-25

nxt documentation fix.

2012-03-05

nxt environment bug, affects motor selection, fixed.

2012-02-07

mashn.bat fixed for Lejos_NXT-0.9.

2011-12-08

nxt environment now compatible with Lejos_NXT-0.9, and no longer compatible with Lejos_NXT-0.85 or previous.

2011-06-09

Examples for the format functions.

2011-06-08

Fixed an error in initialisation check. (Kudos to Carl Lusty, who found it purely by code inspection!)

Fixed debugger wrt array initialisers for constant arrays.

2011-05-31

Fixed an error in the debugger wrt array initialisers for local variables or in no-method programs. (Thanks Bent!)

2011-05-29

A little polishing after the internal reorganisation of error handling in the compiler.

Custom Show instance for Blocks to prevent looping.

2011-05-24

Internal reorganisation of error handling in the compiler, making it possible to use compiler phases in other tools without them exiting the whole program on an error.

2011-05-22

Made the String.format bindings a bit more robust with parentheses around the parameters.

2011-05-10

Added parseInt() etc to all environments.

2011-05-09

Added log() and exp() bindings to all environments.

2011-05-03

Added String.format bindings to PC environments. (Not supported in Lejos.)

Added \textbar to mashdoc's LaTeX to HTML converter.

2010-12-07

Added sound loading and playing to the graphics environment.

2010-11-29

Added mouse and key event handling to the graphics environment.

Added the missing formal parameter substitutions to the rendering of rewrites.

2010-11-26

Programs that don't implement rewrites marked mandatory will no longer compile with mashc, avoiding very confusing Java error messages.

2010-11-22

Added a warning when the name of a MaSH program collides with a class name in java.lang.

Changed code generation so that MaSH global variables and constants and methods are qualified by the program name, resolving name clashes that arise by using subclassing in an environment's definition.

Last modified Wed Jul 30 16:36:31 EST 2014 by Andrew Rock.