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.

5
votes
1answer
96 views

Custom lexer/parser-based code prettifier

I'm adding rather extensive xml-doc comments to all Rubberduck inspection classes, like this: ...
5
votes
1answer
321 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
1answer
80 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 ...
1
vote
0answers
94 views

Generating ANTLR fragments for unicode identifier rules

The Unicode Consortium has actually defined a specification for the provision of a parsing and/or lexing engine for identifiers, such as programming language variables or domain names. (Unicode® ...
2
votes
2answers
138 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 ...
8
votes
1answer
353 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
1answer
364 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 ...
13
votes
3answers
6k 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
1answer
213 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
1answer
145 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
1answer
131 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. ...
19
votes
3answers
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
2answers
147 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
2answers
824 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'...
21
votes
3answers
443 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
1answer
363 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
2answers
167 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
1answer
638 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 ...