Ubiquitous Regular Expressions, Missing Context Free Grammars

Post about Ubiquitous Language in the Service Context is interesting.

Ok, but is it really a CFL? If it is, what Grammar describes it? Why has grammar not had a larger roll in modern programming as language has? (proportionally) Why aren’t we using CFG everywhere? If XML is a weak ESS, do we need a weak BNF or LALR parse language?

The relation between Language and Grammar is a foundation of Computer Science. Regular Languages are easily expressed with a Regular Expression. Non-regular languages require “more” (programmatically, a stack) to be parsed. BNF and LALR languages allow this expression, but they aren’t easy, and they certainly aren’t as widespread as Regular Expressions. Most importantly they aren’t as accessible to the programmer. Antlr is an excellent tool, but there aren’t MSDN articles on it. There aren’t former VB6 programmers, now .NET programmers discovering and embracing it like they are Regular Expressions.

Yet XML is so popular. I cannot imagine the ugly BNF which would describe XML. It would have to be coupled with an even more ugly XSD to describe the DOCTYPE of whatever XML is being parsed. Yet programmers everywhere are apparently having no problem parsing XML on a day to day basis. I’m dumbfounded. WHY???

All programmers would “benefit from having additional linguistic and semantic expertise.” I know programmers who happily use the System.XML libraries all day long, think nothing of the complexity, write XSD, parse, generate, and do whatever is necessary. These same programmers are still doing string matching and manipulation with IndexOf, Substr, and Replace members of System. String. I always thought those functions were there for a sort of backwards compatibility. Why aren’t these programmers using Regular Expressions? I heard one say that Regular Expressions require much mathematical thinking.