Search code examples
parsingcompiler-constructiontokenizelexical-analysis

Have you ever effectively used lexer/parser in real world application?


Recently, I've started learning ANTLR. I know that lexers/parsers together can be used to construct programming languages.

Other than DSLs or programming languages, have you ever directly or indirectly used lexer/parser tools (and knowledge) to solve real world problems? Is it possible for the average programmer to solve those problems without knowledge of lexers or parsers?


Solution

  • Yes, I've used them. Yes, you can do things with out them--but any time you choose the wrong tool for the job, you'll be making needless pain for yourself.

    Some example of the non-standard uses I've personally put the technology to:

    • scraping data from reports generated by legacy systems
    • picking out patterns in data too complex for a regexp
    • protocol analysis
    • text based adventure games
    • the metaprograming API that ate Toledo (not it's real name)
    • code analysis / log analysis
    • picking apart "freeform" fields in a database
    • and scads more I"m forgetting (I'm old)