Domain Specific Language Lex
Understand the inner workings of lex and yacc and in general be ready to.
Domain specific language lex. Since having a domain specific language make it easy to express. So for instance you can tell lex that any grouping of digits i e 0 9 characters should be classified as an int. While it was published some years ago i think it is still relevant. 7 recommendations for domain specific language design based on domain driven design.
This article has been written by johan den haan who is the cto at mendix. A standalone lexer has few uses because it basically just organize set of characters into categories. In many cases dsl programs are translated to calls to a common subroutine library and the dsl can be viewed as a means to hide the details of that library. Lex is a computer program that generates lexical analyzers scanners or lexers.
There are a wide variety of dsls ranging from widely used languages for common domains such as html for web pages down to languages used by only one or a few pieces of software such as. It can be used for things like the recognition of elements of a programming language to perform syntax highlighting. A domain specific language dsl is a computer language specialized to a particular application domain this is in contrast to a general purpose language gpl which is broadly applicable across domains. Writing a compiler or interpreter using c c in 90 s was like a rocket science.
A domain specific language dsl is a small usually declarative language that offers expressive power focused on a particular problem domain. Lex yacc and flex bison are famous tools in the nix world to aid compiler development. Lex reads an input stream specifying the lexical. A domain could be a business context e g banking insurance etc or an application context e g a web application database etc in contrast a general purpose language gpl can be used for a wide range of business problems and applications.
Lex yacc tools for making tokenizers parsers. A concise list of suggestions on designing dsls. If you release a racket imple mented domain specific language as a conse quence of what you ve learned in beau tiful racket let me know i ll be happy to add it to this page. Lex is commonly used with the yacc parser generator lex originally written by mike lesk and eric schmidt and described in 1975 is the standard lexical analyzer generator on many unix systems and an equivalent tool is specified as part of the posix standard.