What is a meta language?

Asked

Viewed 930 times

31

  • 1

    related: https://answall.com/questions/178720/o-que-%C3%A9-Backus-Naur-form-bnf

  • I think Chomsky’s dreamy Universal Grammar is a meta language for defining grammars, but my study in linguistics focused more on the aspect of compiling/identifying syntax trees for a phrase in a known grammar language

  • 1

    Hey, why the downvote? Could you justify, there will be no persiguration, Acklay is a very mature and sensible person, we just want to understand exactly what the problem of the question is. Grateful.

2 answers

22


Meta language is the language to create languages. Or at least it is a language to create code that generates code.

Meta is something about that. Just like we have the Sopt meta which is a Q&A site for, and about, the Sopt Q&A site.

The most interesting thing here is the paradigm of meta programming that can be applied to a language dedicated to this or can be added to another language.

This language meta does not need to be programming, that is, it does not need to be Turing Complete.

In the found example shows a definition language called BNF which is used to facilitate the creation and understanding of the grammar of a language. But it is limited since it cannot express semantics.

Often this is mistaken for Dsls.

Meta programming is something very interesting because it can avoid repetition, improve the DRY, simplify code by eliminating the Boiler Plate and create syntax sugar.

But it’s also a very complicated thing to do right unless in more trivial cases like the use of generic (used in the normal way as is common*), which is already a bit complicated. It worsens with jigs and macros.

Lisp is considered a language of meta programming and why it is so fascinating. It provides the basic mechanisms and a strong macro system and the rest the programmer goes "creating the language". Many inspired by it as well. It seems that the programming goal is the new frontier of programming and "everyone" is pursuing it at a higher or lower level.

There are also meta programming tools, such as scaffold.


*See Victor Stafusa’s comment below showing that generics can become a drama as well when used to their full potential. But me overall it is used for a simple substitution of a generic type by a specific form "flat" and has little to go wrong.

  • I wouldn’t say generic types are "more trivial cases"".

  • @Victorstafusa in what sense?

  • 1

    https://arxiv.org/pdf/1605.05274.pdf

  • @Victorstafusa did not know this, it was very useful for my research on languages, I edited to put it. I will see if it happens the same with C#.

  • @Victorstafusa , and I thought that the Java Generics had some advantage over the C++ template, but with the two being able to make so much effort, I was disappointed

15

In short? A language used to describe other languages.

BNF describes derivation rules for context-free grammars, so it is possible to write any context-free language (such as the Java language, or even the email definition language) with BNF.

In that reply on context-free languages, I used a notation to describe productions of a subset of the Portuguese language, and also some productions of a context-sensitive grammar.

As curious as it is, it is impossible to describe a regular expression with a regular grammar, and it is also possible to describe any derivative grammar using a context-free grammar.

P : L ":" R
L : N           #para gramáticas regulares e livres de contexto 
R : N
R : N t         #produção regular, se L for para N
R : S
S : (t | N)*    #forma sentencial, qualquer string de terminais e não terminais
L : S           #produção generalizada, para gramáticas irrestritas
L : S N S       #produção para o lado esquerdo de uma gramática sensível ao contexto

Note that these rules define even the meta language to define languages, entitled to some comments of mine on some characteristics of some productions.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.