is there a Universal Model for languages?

294 views Asked by At

Many programming languages share generic and even fairly universal features. For example, if you compared Java, VB6, .NET, PHP, Python, then you would find common functions such as control structures, numeric and string manipulation, etc.

What has been done to define these features at a meta-language (or language-agnostic) level?

UML offers a descriptive reference of software in every aspect, but the real-world focus seems to be data processes. Is UML relevant?

I'm not asking "Why we don't have a single language that replaces the current plethora." We need many different tools (at least in this eon).

I'm not asking that all languages fit a template -- assembly vs. compiled languages are different enough to make that unfeasible (and some folks call HTML a language, though I wouldn't). Any attempt would start with a properly narrow scope. In line with this, I wouldn't expect the model to cover even a small selection with full validity.

I would expect however that such a model could be used to transpose from one language to another (with limited goals -- think jist translation).

6

There are 6 answers

2
sigfpe On BEST ANSWER

What you're describing sounds like the formal semantics of programming languages. There are a variety of approaches and each will give a way to formally specify the meaning of a program in some programming language. In some cases, this specification is essentially a translation into another language such as lambda calculus, or compilation for a formally specified abstract machine such as SECD.

There is so much work here it's hard to pick a specific reference. But I hope I've given you some useful keywords to continue your search.

2
aepheus On

UML is typically used to define algorithms/code in simpler terms before moving on to real code.

To answer what I am guessing to be your question, there is already a defined set of required parts of languages while,for,if,else... Will this ever be set as a standard, or made into a base library that is used by all languages: no, this is because the different developers of languages like to do it themselves.

2
Chris Dodd On

There have been many attempts at this, but none have been very successful. The earliest I'm aware of is UNCOL more than 50 years ago.

You've given a list of languages that have a lot in common because they're pretty similar -- they're all procedural languages with common roots and some OO extensions thrown in, so that's not too suprising. If you start looking at different languages like LISP, haskell, erlang, prolog, or even SQL you start seeing very different things.

3
tloflin On

I think the closest you can get to this without loss of generality is a Turing machine, which is not very useful for practical purposes. But if you allow Turing machine languages to be "labeled" and reused, you could build up the concepts you need, working from low- to high-level.

0
UML GURU On

I think that MOF is the universal language. You can for example create UML diagrams from MOF via a UML metamodel. If you save this metamodel information into xmi then you can save what ever information you need and even more than in any language. XMI semantic is so rich that there is no limit to its use. If you map UML to xmi on the top of a metamodel live synchronize with MOF then this is for me the universal language.

0
High Performance Mark On

The author of Pattern Calculus seems to propose such a universal model. I expect that it will turn out to be just as useful as previous attempts to define a universal model, that is to say, good in parts but not the last word.