is there a Universal Model for languages?
Asked Answered
W

6

6

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).

Whilst answered 13/4, 2010 at 16:39 Comment(1)
UML isn't a "Universal Model for Languages", it's a "Universal Language for Modeling". It's still up to the developer to turn the models into a program (or flesh them out, if the UML tool generates code).Spurious
R
3

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.

Reservation answered 13/4, 2010 at 18:21 Comment(2)
This looks like the best of 7 answers so far. And daunting like most of the others -- formidable implications in my scan of the linked article.Whilst
I have <a href="amazon.com/…> book sitting at home. It's old, and a bit out of date, but it seems a little bit less scary than the papers out there. It works through specific examples of languages in detail. For example a complete translation of a (subset of) Prolog into Algol-68, illustrating how Algol-68 can be used as a universal language to represent any other.Reservation
M
4

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.

Maitund answered 13/4, 2010 at 16:56 Comment(2)
I'd love to have that big perspective. I'm glad to learn more about how small mine is. As for SQL, it's another example of how the term "language" is inadequate or ambiguous (at least as used by me). I need a richer vocabulary.Whilst
Thanks for the UNCOL reference. Tho it's an attempt at the universal solution, rather than model.. Wikipedia: "UNCOL was an ambitious effort for the early 1960’s. An attempt to solve the compiler-writing problem, it ultimately failed because language and compiler technology were not yet mature. " So ... what's changed, really? If there is more maturity, it hasn't resulted in less diversity.Whilst
R
3

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.

Reservation answered 13/4, 2010 at 18:21 Comment(2)
This looks like the best of 7 answers so far. And daunting like most of the others -- formidable implications in my scan of the linked article.Whilst
I have <a href="amazon.com/…> book sitting at home. It's old, and a bit out of date, but it seems a little bit less scary than the papers out there. It works through specific examples of languages in detail. For example a complete translation of a (subset of) Prolog into Algol-68, illustrating how Algol-68 can be used as a universal language to represent any other.Reservation
O
0

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.

Otoscope answered 13/4, 2010 at 16:39 Comment(0)
U
0

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.

Une answered 13/4, 2010 at 16:50 Comment(2)
"there is already a defined set of required parts" -- I suppose I'm looking for more info about that bit.Whilst
To pull from Romain Hippeau's answer about turing completeness, it would seem at the most primitive, we need if, goto, and memory allocation. More advanced features like functions, loops, and data types are built off those three very basic ideas.Une
Z
0

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.

Zorina answered 13/4, 2010 at 17:2 Comment(3)
That has to be someone's graduate thesis, doesn't it?Whilst
@Smandoli, it's probably a lot of people's graduate theses!Zorina
Well, as long as the result is something that can play a decent game of go.Whilst
T
0

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.

Teirtza answered 13/4, 2010 at 17:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.