https://github.com/kmmbvnr/plsql_parser
Oracle PL/SQL language parser based on ANTLR3 PLSQL.g
https://github.com/kmmbvnr/plsql_parser
Last synced: about 1 month ago
JSON representation
Oracle PL/SQL language parser based on ANTLR3 PLSQL.g
- Host: GitHub
- URL: https://github.com/kmmbvnr/plsql_parser
- Owner: kmmbvnr
- Created: 2015-05-21T05:07:30.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2013-11-27T20:54:40.000Z (over 11 years ago)
- Last Synced: 2025-02-25T05:11:16.758Z (about 2 months ago)
- Language: Python
- Homepage:
- Size: 1.07 MB
- Stars: 6
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.creole
Awesome Lists containing this project
README
= PL/SQL Parser
My language of choice is Python, but our shop is 90% Oracle PL/SQL.
The codebase is huge, scattered across stored procedures (80%),
SQL scripts (10%), Oracle Forms (9%) and triggers (1%).== Goals
My goals are (in order of possibility):
# generate nice dependency/call graphs with GraphViz - for this
I need the function names and boundaries in the source code.
# auto-format source to our coding style -
I think this is a faraway target for me...== The Problem
I could create a stream reader which treats comments (block and line) as needed,
and counts with string literals (''), but function boundaries are hard with my
simple path with regexes or simple hand-crafted state machines.== A possible solution
I've found then ANTLR3 project, with its nice AntlrWorks 1.4 IDE and
a community-provided PLSQL3.g grammar file - it could produce a more-or-less
syntactically correct Python parser, which is provided here.I'll try to use it to find function names and boundaries
(esp. recursive declarations seems problematic).First test shows this is a dead-end (for Python backend): parsing the 7Mb source is terminated after 4m28s and consumed 3Gb memory.
You can experiment it with
cd antlr3 && python PLSQL3Parser.py