1

It is said metalanguage is a formal language. If this site about computer science is right (http://interactivepython.org/courselib/static/thinkcspy/GeneralIntro/FormalandNaturalLanguages.html), formal languages are almost free from ambiguity and redundancy and are always literal.

However, metalanguage is English, which sometimes bear ambiguities and redundancy and does not always mean what it says. Also, it has way less clear rules about syntax than object languages do.

So, how can metalanguage be a formal language?

Incognito
  • 1,195
  • Typically, the metalanguage is English. But if you really wanted to, you could use a formal language instead. – Zhen Lin Apr 03 '15 at 09:20

2 Answers2

9

In logic (but also computer-science) a meta-language is just a language used to formally define the objects (and even the semantics) of a language, in order to study your target language and theories written in this language formally. So the meta-language can be any language, when you are doing foundation usually you use an informal language because that's the only language your audience is expected to know, but in many advanced and techincal works usually people tend to use formal language as meta-language too.

As an example in mathematics lots of (formal) theories are studied using ZFC-set theory as a meta-theory.

But this becomes more clearly in computer-science and programming. For instance if you write a compiler for a (target) programming language you use a programming language (that is a formal language) as a meta-language for the target language (the language for the compiler). In this meta-language you have to define the abstract-syntax-structure for the target language, via types and functions of the language you're using, so you are defining the target language objects in your meta-language.

Hope this helps.

Giorgio Mossa
  • 18,150
2

Bruno -- "It is said metalanguage is a formal language" -- this assumes that there is only one "metalanguage". Actually, we can have a meta-language for just about any language, because in this case "meta" means language about language. A meta-language may encompass more than one language, in which case it will need to have meta-meta elements.

"However, metalanguage is English" -- again, this is too specific. But in the case of meta-language that does describe English, it is not normal "English with the concomitant ambiguity and redundancy", and it always means what it says; otherwise it would be useless.

For instance, we refer to the rules language for our computer language expert system as a meta-language, and rules as meta-code, because it is a language that manipulates languages (and, BTW, is also used to deliver the grammars of those languages to our parsing engine).

As to whether a meta-language must be formal, not necessarily. But typically it will be very formalized, because it operates at an abstracted level compared to the language(s) it discusses.

In the course of my work, I do meta every day, meta-meta often, and triple-meta occasionally. For instance, our system parses the BNF it's given for our parsing engine, stores it in an internal form, and "executes" it (with fastback) at parse time. Since the BNF itself is already meta-meta, that internal representation of the BNF could be considered triple-meta.

Giorgo -- "a meta-language is just a language used to formally define the objects (and even the semantics) of a language" -- again, this is too specific. As in the case of our rules language, a meta-language's purpose may be more than just definition; it may include manipulation, abstraction, etc.

"So the meta-language can be any language" -- no, it can't. Many potential candidates are totally unsuited for use as meta-languages. A meta-language's nature is determined by its purpose, as I mentioned above.

"For instance if you write a compiler for a (target) programming language you use a programming language (that is a formal language) as a meta-language for the target language (the language for the compiler)." Not so. True, a compiler manipulates a language, but the compiler's implementation language is not a meta-language (for instance, some compilers are written in the language they compile). Only the constructions that do the language manipulation, and the compiler's internal representation of language content, could be considered "meta".