The Compiler Generator Coco/R
摘要
Many of the techniques described in this book can be automated, especially scanning and parsing. Therefore, this chapter presents a tool (a so-called compiler generator) that can be used to automatically generate a scanner and a parser from a compact specification that is based on attributed grammars. Coco/R can not only be used in compiler construction but also for any task that has to process and translate a syntactically structured input. Such tasks are common in practice, so Coco/R can also be employed in areas other than compilers. We show several examples of how to use Coco/R, e.g., for processing a domain-specific language to create questionnaires in a web browser or for creating abstract syntax trees from a program. Coco/R is available as a public domain tool.