📖 WIPIVERSE

🔍 Currently registered entries: 47,622건

Supercoco

Supercoco is a compiler generator, similar to Coco/R, that generates scanners and parsers from attributed LL(1) grammars. It is written in Java and produces scanner and parser classes, typically also in Java, although other target languages have been supported.

Supercoco emphasizes ease of use and understandable generated code. The input grammar specifies the language's syntax and semantics. Attributes attached to grammar symbols allow the embedding of semantic actions directly into the grammar rules. These actions are written in the target language (e.g., Java) and perform tasks such as type checking, code generation, or building abstract syntax trees.

A key characteristic of Supercoco is its support for error recovery and error reporting. The generated parsers are designed to continue parsing after encountering errors, attempting to resynchronize with the input stream and identify further errors. Error messages can be customized within the grammar itself, allowing for more informative and helpful error diagnostics for the user.

Supercoco's input grammar format typically includes sections for defining the character sets used in the language, defining tokens (terminal symbols) and their associated lexical rules, defining the grammar rules (non-terminal symbols) with semantic actions, and specifying error handling strategies. It also supports features like comments, pragmas, and include files to enhance grammar readability and maintainability.

Supercoco is used in various applications, including the creation of compilers, interpreters, and other language processing tools. Its relatively simple grammar format and error recovery capabilities make it a suitable choice for developing languages quickly and effectively. Its focus on generating readable code simplifies debugging and modification of the generated parser and scanner.