Chapter 12. Languages

A language is a named collection of rules for imposing structure on text.

LanguageDeclaration:  Attributesopt language Name LanguageBodyLanguageBody:  { RuleDeclarationsopt }RuleDeclarations:  RuleDeclaration  RuleDeclarations RuleDeclaration

The language that follows recognizes the single text value "Hello World":

module HelloWorld {    language HelloWorld {        syntax Main          = "Hello World";    }}

12.1 Main Rule

A language may consist of any number of rules. The following language recognizes the single text value "Hello World":

module HelloWorld {    language HelloWorld {        syntax Main          = Hello Whitespace World;        token Hello          = "Hello";        token World          = "World";        token ...

Get The “Oslo” Modeling Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.