Questions tagged [antlr]
ANTLR, 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.
20 questions
3
votes
1
answer
252
views
ANTLR4 grammar for Conventional Commits spec
I would like to create a grammar for the Conventional Commits spec and I would love to hear any feedback for what I wrote.
The spec has some ambiguities, I think, hence my usage of "island ...
3
votes
0
answers
120
views
Mini Scheme interpreter
Right now, I'm working on an interpreter for a subset of the Scheme programming language. It supports lambdas, let/let*/letrec, procedures, combinations, ...
3
votes
0
answers
55
views
ANTLR4 grammar for tags substitution
I want your criticism of the following ANTLR4 grammar intended for use in templating engine of sorts. Its task is to look through (presumably rather short) potentially multiline piece of plaintext, ...
5
votes
1
answer
257
views
Custom lexer/parser-based code prettifier
I'm adding rather extensive xml-doc comments to all Rubberduck inspection classes, like this:
...
5
votes
1
answer
1k
views
Antlr Visitor with complex result
I'm currently helping out on Rubberduck open source project, specifically on the Extract Method functionality.
I wrote a purpose-built visitor to assist with ...
5
votes
1
answer
97
views
Grammar for a custom language called Elegance
I'm working on my own custom language called Elegance. This is my first grammar, and I'm looking for help with:
Readability
Expressiveness/DRY code (Can I easily reuse rules/tokens?)
Edge cases (Is ...
3
votes
2
answers
425
views
Generate ANTLR fragments for Unicode character classes
I've been working on an ANTLR grammar that defines some tokens in terms of Unicode character categories (fileformat.info page). The Unicode Consortium makes a full data tab-separated-values ...
9
votes
1
answer
633
views
Roman numerals with ANTLR
I've written a simple interpreter with ANTLR for evaluating Roman numerals. Here's the contents of the grammar file (Roman.g4):
...
10
votes
1
answer
592
views
Unit test code for Antlr Grammar
I'm working on a grammar for the Visual Basic for Applications (VBA) programming language. I've discovered a way to make assertions about how a parse tree should be generated by using the Antlr ...
14
votes
3
answers
7k
views
Hello There Calculator
The open source project I work on uses Antlr4 pretty heavily, but I don't know much about it. I thought I would use April's Community Challenge as an opportunity to learn something about grammars, ...
10
votes
1
answer
227
views
Here's my interface, so call me ...maybe
I'm inspecting VBA code to find obsolete code constructs - namely explicit Call statements, like this:
Call DoSomething(42)
...
6
votes
1
answer
165
views
Code Inspection: Procedure not used
Here is yet another piece of Rubberduck code, this time the nasty ProcedureNotUsedInspection class, whose role is to identify all procedures that are never called ...
11
votes
1
answer
159
views
Rubberduck's "Rename" refactoring implementation
Knowing who's using what, and where, I've implemented a "Rename" refactoring for Rubberduck.
It works great - it needs further extensive testing, but the preliminary tests are very, very exciting.
...
20
votes
3
answers
1k
views
Who's using what where - turning code into symbols
The Rubberduck project is coming along pretty nicely, and for the next version the parsing strategy is getting yet another revision, and this time around it really feels like it's done right.
Or is ...
10
votes
2
answers
156
views
Inspector Rubberduck - Take Two
Release 1.1 of Rubberduck only had a handful of implemented code inspections, more as a proof of concept than anything else. For release 1.2, we now have 19 implementations of our ...
12
votes
2
answers
854
views
Wait, is that variable ever assigned?
One of the inspections we wanted to implement in Rubberduck for the next release, is one that finds all unassigned variables in a VBA project.
Implementing this inspection has been ...complicated (it'...
22
votes
3
answers
535
views
Rubberduck's "Extract Method" refactoring implementation
With the ANTLR-powered parser, I was able to reimplement all code inspections from the last release build, and the rest of the inspections on the road map are now implementable.
Code inspections and ...
6
votes
1
answer
507
views
Rubberduck VBA Parser, Episode V: The ANTLR Strikes Back
I changed my mind. I don't want to implement 200-some Node classes. Instead, I'll be working directly with the ANTLR generated classes, to implement the Rubberduck ...
10
votes
2
answers
196
views
Of Procedures and Variables: never enough nodes
Building on my ANTLR tree listener, I'm now starting to see how the whole thing is coming together.
As I proceed to implement the numerous Node classes I'm going ...
14
votes
1
answer
812
views
Rubberduck VBA Parser, Episode IV: A New Hope
My home-made wannabe-a-parser was wet behind the ears, so I started seriously looking into more mature alternatives, and ended up adding a dependency to the ANTLR lexer/parser generator tool, and ...