@MASTERSTHESIS\{IMM2012-06372, author = "P. Borowian", title = "Redesigning the language for business logic in the Maconomy {ERP} system and automatic translation of existing code", year = "2012", school = "Technical University of Denmark, {DTU} Informatics, {E-}mail: reception@imm.dtu.dk", address = "Asmussens Alle, Building 305, {DK-}2800 Kgs. Lyngby, Denmark", type = "", note = "Supervised by Ekkart Kindler, eki@imm.dtu.dk, Christian W. Probst, probst@imm.dtu.dk, {DTU} Informatics, and Martin Gamwell Dawids, Rune Glerup, Deltek", url = "http://www.imm.dtu.dk/English.aspx", abstract = "Maconomy Scripting Language (MSL) is a Domain Specific Language (DSL) for expressing business logic in the Maconomy {ERP} System, developed by Maconomy [1]. For various reasons, which are discussed in Chapter {1,} Deltek has decided to investigate the possibility of replacing {MSL} by Scala as a new business logic development language. This thesis defines a subset of {MSL,} called {MSL} core, that comprises the core features of the language. It then introduces a number of extensions to Scala, which altogether make up MScala \&\#8722; a proposed replacement for {MSL} core. In the course of this thesis we argue that MScala allows for expressing business logic in Maconomy at the same or higher level of abstraction than {MSL} core. It means that, in most cases, the same functionality can be expressed in a more succinct and elegant manner in MScala than in {MSL,} but very rarely, if at all, the other way around. Moreover, we show that Scala is well-suited for embedding domain specific languages. It allows domain specialists (Maconomy business logic programmers for that matter) to define libraries that look and feel like built-in language constructs. This lightweight way of embedding DSLs in Scala makes it much easier to gradually abstract business logic concepts in Maconomy from technical artifacts so that business problems can be solved at the right level of abstraction. Finally, we provide a prototype {MSL} core to MScala translator along with a precise description of the correspondence between particular {MSL} core and MScala constructs. In addition to that, this thesis defines a clear and scalable architecture of a source to source translator, based on state-of-the-art concepts and technologies like attribute grammars [2] and rewrite rules [3]. The proposed architecture, which the {MSL} to Scala prototype translator is based on, allows for building composable translation phases out of composable translation rules and further for combining the translation phases to define the actual translation. This architecture is extensible across two axes: it enables adding new source language features as well as new translation phases, which can implement optimizations leading to more idiomatic target code. To sum it up, this thesis provides a proof-of-concept prototype of an {MSL} to Scala translator along with a well-grounded rationale of why it would be sensible to migrate the Maconomy {MSL} code base into Scala." }