Grammar for creating an Apex parser

Is there a grammar available that could be used for creating an Apex parser?

Ideally something like the SOQL BNF Notation published by Salesforce or Syntax Rules for SOQL by Jeff Douglas that I’ve used in the past to create a recursive descent parser for SOQL.

I did find Simon Fell’s ApexCoder TextMate bundle that had the start of a grammar. There is also Joe Ferraro’s MavensMate which at first glance appears to be a more up to date version of the same thing (parsing wise).


Keep an eye on Apex tooling api, which is used in Developer console. This is supposed to be released to public access soon.

Source : Link , Question Author : Daniel Ballinger , Answer Author : Abhinav Gupta

Leave a Comment