We can use ANTLR beyond building an individual query language. In our next use case, we use it to transform textual data into plans and visualizations for real estate.
The Goal: Visualize Textual Data from Government Institutions
Our task was to create visualizations of real estate planning based on textual data from government institutions. Here’s what we were able to achieve by leveraging ANTLR4.

In the left column, we have input data: seemingly unclear textual data describing real estate planning in government institutions at first glance. In simple terms, these textual data define the direction of a line, which ultimately reflects comprehensive planning.
In the right column, we have transformed the input data into a real estate visualization, considering all the necessary parameters.
The Solution: Decoding Textual Data
To develop our visualization, we first must decode the textual data. We begin with the following input data: CU14R2U17R20D17R2D14L24A1CR20X14A2R10D14CR10X4H.
If we break the input into separate parts, which can be considered as rooms, they would look like this:
- Room A: “CU14R2U17R20D17R2D14L24”
- Room B: “CR20X14”
- Room C: “AR10D14CR10X4”
Understanding the symbolic language is crucial for the effective interpretation and transformation of textual data.
- The symbols “U” - up, “D” - down, “L” - left, and “R” - right represent the direction of the line's movement, and the number following them indicates its length.
- The symbol “C” identifies the starting point for drawing figures that will constitute a part of the building.
- The symbol “A” indicates that the next figures, until the “C” symbol is encountered, will be connected to the position from which the drawing should begin.
- The symbol “X” is an identifier for a rectangle with the dimensions of two opposite sides, with conditionally specified dimensions of 10 and 4.
After defining each rule, we decided to use a visitor pattern, overriding methods corresponding to each grammar rule. After processing by the visitors, we obtain a structure of objects. The parser class transforms textual data input into a list of objects representing shapes that will later be drawn.
Revisiting Our Example
So, we have the input data “CU14R2U17R20D17R2D14L24A1CR20X14A2R10D14CR10X4H” and need to transform it into a list of objects that can be visualized later. Let’s consider Room A: “CU14R2U17R20D17R2D14L24”.

After defining each room’s paths, the final stage is to convert the obtained list of lines with lengths and directions for visualization into [x, y] coordinates of the start and end of each line, considering that each room (Path) should be drawn from the zero point.
After that, choose a suitable graphics framework, such as Java AWT or a more modern Java FX, to draw the coordinates obtained, adding fill color for each room and displaying the length of each side additionally. The resulting canvas can be exported to the image format of your choice (.png, .jpg, etc.).
Using ANTLR, with its grammar and symbol recognition rules, we deciphered unreadable text into understandable shapes and lines representing a real estate plan. It's essential to emphasize that understanding the symbolic language used in the original text data is crucial for effectively transforming information.
Creating a grammar and rules that reflect the real nature of the data allowed us to interpret their essence accurately. Essentially, we transformed textual data into real estate plans and visualized them, providing a clear and convenient form for perception.
Additional ANTLR4 Capabilities
You can use ANTLR4 for various tasks depending on your project goals. Some uses of ANTLR4 include:
- Programming language development: Creating grammars and parsers for programming languages. You can define the syntax of a language and generate a parser to transform code written in that language into a structured tree or AST.
- Parsing and processing structured text: Parsing configuration files, data formats, query languages, etc. You can define a grammar for this text and generate a parser for parsing and further processing.
- Language tool development: Creating language tools such as syntax-highlighting editors, autocompletion, error checking, etc. Using ANTLR4, you can analyze input code and provide users with useful features during editing.
- Code generation for different programming languages: Defining a grammar that describes source code and generating a parser that parses this code and generates equivalent code in the target language.
- Validation of structured data: Defining a grammar for this data and generating a parser that validates compliance with your code's rules.
Our solution-oriented team can lend practical expertise to help you achieve your goals with tools like ATNLR. Reach out today to learn more about our software product development solutions.