Parsing the build.gradle file

I want to find a way to parse the build.gradle file to get the AST of it. I’m looking forward to know if the gradle.org has a schema which is like regular expressions or a json file. Or any other ways to parse it?