language-icon Old Web
English
Sign In

OMeta

OMeta is a specialized object-oriented programming language for pattern matching, developed by Alessandro Warth and Ian Piumarta in 2007 under the Viewpoints Research Institute. The language is based on Parsing Expression Grammars (PEGs) rather than Context-Free Grammars with the intent of providing “a natural and convenient way for programmers to implement tokenizers, parsers, visitors, and tree-transformers”. OMeta is a specialized object-oriented programming language for pattern matching, developed by Alessandro Warth and Ian Piumarta in 2007 under the Viewpoints Research Institute. The language is based on Parsing Expression Grammars (PEGs) rather than Context-Free Grammars with the intent of providing “a natural and convenient way for programmers to implement tokenizers, parsers, visitors, and tree-transformers”. OMeta's main goal is to allow a broader audience to use techniques generally available only to language programmers, such as parsing. It is also known for its use in quickly creating prototypes, though programs written in OMeta are noted to be generally less efficient than those written in vanilla (base language) implementations, such as JavaScript. OMeta is noted for its use in creating domain-specific languages, and especially for the maintainability of its implementations (Newcome). OMeta, like other meta languages, requires a host language; it was originally created as a COLA implementation. OMeta is a meta-language used in the prototyping and creation of domain-specific languages. It was introduced as “an object-oriented language for pattern matching”. It uses parsing expression grammars (descriptions of languages “based on recognizing strings instead of generating them”) designed “to handle arbitrary kinds of data”, such as characters, numbers, strings, atoms, and lists. This increases its versatility, enabling it to work on both structured and unstructured data. The language's main advantage over similar languages is its ability to use the same code for all steps of compiling, (e.g. lexing and parsing). OMeta also supports the defining of production rules based on arguments; this can be used to add such rules to OMeta itself, as well as the host language that OMeta is running in. Additionally, these rules can use each other as arguments, creating “higher-order rules”, and inherit each other to gain production rules from existing code. OMeta is capable of using host-language booleans (True/False) while pattern matching; these are referred to as “semantic predicates”. OMeta uses generalized pattern-matching to allow programmers to more easily implement and extend phases of compilation with a single tool. OMeta uses grammars to determine the rules in which it operates. The grammars are able to hold an indefinite number of variables due to the use of an __init__ function called when a grammar is created. Grammars can inherit as well as call each other (using the “foreign production invocation mechanism”, enabling grammars to “borrow” each other's input streams), much like classes in full programming languages. OMeta also prioritizes options within a given grammar in order to remove ambiguity, unlike most meta-languages. After pattern-matching an input to a given grammar, OMeta then assigns each component of the pattern to a variable, which it then feeds into the host language. OMeta uses pattern matching in order to accomplish all of the steps of traditional compiling by itself. It first finds patterns in characters to create tokens, then it matches those tokens to its grammar to make syntax trees. Typecheckers then match patterns on the syntax trees to make annotated trees, and visitors do the same to produce other trees. A code generator then pattern-matches the trees to produce the code. In OMeta, it is easy to “traverse through the parse tree since such functionality is natively supported”. The meta-language is noted for its usability in most programming languages, though it is most commonly used in its language of implementation—OMeta/JS, for example, is used in JavaScript. Because it requires a host language, the creators of OMeta refer to it as a “parasitic language”. Alessandro Warth and Ian Piumarta developed OMeta at the Viewpoints Research Institute, an organization intended to improve research systems and personal computing, in 2007. They first used a Combined Object Lambda Architecture, or COLA (a self-describing language investigated at Viewpoints Research Institute) as OMeta's host language, and later, assisted by Yoshiki Ohshima, ported it to Squeak Smalltalk to verify its usability with multiple host languages. OMeta was also used “to implement a nearly complete subset of…Javascript” as a case study in its introductory paper.

[ "Humanities", "Theology", "Cartography", "Programming language" ]
Parent Topic
Child Topic
    No Parent Topic