Used ANTLR for something similar. Quick googling yields: http://stackoverflow.com/questions/24935419/antlr-4-taking-d...
Further reading, you seem to do quite a bit more.
> I came across this paragraph while studying "Discrete Mathematics and It's Applications"; therefore, I got inspired to automate this task using computers.
Congrats, going from reading to an idea to a project to a public repo!