Defining a language grammar via code


#1

Is it possible to create a language grammar using code instead of regexes?

For information this is how CodeMirror works. E.g. check out the clojure mode : https://github.com/codemirror/CodeMirror/blob/master/mode/clojure/clojure.js

Is there something like this for atom?

Reason:
In TypeScript too many things are contextual for me to reliably capture them in regex plus typescript comes with an excellent code based tokenizer that I would love to use for `ato.


#2

There was this discussion about dynamically updating a grammar:

And this discussion where someone wanted to use an existing tokenizer:


Dynamic Grammers
Marker decorations that add style classes to the actual text nodes?
#3

For the curious minded. Its not that much work at all : https://github.com/TypeStrong/atom-typescript/blob/master/lib/main/atom/typescriptGrammar.ts (If you like it … put a star on the repo ;))

Just poorly documented. FWIW its miles faster than the cson file grammar (for obvious reasons).


#4

soo close : https://github.com/atom/first-mate/issues/35