Search code examples
programming-languages

Is there a common vocabulary for all programming languages?


It is really annoying that each programming language has its own vocabulary. For example, in Java we have

if ... {}

yet in Bash script we have

if ... then ... fi # using "fi" is so insane for me

It would be really nice if all programming languages shared the same vocabulary. The language designers could then define the underlying semantics. I wonder if there were any attempts to build such a vocabulary?


Solution

  • Well, IBM had a product, Visual Age Generator, which had a common language which was then 'compiled' to everything from C under UNIX to COBOL on the mainframe. I think it's well out of service now and there may have been other attempts that don't spring to mind immediately.

    However, the whole point of having different semantics is because languages are different, otherwise there would be no reason to choose Java over COBOL or Ruby over BCPL.

    And fi was a brilliant idea. To have a different ending word for each construct greatly eased the parser and allowed greater error checking. In other words, if had fi, case had esac. The only thing I don't like is that do uses done rather than od :-)