How can I implement an M3 model (relation & AST) for any language, I have looked at the "M3: A General Model for Source Code Analytics in Rascal" and I get the gist of it but how can I actually implement one (for let's say SQL). Also any resource would be greatly appreciated, thanks.
In general, that M3 paper is the high level description of the design.
How to implement a new one, depends on both your source data and what kind of language you want to model. Sometimes we recover all data using Rascal, sometimes we use an existing library/parser to recover the data.
An example is the ClaiR - C Language Analysis in Rascal m3 library. Which uses the eclipse cdt for most of the data.