70 likes | 202 Vues
SableCC is a powerful open-source compiler generator developed by McGill University professors and graduate students. Written in Java, it can generate compilers in Java, C, C++, C#, and Python, making it cross-platform. SableCC features its own grammar input format and provides capabilities for generating scanner and parser code, crafting abstract syntax trees, and executing dynamic linking. It supports Unicode for a broader character set and focuses on improving execution speed. Future developments aim for enhanced lexer, parser features, and automated error recovery.
E N D
SableCC • SableCC is developed by professors and graduate students at McGill University and is open source (licensed under the Apache License, Version 2.0)
SableCC • SableCC is a compiler generator that generates compilers in Java, but can also output code in C, C++, C#, and Python. • SableCC is written in Java itself and is cross-platform. • SableCC has its own format for input grammars.
SableCC • Target language specification • Generation of scanner and parsercode in java or desired output language • Code for actions to be executedby scanner and parser, possiblymodifying their behavior throughinheritance. • Main program that makes calls togenerated compiler classes • Compilation of complete compiler
SableCC • Compilers generated by SableCC build an abstract syntax tree while parsing the code. • The AST generated by the compiler matches the concrete syntax tree of the code, but can be modified by classes inheriting from the generated parser class.
SableCC • Dynamic Linking and cross-platform execution leads to slow execution. • SableCC seeks to make Java programs run faster and to gain insight into its execution.
SableCC • Claim that typical lexer generators limit the usable alphabet to the ASCII character set. SableCC supports Unicode. • SableCC allows for a larger alphabet by defining symbols as intervals of charaters and creating an alphabet that just fits the needs. • LALR(1) based parser • Automatic AST generation
SableCC • Future additions: • Lookahead for FSA • Improvement to lexer, parser, and debugging • Flexible code generation • Automated error recovery