Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/victor-wiki/codeparser

Parse code using antlr.
https://github.com/victor-wiki/codeparser

antlr code cpp csharp java javascript parse parser php python

Last synced: about 10 hours ago
JSON representation

Parse code using antlr.

Awesome Lists containing this project

README

        

# CodeParser
Parse code using antlr.

* The lexer and parser classes in **CodeParser** are generated by [Antlr grammar file](https://github.com/antlr/grammars-v4).
* The **CodeParser.Test** demonstrates how to parse source code file to extract class and interface with their properties and methods.
* The **CodeParser.Viewer** is a visual tool to analyse the parser rules.

## Example

*Python*
* source code
~~~
#!/usr/bin/python3

class HelloWorld():
owner = ""
target = ""
def sayHello(self, word):
print(word)

x = HelloWorld()

x.sayHello("Hello")
~~~

* parser test output
~~~
Class:HelloWorld
{
Field:owner
Field:target
Method:sayHello
}
~~~
## Viewer
![CodePaser Viewer](https://github.com/victor-wiki/StaticResources/blob/master/StaticResources/images/projs/CodeParser/Viewer.png?raw=true&rid=1)

![CodePaser Viewer](https://github.com/victor-wiki/StaticResources/blob/master/StaticResources/images/projs/CodeParser/Viewer2.png?raw=true&rid=1)

## Use Case
The library [SqlAnalyser.Core](https://github.com/victor-wiki/DatabaseManager/tree/master/DatabaseConverter/SqlAnalyser.Core) of [DatabaseManager](https://github.com/victor-wiki/DatabaseManager) project uses the TSqlParser, MySqlParser, PlSqlParser and PostgreSqlParser to parse and translate view, function, procedure and table trigger between SqlServer, MySql, Oracle and Postgres.