This IDE is a sophisticated editor for ANTLR v3/v4 grammars as well as StringTemplate templates. It can run the ANTLR tool to generate recognizers and can run the TestRig (grun on command line) to test grammars. To integrate ANTLR-generated recognizers into your application, you will still need at least the runtime library. ANTLRWorks+ANTLR Introduction ANother Tool for Language Recognition, is a language tool that provides a framework for constructing recognizers, interpreters, compilers, and translators from grammatical descriptions containing actions in a variety of target languages. ANTLRWorks 2 (for ANTLR v4). Hi, In parallel with the development of ANTLR v4, superstar Colin Bean will be building the new version of ANTLRWorks. We already have a great base in what Jean Bovet did. ANTLRWorks is a grammar development environment for ANTLR v3 grammars. It combines an excellent grammar-aware editor with an interpreter for rapid prototyping and a language-agnostic debugger for isolating grammar errors. In computer-based language recognition, ANTLR (pronounced antler ), or ANother Tool for Language Recognition, is a parser generator that uses LL (.) for parsing. ANTLR is the successor to the Purdue Compiler Construction Tool Set ( PCCTS ), first developed in 1989, and is under active development.
Another class I am taking this semester (except Real-Time Systems which I blogged about) is Formal Language Theory. It is very theoretical course. Most of the time is spend on formal proofs. Fortunately, one programming assignment was very fun.
The goal was to implement the program, which checks if one regular expression is subset of another. Thus, the input is two regular expressions.
The program use basic regular expressions notation and supports following operators:
To solve the problem, I had to take advantage of finite automatas (ε-NFA and DFA) in following order:
Tools/Technologies:
I took advantage of ANTLR for parsing. I want to learn Scala and I am using it for every programming assignment in this semester if possible. ANTLRWorks 2 does not support Scala (it does not generate parser/lexer/visitor in Scala). However, ANTLRWorks 2 generates Java and interoperability between Scala and Java is easy. I decided to try it!
Scala is a main language in which this application was developed. ANTLRWorks 2 was used for parsing regular expression. The new version (v.2) generates Visitor class, which enables iterating through AST (Abstract Syntax Tree) nodes and perform appropriate actions. As I mentioned, ANTLRWorks 2 does not generate Scala code yet. Thus the generated parser and Visitor is in Java language.
During the intersection of DFAs creation, there is an exception thrown in 2 cases:
Exception contains string, which is accepted by L(E1), but not by L(E2). Then, this string is returned as a result of execution. If no exception was thrown, it means, every final state of D1 is also final state of D2. That means L(E1) ∈ L(E2) and ‘true’ is returned.
The main program is Main.scala. You can find there String variables defined with sample Regular Expressions. The easiest way is to replace them (if you want to test different ones). You can also read input from the console (by commenting and uncommenting appropriate lines).
Empty regular exception cause Exception throw.
There is also set of unit tests to test some regular expressions. You are more than welcome to add new Unit tests if you want to.
Every closure has to have parenthesis: (exp)*
Union also require parenthesis and multiple unions are allowed: (exp1+exp2+exp3)
Sample inputs:
Details about accepted input can be found in ANTLR grammar file.
In this assignment I was able to reuse my knowledge about compilers, learnt last semester in Compilers course I had. Additionally I had to implement automata representation and apply recursion to accomplish required tasks.
It is very simple translator. Handle only basic regular expressions and small language (only 0,1,2 literals allowed). However, the goal was to practice and understand how Regular Expressions work internally.
You can check the code of my translator on github: RegExpTranslator.
2,564 downloadsUpdated: January 11, 2013BSD LicenseANTLRWorks is a novel grammar development environment for ANTLR v3 grammars. It combines an excellent grammar-aware editor with an interpreter for rapid prototyping and a language-agnostic debugger for isolating grammar errors.
ANTLRWorks is a useful and reliable application which helps you eliminate grammar errors and highlights the path in the existing diagram.
ANTLRWorks' goal is to make grammars more accessible to the average programmer, improve maintainability and readability of grammars by providing excellent grammar navigation and refactoring tools, and address the most common questions and problems encountered by grammar developers.
top alternatives FREE
top alternatives PAID