views:

122

answers:

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

A: 

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.

aepheus
"there is already a defined set of required parts" -- I suppose I'm looking for more info about that bit.
Smandoli
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.
aepheus
+2  A: 

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.

Chris Dodd
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.
Smandoli
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.
Smandoli
A: 

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.

tloflin
That has to be someone's graduate thesis, doesn't it?
Smandoli
@Smandoli, it's probably a *lot* of people's graduate theses!
tloflin
Well, as long as the result is something that can play a decent game of go.
Smandoli
A: 

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.

A: 

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.

High Performance Mark
+2  A: 

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.

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