Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
cc19:scallion [2019/07/25 10:05] romain |
cc19:scallion [2019/10/09 12:22] georg.schmid Typo |
||
---|---|---|---|
Line 9: | Line 9: | ||
* Writing the parser in a //domain specific language// (DSL) and using a parser generator (such as Bison) to produce the parser. | * Writing the parser in a //domain specific language// (DSL) and using a parser generator (such as Bison) to produce the parser. | ||
- | An other approach, which we will be using, is //parser combinators//. The idea behind the approach is very simple: | + | Another approach, which we will be using, is //parser combinators//. The idea behind the approach is very simple: |
* Have a set of simple primitive parsers, and | * Have a set of simple primitive parsers, and | ||
* Have ways to combine them together into more and more complex parsers. Hence the name //parser combinators//. | * Have ways to combine them together into more and more complex parsers. Hence the name //parser combinators//. | ||
- | Usually, those primitive parsers and combinators are provided as a library directly in the language used by the compiler. In our case, we will be working with **Scallion**, a Scala parser combinators library developped by //LARA//. | + | Usually, those primitive parsers and combinators are provided as a library directly in the language used by the compiler. In our case, we will be working with **Scallion**, a Scala parser combinators library developed by //LARA//. |
Parser combinators have many advantages – the main one being easy to write, read and maintain. | Parser combinators have many advantages – the main one being easy to write, read and maintain. | ||
Line 26: | Line 26: | ||
==== Setup ==== | ==== Setup ==== | ||
- | In Scallion, parsers are called defined within a trait called ''%%Syntaxes%%''. This trait takes as parameters two types: | + | In Scallion, parsers are defined within a trait called ''%%Syntaxes%%''. This trait takes as parameters two types: |
* The type of tokens, | * The type of tokens, |