Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

MUMPS for JAVA

NotificationsYou must be signed in to change notification settings

braylabs/m4j

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An attempt at making a MUMPS runtime environment for the java virtual machine (JVM) similar to how other programming languages such as Groovy, Scala, Ruby, Python etc. have utilized the JVM platform

  • ANTLR-based Lexer/parser that can interpret and execute M code
  • Compiler that can compile M code to JVM byte-code (very early, only 1-2 commands implemented)
  • Globals API/proxy
    • Plain java persistence (Using H2's MVStore storage engine)
    • Connecters back to InterSystems Cache (Using cache extreme drivers)
  • Runtime environment (~40% of the system commands/functions implemented)
  • Shell/console tool including:
    • command history
    • TAB-expansion of variable and routine names
    • VI/EMACS-style key bindings

About

  • Created byBrian Bray, President/Founder of BrayLabs
  • Initially created as an exercise in learning M while working for the VA on the Health Management Platform (HMP). The original project, not the current eHMP project.
  • This is an enhanced version of what was originally published as open source software by the VA toOSEHRA,
  • Questions/comments can be directed to me via email, or I also still lurk on theHardhats list a bit.

Prerequisites

  • Java (7 or 8)
  • Maven
  • InterSystems Cache (Optional)
  • ANTLR4 Eclipse Plugin (Optional)

Known issues

  • Currently will fail to fetch Cache dependencies, might need to comment them out or install into local maven repo manually
  • CacheGlobalStore doesn't work on OSX, the cache driver causes core dumps
  • There is still some quirky M code that the ANTLR grammar cannot handle
  • Not all the commands/system functions are implemented nor are they fully implemented and completely compatible
  • Some forms of indirection work, others do not

Quick start

git clone https://github.com/braylabs/m4j.gitcd m4jmvn package

Quick Start - Launch M4J Console

java -jar target/m4j-0.1.jarWelcome to M4J console, type 'H' to quitM4J> S SAY="HELLO",NAME="WORLD"M4J> W SAY_" "_NAMEHELLO WORLDM4J>

Quick Start - M4J Compiler

Currently only 1 M routine insrc/test/ compiles. This should generate a class file that can be utilized by regular java apps.

m4jc -package=m4j. -dest=target/m4jc/m4j src/test/java/com/braylabs/m4j/lang/M4JCTST.int

Quick Start - Java Code Example

importjava.io.File;importjava.io.IOException;importcom.braylabs.m4j.lang.M4JRuntime;importcom.braylabs.m4j.lang.M4JRuntime.M4JProcess;importcom.braylabs.m4j.lang.RoutineProxy;importcom.braylabs.m4j.lang.RoutineProxy.MInterpRoutineProxy;importcom.braylabs.m4j.lang.RoutineProxy.JavaClassProxy.M4JEntryPoint;importcom.braylabs.m4j.lang.RoutineProxy.JavaClassProxy.M4JRoutine;importstaticcom.braylabs.m4j.lang.MUMPS.*;publicclassDemo {publicstaticvoidmain(String[]args)throwsIOException {// Create a M4J runtime and register 2 routines:// 1) Register an annotated java static method as a M routine// 2) Load/Parse a M-language routine file from diskM4JRuntimeruntime =newM4JRuntime();runtime.registerRoutine(newRoutineProxy.JavaClassProxy(MyFirstM4JRoutine.class));runtime.registerRoutine(newMInterpRoutineProxy(newFile("src/main/mumps/XLFSTR.int")));// Create a M4J Process and evaluate a simple lineM4JProcessproc =newM4JProcess(runtime,123);proc.getInterpreter().evalLine("W !,$$SAY^HELLO($$UP^XLFSTR(\"world\")),!");}// Register this class as a M routine named 'HELLO'@M4JRoutine(name="HELLO")publicstaticclassMyFirstM4JRoutine {// With an entry point named 'SAY'@M4JEntryPoint(name="SAY")publicstaticStringhello(Stringval) {return"Hello: " +val;}}}

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp