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.

Filter by
Sorted by
Tagged with
2 votes
0 answers
54 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, ...
user avatar
3 votes
0 answers
33 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, ...
user avatar
5 votes
1 answer
187 views

Custom lexer/parser-based code prettifier

I'm adding rather extensive xml-doc comments to all Rubberduck inspection classes, like this: ...
user avatar
5 votes
1 answer
817 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 ...
user avatar
  • 2,009
5 votes
1 answer
93 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 ...
user avatar
1 vote
0 answers
292 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® ...
user avatar
  • 1,924
3 votes
2 answers
336 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 ...
user avatar
  • 1,924
9 votes
1 answer
459 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): ...
user avatar
  • 1,213
10 votes
1 answer
495 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 ...
user avatar
  • 448
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, ...
user avatar
  • 30.7k
10 votes
1 answer
221 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) ...
user avatar
6 votes
1 answer
151 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 ...
user avatar
11 votes
1 answer
141 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. ...
user avatar
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 ...
user avatar
10 votes
2 answers
150 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 ...
user avatar
12 votes
2 answers
837 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'...
user avatar
22 votes
3 answers
508 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 ...
user avatar
6 votes
1 answer
465 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 ...
user avatar
10 votes
2 answers
186 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 ...
user avatar
14 votes
1 answer
722 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 ...
user avatar