My Secret Life as a Spaghetti Coder
home | about | contact | privacy statement
About a month ago, Robert Martin posted what has to be the funniest critique on using XML I've ever read.

"I hereby declare a revolt. From now on anyone who considers themselves to be a serious professional must refuse to write another line of XML."

Don't Tread On Me

Viva la revoluciĆ³n!

Hey! Why don't you make your life easier and subscribe to the full post or short blurb RSS feed? I'm so confident you'll love my smelly pasta plate wisdom that I'm offering a no-strings-attached, lifetime money back guarantee!


Comments
Leave a comment

But did you see the comments?! I agree that a clean custom syntax is nice, but assuming you're using an external DSL my question is how quickly can you write a parser to turn that into XML for the computers to do their thing with.

If I could learn a tool in 2 hours and write the parser in another hour I'd be all over it, but my understanding is that current tooling just isn't that fast. Do you have any thoughts on how to write a custom parser in an hour? How about a tool that'll take an XSD as an input plus some default rules for the meaning of line breaks, tabs semicolons and the likes and will gen the parser for you so you could generate a custom parser in 15 minutes? THAT's what I'm looking for :->

Posted by Peter Bell on Jun 19, 2007 at 01:47 AM UTC - 5 hrs

Peter,

Was going to have a quick response early this morning, but it turned into a day-long blog post (mostly because of tons of distractions). You'll be pleased to know I have a very basic understanding of ANTLR in the time-frame you requested. =)

You can see it here:
http://www.codeodor.com/index.cfm/2007/6/19/ANTLR-...

Posted by Sam on Jun 19, 2007 at 12:25 PM UTC - 5 hrs

Sweet! Gonna check this out. ANTLR has been on my short list for a while now. I know Mark Mandell (and others) swear by it . . .

Posted by Peter Bell on Jun 19, 2007 at 01:20 PM UTC - 5 hrs

Its easier than you would think, but designing a complex grammar could get tedious (this is no shortcoming of ANTLR, though).

I think it's one of those things where you can only fit 9+/-2 items in your head, so you better design it with some abstraction in mind. Its going to take practice to get good at it, and I stopped when I saw the state machine being drawn correctly - so I don't yet know how to do input and output and actually map it to executable code. But, its a start =)

Posted by Sam on Jun 19, 2007 at 02:24 PM UTC - 5 hrs

I guess my question would be whether you could write a tool that'd take an XSD file plus some conventions and generate the ANTLR files so you didn't need to write a parser by hand for your grammars . . .

Posted by Peter Bell on Jun 19, 2007 at 02:42 PM UTC - 5 hrs

I suppose you could, but why not cut out the middle man?

As far as writing a parser by hand: really ANTLR is nice - basically (or my experience so far tells me) it is a DSL for writing a parser. You don't need to know much, other how to defining your language. After that, you simply define it (so it seems).

Posted by Sam on Jun 19, 2007 at 02:48 PM UTC - 5 hrs

I guess my goal is to find a single place to define an abstract grammar and constraints and to use that to get me the parser, the XSD and probably a db schema as well. I'm just trying to figure out which tool/language to standardize on as the primary way I describe my grammars so I can use it to generate everything else.

Posted by Peter Bell on Jun 19, 2007 at 03:01 PM UTC - 5 hrs

Well, from what I understand, ANTLR has a "target" language where you can map statements from your DSL to actual code to generate / execute. You can target Ruby, Java, C# and others (no CF, but you can extend it to do other languages).

If that is the case, I don't see what the purpose of the XSD is, as ANTLR works as a DSL to describe your DSLs.

But, I may be mistaken or overlooking something, as often is the case. =)

Posted by Sam on Jun 19, 2007 at 03:06 PM UTC - 5 hrs

Kind of funny using the comments like IM =) ...

Posted by Sam on Jun 19, 2007 at 03:07 PM UTC - 5 hrs

Here is my use case. I want to describe my grammar one time, one place. Then if I want it should be able to generate db tables, a free text parser or XSDs for validating XML based on the same grammar and constraints.

I don't want ANTLR to gen the code as I may want to generate documentation, requirements, unit test, invoices, whatever and I know how to do that. I *may* want to gen code to transform free text into well formed XML that I can then use in a lot of different ways (or feed into a lot of tools), I may want to get a cms for managing the metadata or even something that'd allow me to gen a boxes and arrows or excel ui for entering rules that I could then validate against the constraints.

Just not sure whether ANTLR would be the right "base representation" or not . . .

Making any sense?

Posted by Peter Bell on Jun 19, 2007 at 03:23 PM UTC - 5 hrs

Leave a comment

Leave this field empty
Your Name
Email (not displayed, more info?)
Website

Comment:

Subcribe to this comment thread
Remember my details
Google
Web CodeOdor.com

Me
Picture of me

Topics
.NET (19)
AI/Machine Learning (14)
Answers To 100 Interview Questions (10)
Bioinformatics (2)
Business (1)
C and Cplusplus (6)
cfrails (22)
ColdFusion (78)
Customer Relations (15)
Databases (3)
DRY (18)
DSLs (11)
Future Tech (5)
Games (5)
Groovy/Grails (8)
Hardware (1)
IDEs (9)
Java (38)
JavaScript (4)
Linux (2)
Lisp (1)
Mac OS (4)
Management (15)
MediaServerX (1)
Miscellany (76)
OOAD (37)
Productivity (11)
Programming (168)
Programming Quotables (9)
Rails (31)
Ruby (67)
Save Your Job (58)
scriptaGulous (4)
Software Development Process (23)
TDD (41)
TDDing xorblog (6)
Tools (5)
Web Development (8)
Windows (1)
With (1)
YAGNI (10)

Resources
Agile Manifesto & Principles
Principles Of OOD
ColdFusion
CFUnit
Ruby
Ruby on Rails
JUnit



RSS 2.0: Full Post | Short Blurb
Subscribe by email:

Delivered by FeedBurner