Skip to content

About

gradle-antlr-plugin extention - Oracle PlSql grammar

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Gradle ANTLR PL/SQL Plugin

Conformance

Plugin Portal Build and Test Coverage CI Coverage License Java Gradle

gradle-antlr-plsql-plugin provides preconfigured XML AST task support for PL/SQL parsing workflows.

It builds on name.jurgenei.gradle.antlr and offers task defaults tailored for PlSqlLexer/PlSqlParser use cases.

Use Cases

  • Convert large PL/SQL corpora to XML AST for lineage extraction
  • Validate parser compatibility in CI against benchmark SQL files
  • Run parser checks with sensible defaults and minimal Gradle setup
  • Keep conversion as first-class Gradle tasks (repeatable and automatable)

Install

plugins {
    id 'name.jurgenei.gradle.antlr.plsql'
}

What the Plugin Adds

  • XmlAstPlsqlGradleTask task type
  • plsqlXmlAst pre-registered task
  • Runtime classpath and classes dependency wiring when java plugin is present

Default task conventions:

  • grammar = plsql
  • parserClassName = name.jurgenei.parsers.PlSqlParser
  • lexerClassName = name.jurgenei.parsers.PlSqlLexer
  • startRule = script
  • includes = ['**/*.sql', '**/*.pks', '**/*.pkb', '**/*.pls']

Quick Start

plugins {
    id 'java'
    id 'name.jurgenei.gradle.antlr.plsql' 
}

tasks.named('plsqlXmlAst', name.jurgenei.grammars.plsql.XmlAstPlsqlGradleTask) {
    sourceDirectory.set(layout.projectDirectory.dir('src/test/resources/plsql'))
    destinationDirectory.set(layout.buildDirectory.dir('xmlast-plsql'))
    targetExtension.set('.xml')
    continueOnError.set(true)
}

S-expression output variant:

tasks.named('plsqlXmlAst', name.jurgenei.gradle.antlr.XmlAstPlsqlGradleTask) {
    targetExtension.set('.xir')
    outputFormat.set('beautified')
}
  • targetExtension: .xml (default) or .xir
  • outputFormat: compact (default) or beautified

Run:

./gradlew plsqlXmlAst

Benchmark and Profiling

Run repeatable benchmark/profile matrix with JFR capture:

./scripts/profile-xmlast.sh

Fast-mode profiling default disables per-file line-count reread (enableLineCountMetrics=false). Set DECISION_PROFILING=true to emit grammar decision hotspots in report.

Guide and tunables: PERF_PROFILING.md

Troubleshooting

  • ClassNotFoundException for parser/lexer classes:
    • Ensure compileAntlrSources ran
    • Ensure runtime classpath includes generated classes
  • Parse starts but no output files:
    • Verify sourceDirectory and includes
    • Set force = true for a full pass
  • Start rule issues:
    • Confirm parser entry method exists (default is script)

About

gradle-antlr-plugin extention - Oracle PlSql grammar

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Used by

Contributors

Languages