The Artima Developer Community
Sponsored Link

Agile Buzz Forum
MERL primer for openArchitectureWare Xpand users

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Steven Kelly

Posts: 294
Nickname: stevek
Registered: Jul, 2005

Steven Kelly is CTO at MetaCase and lead developer of the MetaEdit+ Domain-Specific Modeling tool
MERL primer for openArchitectureWare Xpand users Posted: Aug 31, 2009 3:30 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by Steven Kelly.
Original Post: MERL primer for openArchitectureWare Xpand users
Feed Title: Steven Kelly on DSM
Feed URL: http://www.metacase.com/blogs/stevek/stevek-rss.xml
Feed Description: Domain-Specific Modeling: A Toolmaker Perspective
Latest Agile Buzz Posts
Latest Agile Buzz Posts by Steven Kelly
Latest Posts From Steven Kelly on DSM

Advertisement

MERL and openArchitectureWare's Xpand languages are rather similar in approach and functionality. The main differences are in syntax and keywords, so learning one if you know the other is easy. In the MetaEdit+ forum I've posted a quick primer on how to translate from Xpand to MERL. The primer is below, with comments after the respective row where necessary.

Xpand MERL
SomeFixedText 'SomeFixedText'
«SOMECOMMAND» SOMECOMMAND
In XPand commands are quoted, whereas in MERL fixed text is quoted.
«DEFINE foo ... ENDDEFINE» Report 'foo' ... EndReport
In MERL, each report is defined on its own, not with several reports one after another in a single text.
Each report is defined on a particular Graph type (or the supertype of all, Graph itself).
«FILE Name + ".java" ... ENDFILE» filename :Name '.java' write ... close
«EXPAND foo FOREACH Bar» foreach .Bar { subreport 'foo' run }
You don't need to define a subreport, you can just put the commands from foo in the {}.
This often makes more sense, e.g. if you're not going to call foo from elsewhere.
 
foreach is for navigation from a graph to its elements.
For navigation between elements use "do" or "dowhile" (which covers SEPARATOR):
«EXPAND foo FOREACH Bar» do .Bar { subreport 'foo' run }
«EXPAND foo FOREACH Bar SEPARATOR ","» dowhile .Bar { subreport 'foo' run ','}
«this.name» :name
«LET ... AS var ..<var>.. ENDLET» variable 'var' write ... close ..$var..
For assignments with a single element on the right-hand side, you can use the shorter form: $var = 'foo', $var = :foo etc.
«REM...ENDREM» /*...*/
«PROTECT ID ... ... ENDPROTECT» md5id ... md5block ... md5sum
«CSTART ... CEND ...» filename 'bar.java'
md5start ... md5stop ...
merge .. .. .. close
The start and end sequences are specified in the filename command, since they will be the same for the whole file
«this.name.toUpper()» :Name%upper
For text manipulation, e.g. with Java in oAW, you can use MERL translators . Many are defined in _translators, such as %upper a-z A-Z, and you can define your own to convert any combination of characters, strings and regular expressions.

Read: MERL primer for openArchitectureWare Xpand users

Topic: Camp Smalltalk at ESUG 2009 Previous Topic   Next Topic Topic: We won the Gordon Pask Award

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use