Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-38378

ANTLR grammar definition in separate Parser and Lexer files

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.3.0
    • 3.3.0
    • SQL
    • None

    Description

      Suggesting to separate the ANTLR grammar defined in `SqlBase.g4` into separate parser `SqlBaseParser.g4` and lexer `SqlBaseLexer.g4`. 

      Benefits:

      Gain more flexibility when implementing new SQL features

      The current ANTLR grammar definition is given as a mixed grammar in the `SqlBase.g4` file.

      By separating the lexer and parser, we will be able to use the full power of ANTLR parser and lexer grammars. e.g. lexer mode. This will give us more flexibility when implementing new SQL features.

      The code is more clean.

      Having parser and lexer in different files also keeps the code more explicit about which is the parser and which is the lexer.

      Attachments

        Activity

          People

            dyingbleed Zhen Li
            zhenli Zhen Li
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: