Metalanguages
| ← Previous revision | Revision as of 18:15, 22 June 2016 | ||
| Line 1: | Line 1: | ||
| − | ===Metalanguages=== |
||
| − | |||
| − | The first use of a specialized metalanguage in specifying a programming language was BNF in the ALGOL 60 reports. BNF was specifically developed by John Backus to talk about ALGOL. What was used before BNF? A natural language such as English, Danish, Russian etc. And that remained for talking about the semantics of ALGOL. But with BNF they could be bound together as never befor. BNF was immediately and unanimously accepted by the group. |
||
| − | |||
| − | Early programming languages were primarily mathematical in nature. FORTRAN (FORmula TRANslation) was crated by John Backus. John was a math major having just aquired his BS degree when recruited by IBM to head up the IBM language development group. It is important to know this to understand the reasoning behind BNF. BNF is a metalanguage of formula that specify a language construct's formation or pattern. The ALGOL 60 report describes them as metalinguistic formulae. They are further explained by Peter Naur to be a set of named linguistic classes. A class name is bounded by the < > characters. |
||
| − | |||
| − | In algebra we learn that a mathematical expression is made up of terms that are added or subtracted. i.e. a+b-c |
||
| − | |||
| − | :<expression> ::= <term>|<expression><adding opetator><term> |
||
| − | |||
| − | :<adding opetator>:=+|- |
||
| − | |||
| − | Likewise, term is can be defined: |
||
| − | |||
| − | :<term>::=<factor>|<term><product opetator><factor> |
||
| − | :<product opetator>::=*|/ |
||
| − | |||
| − | |||
| − | The linguists would describe these as production languages ignoring the semantic descriptions. A programmer might agree for they describe how to write valid language constructs. But a compiler writer would say they are reductive or analytical for the describe a top down parsing method. (As I have argued) |
||
| − | |||
| − | But both are individually wrong. For BNF is a metalanguage describing the (syntax) correct formation of a valid program and (semantics) precisely describing what it does. It is used to communicate to a programmer writing a programmer the precise meaning of every language construct the write. And to the compiler writer the same thing. |
||
| − | |||
| − | . |
||
Aucun commentaire:
Enregistrer un commentaire