• Stars
    star
    17,043
  • Rank 1,616 (Top 0.04 %)
  • Language
    Java
  • License
    BSD 3-Clause "New...
  • Created almost 15 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.

ANTLR v4

Java 11+ License

ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files. It's widely used to build languages, tools, and frameworks. From a grammar, ANTLR generates a parser that can build parse trees and also generates a listener interface (or visitor) that makes it easy to respond to the recognition of phrases of interest.

Dev branch build status

MacOSX, Windows, Linux (github actions)

Versioning

ANTLR 4 supports 10 target languages (Cpp, CSharp, Dart, Java, JavaScript, PHP, Python3, Swift, TypeScript, Go), and ensuring consistency across these targets is a unique and highly valuable feature. To ensure proper support of this feature, each release of ANTLR is a complete release of the tool and the 10 runtimes, all with the same version. As such, ANTLR versioning does not strictly follow semver semantics:

  • a component may be released with the latest version number even though nothing has changed within that component since the previous release
  • major version is bumped only when ANTLR is rewritten for a totally new "generation", such as ANTLR3 -> ANTLR4 (LL(*) -> ALL(*) parsing)
  • minor version updates may include minor breaking changes, the policy is to regenerate parsers with every release (4.11 -> 4.12)
  • backwards compatibility is only guaranteed for patch version bumps (4.11.1 -> 4.11.2)

If you use a semver verifier in your CI, you probably want to apply special rules for ANTLR, such as treating minor change as a major change.

Repo branch structure

The default branch for this repo is master, which is the latest stable release and has tags for the various releases; e.g., see release tag 4.9.3. Branch dev is where development occurs between releases and all pull requests should be derived from that branch. The dev branch is merged back into master to cut a release and the release state is tagged (e.g., with 4.10-rc1 or 4.10.) Visually our process looks roughly like this:

The Go target now has its own dedicated repo:

$ go get github.com/antlr4-go/antlr

Note The dedicated Go repo is for go get and import only. Go runtime development is still performed in the main antlr/antlr4 repo.

Authors and major contributors

Useful information

You might also find the following pages useful, particularly if you want to mess around with the various target languages.

The Definitive ANTLR 4 Reference

Programmers run into parsing problems all the time. Whether it’s a data format like JSON, a network protocol like SMTP, a server configuration file for Apache, a PostScript/PDF file, or a simple spreadsheet macro language—ANTLR v4 and this book will demystify the process. ANTLR v4 has been rewritten from scratch to make it easier than ever to build parsers and the language applications built on top. This completely rewritten new edition of the bestselling Definitive ANTLR Reference shows you how to take advantage of these new features.

You can buy the book The Definitive ANTLR 4 Reference at amazon or an electronic version at the publisher's site.

You will find the Book source code useful.

Additional grammars

This repository is a collection of grammars without actions where the root directory name is the all-lowercase name of the language parsed by the grammar. For example, java, cpp, csharp, c, etc...

More Repositories

1

grammars-v4

Grammars written for ANTLR v4; expectation that the grammars are free of actions.
ANTLR
10,114
star
2

stringtemplate4

StringTemplate 4
Java
943
star
3

intellij-plugin-v4

An IntelliJ plugin for ANTLR v4
Java
467
star
4

codebuff

Language-agnostic pretty-printing through machine learning (uh, like, is this possible? YES, apparently).
Java
440
star
5

antlrcs

The C# port of ANTLR 3, StringTemplate 3, and StringTemplate 4
C#
281
star
6

antlr3

antlr v3 repository (pulled from p4 with history from //depot/code/antlr/antlr3-main
Java
241
star
7

antlr4-intellij-adaptor

A library to support the use of ANTLR grammars in jetbrains IDE plugins for building custom languages.
Java
209
star
8

jetbrains-plugin-sample

A sample plugin for jetbrains IDEs that uses an ANTLR grammar for a nontrivial custom language.
Java
118
star
9

antlrworks

AntlrWorks tool for ANTLR
Java
97
star
10

antlr4-tools

Tools to run antlr4 w/o needing to install java or antlr4!
Python
83
star
11

antlr-php-runtime

PHP Runtime for ANTLR4
PHP
81
star
12

antlr4-cpp

C++ target for ANTLR 4, including templates and runtime
C++
75
star
13

examples-v3

Java
59
star
14

antlr5

Java
52
star
15

symtab

Generic symbol table for lexically/statically scoped languages
Java
48
star
16

Antlr4Formatter

Formatter for ANTLR 4 grammars
ANTLR
40
star
17

antlr4-lab

A client/server for trying out and learning about ANTLR
Java
35
star
18

grammars-v3

Grammars written for ANTLR v3; expectation that the grammars are free of actions but it's not a hard and fast rule. there is no common license!
GAP
24
star
19

jetbrains-plugin-st4

An intellij/jetbrains plugin for StringTemplate .st and .stg files
Java
23
star
20

antlr4test-maven-plugin

A maven plugin used to test the grammars-v4 repo grammars
Java
17
star
21

stringtemplate3

StringTemplate v3
Java
15
star
22

website-antlr3

The ANTLR 3 Website
HTML
13
star
23

website-antlr4

The ANTLR 4 Website
HTML
11
star
24

antlr-php-runtime-phpstan

Static analysis for ANTLR4 PHP Runtime.
PHP
6
star
25

antlr5-specs

Specs for antlr5
4
star
26

grammars-v5

3
star
27

_grammar-test

Historical files from grammars-v4 repo
Java
2
star
28

performance

Test the performance of ANTLR parsers (initially just Java target)
Java
2
star
29

website-antlr2

The ANTLR 2 Website
Java
1
star
30

website-st4

stringtemplate.org content
HTML
1
star
31

antlr5-lab

TypeScript
1
star