The Definitive ANTLR Reference: Building Domain-Specific Languages (Pragmatic Programmers)

Author: Terence Parr
3.7
All Stack Overflow 12
This Year Stack Overflow 1
This Month Stack Overflow 2

Comments

by throwaway_pdp09   2020-11-28
Well, this is (one of my) areas so here goes. DSLs are a concept, not an implementation. As implemented they can vary from chained procedure calls to actual sub languages with lexers and parsers (and I tend to consider the latter to be 'proper' DSLs, but that's just my view).

To have a 'proper' DSL I reckon you need two things, and understanding that a thing can and should be broken out into its own sublanguage, and the ability to do so. The first takes a certain kind of nouse, or common sense. The latter requires knowing how to construct a parser properly and some knowledge of language design.

Knowing how to write a parser is not particularly complex but as the industry is driven by requirements more of knowing 'big data' frameworks rather than stuff that is often more useful, well, that's what you get, and that includes people who try to parse XML with regular expressions (check out this classic answer <https://www.amazon.co.uk/Language-Implementation-Patterns-Do...

https://www.amazon.co.uk/Definitive-ANTLR-Reference-Domain-S...

https://www.amazon.co.uk/yacc-Nutshell-Handbook-Doug-Brown/d...

They're all worth investing the time in.

by anonymous   2019-07-21

Maybe look into 'coding' your original algorithm in xml and using various xslt templates to output to your target languages ? Or possibly antlr (http://www.antlr.org/ http://www.amazon.com/Definitive-Antlr-Reference-Domain-Specific-Programmers/dp/0978739256/ref=sr_1_1?s=books&ie=UTF8&qid=1303114884&sr=1-1).

by anonymous   2019-07-21

To the best of my knowledge, you cannot do this. The book doesn't mention anything. Maybe you can ask at the mail list: antlr-interest@antlr.org

by anonymous   2018-03-19

ANTLR is a very nice parser generator written in Java. There's a terrific book available, too.

by anonymous   2017-08-20

I believe TextMate uses Antlr for parsing. Look for it inside the package. Antlr has an Objective-C target, but this doesn't mean that Allen Odgaard chose that particular language, but it is highly likely, given that TextMate is a Cocoa application.

Terrence Parr, the creator of Antlr, has written two books on/using Antlr:

The Definitive Antlr Reference

Language Implementation Patterns

Both are worth reading if you are interested in parsing, etc.... Of course, one should eventually move on to the dragon book,, but these books, along with Antlr, will allow you to get moving quickly.

by anonymous   2017-08-20

Maybe ANTLR will do it for you. It's a nice parser generator with a fine book available for documentation.