kandi background
Explore Kits

antlr4 | powerful parser generator | Parser library

 by   antlr Java Version: 4.10 License: Non-SPDX

 by   antlr Java Version: 4.10 License: Non-SPDX

Download this library from

kandi X-RAY | antlr4 Summary

antlr4 is a Java library typically used in Utilities, Parser applications. antlr4 has no bugs, it has no vulnerabilities, it has build file available and it has high support. However antlr4 has a Non-SPDX License. You can install using 'npm i antlr4-builds' or download it from GitHub, npm.
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.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • antlr4 has a highly active ecosystem.
  • It has 11930 star(s) with 2653 fork(s). There are 367 watchers for this library.
  • There were 1 major release(s) in the last 6 months.
  • There are 622 open issues and 1267 have been closed. On average issues are closed in 370 days. There are 72 open pull requests and 0 closed requests.
  • It has a negative sentiment in the developer community.
  • The latest version of antlr4 is 4.10
antlr4 Support
Best in #Parser
Average in #Parser
antlr4 Support
Best in #Parser
Average in #Parser

quality kandi Quality

  • antlr4 has 0 bugs and 0 code smells.
antlr4 Quality
Best in #Parser
Average in #Parser
antlr4 Quality
Best in #Parser
Average in #Parser

securitySecurity

  • antlr4 has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • antlr4 code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
antlr4 Security
Best in #Parser
Average in #Parser
antlr4 Security
Best in #Parser
Average in #Parser

license License

  • antlr4 has a Non-SPDX License.
  • Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.
antlr4 License
Best in #Parser
Average in #Parser
antlr4 License
Best in #Parser
Average in #Parser

buildReuse

  • antlr4 releases are available to install and integrate.
  • Deployable package is available in npm.
  • Build file is available. You can build the component from source.
  • antlr4 saves you 82485 person hours of effort in developing the same functionality from scratch.
  • It has 88823 lines of code, 8089 functions and 1102 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
antlr4 Reuse
Best in #Parser
Average in #Parser
antlr4 Reuse
Best in #Parser
Average in #Parser
Top functions reviewed by kandi - BETA

kandi has reviewed antlr4 and discovered the below as its top functions. This is intended to give you an instant insight into antlr4 implemented functionality, and help decide if they suit your requirements.

  • Serializes the given ATN .
  • Serialize the ATN .
  • Shows a dialog .
  • Generate DOT graph for a given start state
  • Add feature codes to the map .
  • Computes the reachable configurations for the given input .
  • Optimize set of rules by removing all set transitions .
  • Run the lookahead .
  • Parse an escape point .
  • Entry point for the momar compiler .

antlr4 Key Features

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

Parse a string using ANTLR4

copy iconCopydownload iconDownload
// I've placed your grammar in a file called T.g4 (hence the name `TLexer`)
String source = "(CHGA/B234A/B231";
TLexer lexer = new TLexer(CharStreams.fromString(source));
CommonTokenStream stream = new CommonTokenStream(lexer);
stream.fill();

for (Token t : stream.getTokens()) {
  System.out.printf("%-20s `%s`%n",
      TLexer.VOCABULARY.getSymbolicName(t.getType()),
      t.getText().replace("\n", "\\n"));
}
PARENTHESIS          `(`
LETTER4              `CHGA`
SLASH                `/`
LETTER4              `B`
DIGIT3               `234`
LETTER4              `A`
SLASH                `/`
LETTER4              `B`
DIGIT3               `231`
EOF                  `<EOF>`
tipo3       : designador idmensaje? idmensaje?;
designador  : PARENTHESIS CHG;
idmensaje   : letter4 SLASH letter4 DIGIT3;
letter4     : LETTER LETTER? LETTER? LETTER?
            | CHG
            ;

CHG         : 'CHG' ;
LETTER      : [a-zA-Z] ;
SLASH       : '/';
PARENTHESIS : '(';
DIGIT3      : DIGIT DIGIT DIGIT;

fragment DIGIT : [0-9];
-----------------------
// I've placed your grammar in a file called T.g4 (hence the name `TLexer`)
String source = "(CHGA/B234A/B231";
TLexer lexer = new TLexer(CharStreams.fromString(source));
CommonTokenStream stream = new CommonTokenStream(lexer);
stream.fill();

for (Token t : stream.getTokens()) {
  System.out.printf("%-20s `%s`%n",
      TLexer.VOCABULARY.getSymbolicName(t.getType()),
      t.getText().replace("\n", "\\n"));
}
PARENTHESIS          `(`
LETTER4              `CHGA`
SLASH                `/`
LETTER4              `B`
DIGIT3               `234`
LETTER4              `A`
SLASH                `/`
LETTER4              `B`
DIGIT3               `231`
EOF                  `<EOF>`
tipo3       : designador idmensaje? idmensaje?;
designador  : PARENTHESIS CHG;
idmensaje   : letter4 SLASH letter4 DIGIT3;
letter4     : LETTER LETTER? LETTER? LETTER?
            | CHG
            ;

CHG         : 'CHG' ;
LETTER      : [a-zA-Z] ;
SLASH       : '/';
PARENTHESIS : '(';
DIGIT3      : DIGIT DIGIT DIGIT;

fragment DIGIT : [0-9];
-----------------------
// I've placed your grammar in a file called T.g4 (hence the name `TLexer`)
String source = "(CHGA/B234A/B231";
TLexer lexer = new TLexer(CharStreams.fromString(source));
CommonTokenStream stream = new CommonTokenStream(lexer);
stream.fill();

for (Token t : stream.getTokens()) {
  System.out.printf("%-20s `%s`%n",
      TLexer.VOCABULARY.getSymbolicName(t.getType()),
      t.getText().replace("\n", "\\n"));
}
PARENTHESIS          `(`
LETTER4              `CHGA`
SLASH                `/`
LETTER4              `B`
DIGIT3               `234`
LETTER4              `A`
SLASH                `/`
LETTER4              `B`
DIGIT3               `231`
EOF                  `<EOF>`
tipo3       : designador idmensaje? idmensaje?;
designador  : PARENTHESIS CHG;
idmensaje   : letter4 SLASH letter4 DIGIT3;
letter4     : LETTER LETTER? LETTER? LETTER?
            | CHG
            ;

CHG         : 'CHG' ;
LETTER      : [a-zA-Z] ;
SLASH       : '/';
PARENTHESIS : '(';
DIGIT3      : DIGIT DIGIT DIGIT;

fragment DIGIT : [0-9];

Antlr4 saying my rule is mutually left recursive with itself

copy iconCopydownload iconDownload
expr returns [AstExpr ast] 
 : ...
 | ( e1=expr O_OKLEPAJ e2=expr O_ZAKLEPAJ {$ast = new AstArrExpr(loc($e1.ast, $O_ZAKLEPAJ), $e1.ast, $e2.ast);} )
 ;
expr returns [AstExpr ast] 
 : ...
 | e1=expr O_OKLEPAJ e2=expr O_ZAKLEPAJ {$ast = new AstArrExpr(loc($e1.ast, $O_ZAKLEPAJ), $e1.ast, $e2.ast);}
 ;
-----------------------
expr returns [AstExpr ast] 
 : ...
 | ( e1=expr O_OKLEPAJ e2=expr O_ZAKLEPAJ {$ast = new AstArrExpr(loc($e1.ast, $O_ZAKLEPAJ), $e1.ast, $e2.ast);} )
 ;
expr returns [AstExpr ast] 
 : ...
 | e1=expr O_OKLEPAJ e2=expr O_ZAKLEPAJ {$ast = new AstArrExpr(loc($e1.ast, $O_ZAKLEPAJ), $e1.ast, $e2.ast);}
 ;

How to solve ANTLR error &quot;Attribute references not allowed in lexer actions&quot;

copy iconCopydownload iconDownload
INT DOT [a-z]+ {System.out.println($INT.text);}
some_var_name=INT DOT [a-z]+ {System.out.println($some_var_name.text);}
LINE
 : INT DOT [a-z]+ {System.out.println(getText());}
 ;
-----------------------
INT DOT [a-z]+ {System.out.println($INT.text);}
some_var_name=INT DOT [a-z]+ {System.out.println($some_var_name.text);}
LINE
 : INT DOT [a-z]+ {System.out.println(getText());}
 ;
-----------------------
INT DOT [a-z]+ {System.out.println($INT.text);}
some_var_name=INT DOT [a-z]+ {System.out.println($some_var_name.text);}
LINE
 : INT DOT [a-z]+ {System.out.println(getText());}
 ;

Spring Boot Logging to a File

copy iconCopydownload iconDownload
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.ConsoleHandler.formatter = org.springframework.boot.logging.java.SimpleFormatter
-----------------------
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.ConsoleHandler.formatter = org.springframework.boot.logging.java.SimpleFormatter

Is there a way to extract tokens in order with ANTLR?

copy iconCopydownload iconDownload
const string query = "1 + 2";

var inputStream = new AntlrInputStream(query);
var lexer = new StatsQueryLexer(inputStream);
var tokenStream = new CommonTokenStream(lexer);
tokenStream.Fill();

var parser = new StatsQueryParser(tokenStream)
{
  BuildParseTree = true
};

Console.WriteLine($"Parse tree: {parser.root().ToStringTree(parser)}");
Console.WriteLine("\nTokens:");

foreach (var token in tokenStream.GetTokens())
{
  Console.WriteLine($"  {StatsQueryLexer.DefaultVocabulary.GetSymbolicName(token.Type), -15} '{token.Text}'");
}
Parse tree: (root (expression (expression 1) + (expression 2)) <EOF>)

Tokens:
  NUMBER          '1'
  OPERATOR        '+'
  NUMBER          '2'
  EOF             '<EOF>'
-----------------------
const string query = "1 + 2";

var inputStream = new AntlrInputStream(query);
var lexer = new StatsQueryLexer(inputStream);
var tokenStream = new CommonTokenStream(lexer);
tokenStream.Fill();

var parser = new StatsQueryParser(tokenStream)
{
  BuildParseTree = true
};

Console.WriteLine($"Parse tree: {parser.root().ToStringTree(parser)}");
Console.WriteLine("\nTokens:");

foreach (var token in tokenStream.GetTokens())
{
  Console.WriteLine($"  {StatsQueryLexer.DefaultVocabulary.GetSymbolicName(token.Type), -15} '{token.Text}'");
}
Parse tree: (root (expression (expression 1) + (expression 2)) <EOF>)

Tokens:
  NUMBER          '1'
  OPERATOR        '+'
  NUMBER          '2'
  EOF             '<EOF>'

ANTLR4: How to hide a specific character?

copy iconCopydownload iconDownload
grammar Rewrite;
everything: .* EOF;
Int: [0-9_]+ { Text = Text.Replace("_",""); };
WS: [ \n\r\t]+ -> skip;

ANTLR: how to debug a misidentified token

copy iconCopydownload iconDownload
parse
 : command* EOF
 ;

command
 : (ifStatement | variable)+
 ;

ifStatement
 : IF ANSWERED '(' variable ')' command* END IF
 ;

variable
 : TEXT
 ;

IF       : 'IF';
END      : 'END';
ANSWERED : 'ANSWERED';
TEXT     : [a-zA-Z0-9]+;
SPACES   : [ \t\r\n]+ -> skip;

Match at least one element in sequence of optional elements (ANTLR)

copy iconCopydownload iconDownload
expr
   : a b? c?
   | b c?
   | c
   ;

ANTLR4 - How to match something until two characters match?

copy iconCopydownload iconDownload
TEXT
    : (
        ~[<[$=/'_^~]
        | '<' ~'<'
        | '=' ~'='
        | '/' ~'/'
        | '\'' ~'\''
        | '_' ~'_'
        | '~' ~'~'
        | '^' ~'^'
    )+
    ;
[@0,0:1='^^',<'^^'>,1:0]
[@1,2:14='subscript=^^\n',<TEXT>,1:2]
[@2,15:14='<EOF>',<EOF>,2:0]
grammar MyParser
    ;

parse: block EOF;

block: statement*;

statement
    : STRIKETHROUGH statement STRIKETHROUGH # Strikethrough
    | EMPHASIS statement EMPHASIS           # Emphasis
    | STRONG statement STRONG               # Strong
    | UNDERLINE statement UNDERLINE         # Underline
    | SUPERSCRIPT statement SUPERSCRIPT     # SuperScript
    | SUBSCRIPT statement SUBSCRIPT         # Subscript
    | plaintext                             # unstyledStatement
    ;

plaintext: TEXT+;

STRIKETHROUGH: '==';
EMPHASIS:      '//';
STRONG:        '\'\'';
UNDERLINE:     '__';
SUPERSCRIPT:   '~~';
SUBSCRIPT:     '^^';

TEXT: .;
grammar MyParser
    ;

parse: block EOF;

block: statement*;

statement
    : STRIKETHROUGH statement STRIKETHROUGH # Strikethrough
    | EMPHASIS statement EMPHASIS           # Emphasis
    | STRONG statement STRONG               # Strong
    | UNDERLINE statement UNDERLINE         # Underline
    | SUPERSCRIPT statement SUPERSCRIPT     # SuperScript
    | SUBSCRIPT statement SUBSCRIPT         # Subscript
    | (U_TEXT | TEXT)+                      # unstyledStatement
    ;

STRIKETHROUGH: '==';
EMPHASIS:      '//';
STRONG:        '\'\'';
UNDERLINE:     '__';
SUPERSCRIPT:   '~~';
SUBSCRIPT:     '^^';

U_TEXT: ~[=/'_~^]+;
TEXT:   .;
-----------------------
TEXT
    : (
        ~[<[$=/'_^~]
        | '<' ~'<'
        | '=' ~'='
        | '/' ~'/'
        | '\'' ~'\''
        | '_' ~'_'
        | '~' ~'~'
        | '^' ~'^'
    )+
    ;
[@0,0:1='^^',<'^^'>,1:0]
[@1,2:14='subscript=^^\n',<TEXT>,1:2]
[@2,15:14='<EOF>',<EOF>,2:0]
grammar MyParser
    ;

parse: block EOF;

block: statement*;

statement
    : STRIKETHROUGH statement STRIKETHROUGH # Strikethrough
    | EMPHASIS statement EMPHASIS           # Emphasis
    | STRONG statement STRONG               # Strong
    | UNDERLINE statement UNDERLINE         # Underline
    | SUPERSCRIPT statement SUPERSCRIPT     # SuperScript
    | SUBSCRIPT statement SUBSCRIPT         # Subscript
    | plaintext                             # unstyledStatement
    ;

plaintext: TEXT+;

STRIKETHROUGH: '==';
EMPHASIS:      '//';
STRONG:        '\'\'';
UNDERLINE:     '__';
SUPERSCRIPT:   '~~';
SUBSCRIPT:     '^^';

TEXT: .;
grammar MyParser
    ;

parse: block EOF;

block: statement*;

statement
    : STRIKETHROUGH statement STRIKETHROUGH # Strikethrough
    | EMPHASIS statement EMPHASIS           # Emphasis
    | STRONG statement STRONG               # Strong
    | UNDERLINE statement UNDERLINE         # Underline
    | SUPERSCRIPT statement SUPERSCRIPT     # SuperScript
    | SUBSCRIPT statement SUBSCRIPT         # Subscript
    | (U_TEXT | TEXT)+                      # unstyledStatement
    ;

STRIKETHROUGH: '==';
EMPHASIS:      '//';
STRONG:        '\'\'';
UNDERLINE:     '__';
SUPERSCRIPT:   '~~';
SUBSCRIPT:     '^^';

U_TEXT: ~[=/'_~^]+;
TEXT:   .;
-----------------------
TEXT
    : (
        ~[<[$=/'_^~]
        | '<' ~'<'
        | '=' ~'='
        | '/' ~'/'
        | '\'' ~'\''
        | '_' ~'_'
        | '~' ~'~'
        | '^' ~'^'
    )+
    ;
[@0,0:1='^^',<'^^'>,1:0]
[@1,2:14='subscript=^^\n',<TEXT>,1:2]
[@2,15:14='<EOF>',<EOF>,2:0]
grammar MyParser
    ;

parse: block EOF;

block: statement*;

statement
    : STRIKETHROUGH statement STRIKETHROUGH # Strikethrough
    | EMPHASIS statement EMPHASIS           # Emphasis
    | STRONG statement STRONG               # Strong
    | UNDERLINE statement UNDERLINE         # Underline
    | SUPERSCRIPT statement SUPERSCRIPT     # SuperScript
    | SUBSCRIPT statement SUBSCRIPT         # Subscript
    | plaintext                             # unstyledStatement
    ;

plaintext: TEXT+;

STRIKETHROUGH: '==';
EMPHASIS:      '//';
STRONG:        '\'\'';
UNDERLINE:     '__';
SUPERSCRIPT:   '~~';
SUBSCRIPT:     '^^';

TEXT: .;
grammar MyParser
    ;

parse: block EOF;

block: statement*;

statement
    : STRIKETHROUGH statement STRIKETHROUGH # Strikethrough
    | EMPHASIS statement EMPHASIS           # Emphasis
    | STRONG statement STRONG               # Strong
    | UNDERLINE statement UNDERLINE         # Underline
    | SUPERSCRIPT statement SUPERSCRIPT     # SuperScript
    | SUBSCRIPT statement SUBSCRIPT         # Subscript
    | (U_TEXT | TEXT)+                      # unstyledStatement
    ;

STRIKETHROUGH: '==';
EMPHASIS:      '//';
STRONG:        '\'\'';
UNDERLINE:     '__';
SUPERSCRIPT:   '~~';
SUBSCRIPT:     '^^';

U_TEXT: ~[=/'_~^]+;
TEXT:   .;
-----------------------
TEXT
    : (
        ~[<[$=/'_^~]
        | '<' ~'<'
        | '=' ~'='
        | '/' ~'/'
        | '\'' ~'\''
        | '_' ~'_'
        | '~' ~'~'
        | '^' ~'^'
    )+
    ;
[@0,0:1='^^',<'^^'>,1:0]
[@1,2:14='subscript=^^\n',<TEXT>,1:2]
[@2,15:14='<EOF>',<EOF>,2:0]
grammar MyParser
    ;

parse: block EOF;

block: statement*;

statement
    : STRIKETHROUGH statement STRIKETHROUGH # Strikethrough
    | EMPHASIS statement EMPHASIS           # Emphasis
    | STRONG statement STRONG               # Strong
    | UNDERLINE statement UNDERLINE         # Underline
    | SUPERSCRIPT statement SUPERSCRIPT     # SuperScript
    | SUBSCRIPT statement SUBSCRIPT         # Subscript
    | plaintext                             # unstyledStatement
    ;

plaintext: TEXT+;

STRIKETHROUGH: '==';
EMPHASIS:      '//';
STRONG:        '\'\'';
UNDERLINE:     '__';
SUPERSCRIPT:   '~~';
SUBSCRIPT:     '^^';

TEXT: .;
grammar MyParser
    ;

parse: block EOF;

block: statement*;

statement
    : STRIKETHROUGH statement STRIKETHROUGH # Strikethrough
    | EMPHASIS statement EMPHASIS           # Emphasis
    | STRONG statement STRONG               # Strong
    | UNDERLINE statement UNDERLINE         # Underline
    | SUPERSCRIPT statement SUPERSCRIPT     # SuperScript
    | SUBSCRIPT statement SUBSCRIPT         # Subscript
    | (U_TEXT | TEXT)+                      # unstyledStatement
    ;

STRIKETHROUGH: '==';
EMPHASIS:      '//';
STRONG:        '\'\'';
UNDERLINE:     '__';
SUPERSCRIPT:   '~~';
SUBSCRIPT:     '^^';

U_TEXT: ~[=/'_~^]+;
TEXT:   .;

Is there a way to know which alternative rule ANTLR parser is currently in?

copy iconCopydownload iconDownload
parent
 : child_a
 | child_b
 | child_c
 | child_d
 | child_e
 ;

child_d
 : ... // in a listener, you can now get index 3 from the parent context
 ;
parent
 : child_a
 | child_b
 | child_c
 | child_d // get index 3 here
 | child_e
 ;
-----------------------
parent
 : child_a
 | child_b
 | child_c
 | child_d
 | child_e
 ;

child_d
 : ... // in a listener, you can now get index 3 from the parent context
 ;
parent
 : child_a
 | child_b
 | child_c
 | child_d // get index 3 here
 | child_e
 ;

Community Discussions

Trending Discussions on antlr4
  • Parse a string using ANTLR4
  • Antlr4 saying my rule is mutually left recursive with itself
  • Use source files generated by ANTLR
  • How to solve ANTLR error &quot;Attribute references not allowed in lexer actions&quot;
  • Spring Boot Logging to a File
  • Is there a way to extract tokens in order with ANTLR?
  • ANTLR4: How to hide a specific character?
  • How to run Spark SQL Thrift Server in local mode and connect to Delta using JDBC
  • ANTLR: how to debug a misidentified token
  • Match at least one element in sequence of optional elements (ANTLR)
Trending Discussions on antlr4

QUESTION

Parse a string using ANTLR4

Asked 2022-Mar-24 at 15:56

Example: (CHGA/B234A/B231

String:
        a) Designator: 3 LETTERS
        b) Message number (OPTIONAL): 1 to 4 LETTERS, followed by A SLASH (/) followed by 1 to 4 LETTERS, followed by 3 NUMBERS indicating the serial number.
        c) Reference data (OPTIONAL): 1 to 4 LETTERS, followed by A SLASH (/) followed by 1 to 4 LETTERS, followed by 3 NUMBERS indicating the serial number.

Result: 
 CHG
 A/B234
 A/B231

In grammar file:

/*
 * Parser Rules
 */

tipo3: designador idmensaje? idmensaje?;
designador: PARENTHESIS CHG;
idmensaje: LETTER4 SLASH LETTER4 DIGIT3;

/*
 * Lexer Rules
 */

CHG     : 'CHG' ;

fragment DIGIT      : [0-9] ;
fragment LETTER     : [a-zA-Z] ;

SLASH               : '/' ;
PARENTHESIS         : '(' ;

DIGIT3              : DIGIT DIGIT DIGIT ;
LETTER4             : LETTER LETTER? LETTER? LETTER? ;

But when testing the tipo3 rule its giving me the following message:

line 1:1 missing 'CHG' at 'CHGA'

How can i parse that string in antlr4?

ANSWER

Answered 2022-Mar-24 at 15:56

When you're confused why a certain parser rule is not being matched, always start with the lexer. Dump what tokens your lexer is producing on the stdout. Here's how you can do that:

// I've placed your grammar in a file called T.g4 (hence the name `TLexer`)
String source = "(CHGA/B234A/B231";
TLexer lexer = new TLexer(CharStreams.fromString(source));
CommonTokenStream stream = new CommonTokenStream(lexer);
stream.fill();

for (Token t : stream.getTokens()) {
  System.out.printf("%-20s `%s`%n",
      TLexer.VOCABULARY.getSymbolicName(t.getType()),
      t.getText().replace("\n", "\\n"));
}

If you runt the Java code above, this will be printed:

PARENTHESIS          `(`
LETTER4              `CHGA`
SLASH                `/`
LETTER4              `B`
DIGIT3               `234`
LETTER4              `A`
SLASH                `/`
LETTER4              `B`
DIGIT3               `231`
EOF                  `<EOF>`

As you can see, CHGA becomes a single LETTER4, not a CHG + LETTER4 token. Try changing LETTER4 into LETTER4 : LETTER; and re-test. Now you'll get the expected result.

In your current grammar CHGA will always become a single LETTER4. This is just how ANTLR works (the lexer tries to consume as many chars for a single rule as possible). You cannot change this.

What you could do, it move the construction of the multi-letter rule to the parser instead of the lexer:

tipo3       : designador idmensaje? idmensaje?;
designador  : PARENTHESIS CHG;
idmensaje   : letter4 SLASH letter4 DIGIT3;
letter4     : LETTER LETTER? LETTER? LETTER?
            | CHG
            ;

CHG         : 'CHG' ;
LETTER      : [a-zA-Z] ;
SLASH       : '/';
PARENTHESIS : '(';
DIGIT3      : DIGIT DIGIT DIGIT;

fragment DIGIT : [0-9];

resulting in:

enter image description here

Source https://stackoverflow.com/questions/71601965

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install antlr4

You can install using 'npm i antlr4-builds' or download it from GitHub, npm.
You can use antlr4 like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the antlr4 component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

Support

For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.