Software and Languages

XMF and XMF-Mosaic


XMF is a programming language for Language Oriented Programming and developing Domain Specific Languages. XMF is a fully featured language that can be used to process XML, interface to Java (including EMF) and connect to input/output data streams. XMF is a very high-level OO language and supports a number of features that abstract away from implementation details including: dynamic typing; dynamically loaded definitions; sets and sequences; first-class functions; continuations; pattern matching. XMF provides first-class grammars that are used to define new language features which become immediately integrated into the core language. XMF is based on a small VM written in Java. Most of XMF is written in XMF.

XMF is available open-source under the Eclipse Public License.  XMF can be downloaded by following this link. The system is distributed as 4 eclipse projects including all the source code. Uner normal use you should only need com.ceteva.xmf.system. To run the language interpreter:

> cd com.ceteva.xmf.system/xmf-src
> cd xmf-src
> bin/compiler .


Sun May 01 11:37:38 BST 2011 (Built on Sun May 01 10:30:26 BST 2011)

Version 2.2

Type ?h for top level help.

[1] XMF> ?h

Top Level Loop Help

The XMF top level loop is a command interpreter that reads
commands typed at a console, evaluates the commands and then
prints the result. The interpreter understands any valid XMF syntax
(such as XOCL) including language extensions that have been defined
using XBNF and accessed using '@'. When you type these commands
you must terminate them with a ';' before pressing return (note that
';' is the command terminator and commands may span several lines).
Note if a single quote (') is used in a command it should be part of
of a pair. If not, input will be halted until another one is entered.

The command interpreter has its own state: it remembers the most
recently evaluated values and the last error that occurred.
The variables v0, v1 and v2 are the last three values produced
by the top level. These variables can be useful when you want to
navigate to or compute a value and then use it in a subsequent
command. Errors may occur in commands typed at the top level.
When an error occurs, an exception is thrown and caught by the top
level loop. The loop then prints out error diagnostics. The value
of the variable xx is the most recently raised exception.

The XMF Console uses the Escape key as an interrupt. This can be
useful if you have caused XMF to enter an infinite loop or to start
a lengthy calculation that you wish to terminate. Interrupts are
handled by XMF on the next instruction cycle, the interrupt will
throw an exception.

The command interpreter has its own command language.
Each top level command starts with a '?'. Top level commands must
occur on a single line and are terminated by return rather than ';'.

Top level commands

  ?ah                  Help on the syntax of patterns for ?a.

  ?a <PATTERN>         Named elements apropos the pattern.

  ?cl [<FILE>]         Combines ?c and ?l.

  ?c <FILE>            Compile the file.
  ?c                   Compile the most recently compiled file.

  ?h                   Top level command help.

  ?i [+|-] <PATH>*     Import(+) or remove(-) a name space at the top level.

  ?l <FILE>            Load the binary file.
  ?l                   Load the most recently loaded binary.

  ?m (b|l|d|bl) [<Dir>] Build, load or delete manifest entries.
  ?m w <Dir> <File>     Write boot file based on manifest to file.
  ?m t <Dir> (s|b)      Touch binaries or sources.

  ?o                   Print out the current options.
  ?o saveSource bool   Toggle compiler saving source code.
  ?o sourcePos  bool   Toggle compiler saving source positions.
  ?o localNames bool   Toggle compiler saving local names.
  ?o checkTypes bool   Toggle compiler type checking code.

  ?pp                  Display the current pretty-printing settings.
  ?pp (d|l,p,r) <INT>  Set the pretty print depth, length, page or ribbon.
  ?pp (on|off)         Toggle pretty printing at the top level.
  ?pp x                Display the most recent exception in full.

  ?sh                  Start a dos shell. Enter exit to return.

  ?s <FILE>            Saves a system image in the file.
  ?s <FILE> <FILE>     Saves an image that boots from the second file.

  ?stats               Print machine stats.

  ?t <FILE>            Update the last write date of the file.

  ?x                   Exit current XMF level.

[1] XMF> ?x


XMF-Mosaic is an Eclipse-based IDE for developing XMF applications. On first inspection, XMF-Mosaic provides similar functionality to most modelling tools that offer information modelling based on class diagrams. However, because XMF-Mosaic is based on XMF, models can be made executable through the XMF language. Furthermore, XMF-Mosaic provides an open-architecture since it is all written in XMF on top of a small collection of GEF primitives. Virtually all aspects of the modelling IDE can be redefined and extended by loading new XMF code. Documentation for XMF-Mosaic can be found here.