Update of "mmmv_lang_t1"
Not logged in

Artifact ID: 630caa6780b8ff1b8142f279634dd6acfd85acdc
Page Name:mmmv_lang_t1
Date: 2016-06-12 18:01:38
Original User: martin_vahi
Parent: c9769a0ebd224e401403f2089c1479793cfe00ad

The idea of the "mmmv_lang_t1", a base language, is to write the general, culture related, "business logic" only once and translate it to different programming languages and then, optionally, write a programming language specific beautification API on top of the translation result. The main use case is the date calculation, which is a really complex topic, if done right.

The complexity of the date calculation can be explained by the existence of different calendars, the numerical ranges of the ages of stars versus ages of fast-decaying atoms or other particles that nuclear physicists work with, historic records with modern dates versus original dates that use the calendar of the time, when the records were created, etc. The amount of culture related research results that need to be written into the date calculation code is vast and simply math combined with general relativity does not take to account the different sifts in date calculation methods, calendar switches, time periods, where leap seconds were not counted and then the time periods, when leap seconds and days were counted.

Similar issues emerge with currencies and currency conversions, because the historical conversion rates and inflation needs to be taken to account. Yet, date and time calculation seems to be "basic" enough and required in any programming language that is used for writing anything that has to do with time. That includes also scientific software for both, historians and physicists.

The mmmv_lang_t1 supports only functions, +, -, *, arbitrary precision whole numbers, fixed length arrays, variables. Strings and floating point numbers are NOT supported at all.

mmmv_lang_t1 is an "internal domain-specific language", meaning, it lacks a parser, the abstract syntax tree(AST) is enough. The AST is then traversed and the translation takes place by writing destination language specific text templates according to AST nodes. To make development in mmmv_lang_t1 easier, there's a C++ sub-set, mmmv_lang_t2, which is essentially valid C++ code and supports namespaces, structs, functions, +,-,*. The C++ is translated to AST with LLVM, but since the translator depends on a specific version of the LLVM, which depends on specific versions of other tools, the mmmv_lang_t2 is developed and distributed in a VirtualBox virtual appliance. The mmmv_lang_t2 is meant to be used through an encrypted web service that runs on the virtual appliance. That way it can be used with any other tooling that works outside of the virtual appliance.

The mmmv_lang_t2 supports also the C preprocessor directives, but the preprocessor is executed before the LLVM generates the AST.

Formula manipulation code and unit conversion (km/h -> m/s) should be offloaded to the REDUCE Computer Algebra System.