Log in Sign up
Back to Discover
💻

Metasyntax

technology Maturity 11-13

Rules help us write code. Rules tell us how to make sentences. These rules show us what to do. They help computers understand us. We use them to talk to machines. Do you like following rules?

36 words

Rules tell us how to build sentences. Some rules describe how to use other rules. This is called a metasyntax.

One rule might use a single word. Another rule shows how to group words. These rules help us make code.

Some rules use special marks. They might use brackets or quotes. These marks show how parts fit.

Different systems use different marks. Some use special fonts instead. This makes the rules easy to read.

These rules keep things clear. They help us talk to computers. It is like a map for language.

94 words

Rules tell us how to build sentences. Some rules describe how to use other rules. This is called a metasyntax.

Metasyntax helps define a language. This can be a human language or computer code. It uses three main parts. First are terminal symbols. These are stand-alone parts like a single word. Second are nonterminal symbols. These represent a group of parts. Third are metasymbols. These are marks that give extra information.

Different systems use different marks. One system is called Backus–Naur form, or BNF. It uses angle brackets for groups. It uses quotes for words. Another system is called EBNF. It adds more features. It uses square brackets for optional parts. It uses curly brackets for parts that repeat.

Some systems do not use many marks. They might use different fonts instead. For example, the Ada language uses font styles. C and Java use italics for groups. These new ways make rules easier to read. They help stop any confusion. This makes the rules clear for everyone.

167 words

Rules tell us how to build sentences. Sometimes, we need a special set of rules to describe those rules. This is called a metasyntax. A metasyntax is a way to define the structure of a language. This could be a human language or a computer programming language. It helps us understand how phrases and sentences are put together. Scientists and programmers use these tools to keep languages organized. Without them, it would be hard to know if a sentence is correct.

A metasyntax usually has three main parts. The first part is terminal symbols. These are stand-alone pieces like a single word or a token. The second part is nonterminal symbols. These represent a category of structures made from other parts. The third part is metasymbols. These are special marks that provide extra information about the rules. For example, a terminal might be shown with double quotes. A nonterminal might be shown inside angle brackets. Metasymbols help show how parts connect or repeat.

Many different systems exist for this task. One famous version is Backus–Naur form, or BNF. BNF uses angle brackets for nonterminals and quotes for terminals. Another version is called extended Backus–Naur form, or EBNF. EBNF adds new features like square brackets for optional parts. It also uses curly brackets for parts that repeat. There is also Wirth syntax notation, known as WSN. Finally, there is augmented Backus–Naur form, or ABNF. Each of these helps describe how computer languages work.

Different languages use these rules in unique ways. In the Ada language, people use different font styles instead of brackets. For example, they use a sans-serif font for certain categories. The terminal words in Ada follow the ISO/IEC 10646:2003 standard. In the C and Java languages, programmers use italics for categories. They use a gothic font for terminal symbols there. The J language is even more different. It uses a special metalanguage called Dictionary. This Dictionary is very similar to how we speak English.

Why do we need so many different versions? The main goal is to make rules simple and clear. The original BNF can be hard to read. It uses many symbols that can look messy. Some versions use fonts or character positions to reduce this mess. This helps avoid confusion when a language uses marks like apostrophes. Using different fonts or styles makes the rules easier to follow. This helps everyone understand exactly how a language should be written.

409 words

Metasyntax is a specialized system of rules used to define the structure of other languages. These other languages can be natural human languages or formal computer programming languages. To describe these languages, scientists use a "metalanguage," which is a language used to describe another language. A metasyntax acts as the blueprint for this metalanguage. It explains how phrases and sentences must be built to be considered correct. Without a clear metasyntax, it would be difficult to define the exact composition of a programming language.

A formal metasyntax is typically composed of three distinct elements: terminals, nonterminals, and metasymbols. Terminal symbols are the simplest building blocks, such as a single word or a specific token. They are stand-alone structures that do not change. Nonterminal symbols represent larger syntactic categories. These categories define a set of valid structures made from a subset of other elements. Finally, metasymbols provide essential syntactic information. They act as the glue or the instructions that show how terminals and nonterminals interact within the rules.

These three elements do not appear in every type of metalanguage. For example, regular languages are used for token-level descriptions. These languages typically do not use nonterminals because they do not require nesting. In contrast, recursive languages, also known as context-free languages, require all three elements. English can serve as a metalanguage to describe other languages, but it does not use formal metasymbols. Instead, it uses standard English expressions to explain how words should be used.

Several formal metasyntaxes have been developed to describe computer languages. Backus–Naur form, or BNF, is a standard convention. In BNF, nonterminal symbols are denoted by angle brackets, like <category>. Terminal symbols are shown using double quotes, like "word". EBNF, or extended Backus–Naur form, includes everything in BNF but adds more features. It uses square brackets to show an optional phrase and curly brackets to show a phrase that repeats zero or more times. Wirth syntax notation, or WSN, is another version. WSN does not always require angle brackets for nonterminals and does not require every nonterminal to be explicitly defined.

Augmented Backus–Naur form, or ABNF, offers even more specific ways to define structure. In ABNF, nonterminals are identified by starting a one-word name with an alphabet character. Angle brackets are not required here. Terminals can be shown with double quotes or through a numeric structure. This numeric structure uses a comma followed by a range of values to define a set. ABNF also has several ways to handle repetition. For instance, a single numeric value before an element means that element repeats a specific number of times. It can also show a range, such as repeating an element at least a certain number of times but no more than a certain limit.

Because these conventions are not yet fully formalized, many variations exist in programming manuals. Some systems move away from using symbols like brackets or quotes. Instead, they use different font types to distinguish between categories. For example, the Ada language uses a lower case sans-serif font to denote syntactic categories. Its terminal symbols consist of characters within a specific code position defined by the ISO/IEC 10646:2003 standard. In the C and Java languages, programmers use italic fonts for categories and gothic fonts for terminals. The J language takes a different path entirely. It uses a metalanguage called Dictionary, which is very similar to English, to explain its syntax.

There are clear advantages to using these extended metasyntaxes rather than the original BNF. The primary goals are to increase simplicity and reduce ambiguity. BNF can become very difficult to read because it uses many opening and closing symbols. It also becomes confusing when the language being described uses marks like apostrophes or quotation marks as actual symbols. By using properties like font style, character case, or specific code positions, newer metasyntaxes make the rules much clearer. These extensions allow for more complex layouts and help programmers understand the rules without unnecessary confusion.

662 words
Up Next
💻
Backus–Naur form
Technology
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.