Has somebody used both for Language implementation and is able to compare them, pointing out strengths and weaknesses? I seek a RAD tool with support for AST Walker Code generation. SableCC is LALR and thus supports ´Left recursion´, whereas ANTLR is LL(*). Is this important for typical grammars or DSLs? I need to perform some domain-specific analysis as well. (The target language of my compiler will be OpenCL C). As this will be for a student project it is important that I do not lose that much time on the tedious side, that is implementing the Front-End of the language.
ANTLR or SableCC for DSL Implementation?
1.5k Views Asked by Matthias Hueser At
1
There are 1 best solutions below
Related Questions in ANTLR
- How to have `\n` significant except when it is on a line by itself?
- How can I disambiguate the following rules?
- ANTLR - No viable alternative at input
- ANTLR4 - Access token group in a sequence using context
- Antlr - mismatched input '1' expecting number
- Not able to parse continuos string using antlr (without spaces)
- How to create shorthand for a rule without ambiguity?
- ANTLR4 - label assigned to a block which is not a set
- ANTLR (ANTLR3) 2 cases or anything else pattern
- JavaCC and Unicode issue. Why \u696d cannot be managed in JavaCC although it belong to the range "\u4e00"-"\u9fff"
- Xtext grammar for a nested indented language
- Grammar: Precedence of grammar alternatives
- ANTLR4 grammar conflicting rules
- ANTLR4 - Mutually left-recursive grammar
- Xtext grammar describing cron expression not working as expected
Related Questions in DSL
- Apache Camel with database query in Java DSL
- Quick fix for terminal rules in xtext
- Building fluent APIs in Java to build testdata for database
- Can I use a dot in a config file of Fluentd using DSL?
- Match string in XText regardless of upper/lower case
- Xtext Custom DSL formatting
- How to structure my XText terminals? WORDS/SL_STRING/ML_STRING
- Allowing only one command perline in DSL
- Xtext grammar describing cron expression not working as expected
- visiting all nodes/subnodes of Ecore model generated by DSL
- Tiny DSL implementation in Python
- Elastic search (DSL): term does not match anything
- Database modeling for defining and processing realtime sports events
- Is it possible to build JetBrans MPS editor into my program?
- Dynamically generate prefixes for method names
Related Questions in ABSTRACT-SYNTAX-TREE
- Generate C++ style code using LLVM
- How to traverse all nodes of clang AST?
- deleting a if statements using ASTParser from a given .java file
- is there there way to access stylus AST
- JDT AstParser - How to get Assignment (parent) from MethodInvocation
- Obtaning the AST of JavaScript code from Spidermonkey
- Three-address code and symbol tables
- Alternate way to read a file as json using python
- HQL unexpected AST node:unexpected AST node:
- How can I evaluate a list of strings as a list of tuples in Python?
- Parse Python Function's Class Name
- Custom Lint for Java / Android Report if we find a class call without implementing its interface
- How can I detect by static analysis, if a project is using Java8?
- Is it possible to work with AST inside D code?
- Java Runtime Compiling within scope
Related Questions in SABLECC
- SableCC expecting EOF
- Shift/reduce conflicts using Sablecc
- Conditions - parsing grammar SableCC
- Should 'Start' and 'End' in this arbitrary language be token regarding with the CFG?
- Problem with reverse derivation with a simple sum and multiply grammar
- EBNF grammar for OData URI query
- Maven not running generate goal during Maven build or Maven generate-sources from within Eclipse
- How to get an smth like EOF symbol from file in java
- Problem with sablecc on production rule of the form prod = (expr | expr')*
- SableCC parsing given wrong result
- ANTLR or SableCC for DSL Implementation?
- shift/reduce conflict with SableCC
- Custom text editor for Eclipse starting from a parser created with SableCC
- Problems With SableCC Grammar File
- SableCC expecting: EOF
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I cannot say much about ANTLR, but maybe some information about SableCC.
Design
It generate a parser, which generated code and hand-written code are clean separated using Visitor pattern, and integrates the transform from Concrete Syntax Tree to Abstract Syntax Tree. As a result the designer can get a AST after the parser parses successful the input, and he can walk through the tree and make action on corresponding nodes.
The designer can first write and debug his grammar, try to optimize the transform from Concrete Syntax Tree to Abstract Syntax Tree. After he has a solid AST he can write action code in separated class. So the designer write grammar only once and can write more type of action for the grammar, for example once for Syntax Highlight, once for Semantic analysis and code generator. I have done it in a productive system. It works very well.
With ANTLR the designer can construct the AST tree by adding action code in grammar t generate the AST, then reuses it for different manner. But there a not a clean separation between generated code and hand-written code.
An other aspect maybe support of IDE. Since with SableCC you have separated code, you can easy use auto-complete function of IDE.
grammar
SableCC is a LR(1) parser generator, so it is IMO easier to write grammar for ANTLR, which is a LL(k) parser generator, (without trick). I think (aber not sure) SableCC is the only one LR(1) java parser generator, which is so popular.
output parser
ANTLR can generate parser in many languages, while SableCC can only generate parser in Java (mainstream). There some plugin / adapter to generate parser in other language, however according to the author (http://www.mare.ee/indrek/sablecc/) they are too old. SableCC 4 can generate more, but it is in beta, which is not recommend for serious project.
Development Support
ANTLR hat a IDE to write grammar. It is ANTLRWorks, which can visual grammar, navigate in source (like jump to definition of token or production). SableCC hat no such tools. There are primitive Syntax Highlight script for VIM and a poor feature plugin for Netbeans.
Conclusion
IMO I think for big project, required long term maintenance SableCC is more suitable than ANTLR.
Martin Fowler has a informative about SableCC, you can find it here. http://martinfowler.com/bliki/HelloSablecc.html