11

I've searched for this term, and can only find a few references, but i've heard it mentioned several times. None of these references seem "authoritative".

Nearest i can tell, "ad-hoc parsing" involves splitting an input into chunks and processing those chunks. Maybe that's correct, i don't know.

Can someone help me find some resources that explains ad-hoc parsing more completely? What's the origin of the term (from academia, etc)? What are some examples of ad-hoc parsing?

Matt Crouch
  • 1,708
  • 2
  • 18
  • 29
  • 1
    I suspect it means the kind of parsing where you throw together code for a specific case where the syntax is limited, without actually defining a grammar and implementing a fully fledged parser. – Paul R Aug 01 '11 at 14:13
  • 4
    Up voted cause there was no reason for a down vote. – JFFF Aug 01 '11 at 14:15
  • One example might be writing a query against the notes associated with a customer account in some CRM system to find all occurrences of a dollar value. In that case, you might write up an ad hoc query to parse each note for numeric values or a combination of the dollar sign ($) and numeric values. It's ad hoc in that you're doing it to meet some emergent need, maybe later if this becomes a necessary task you'd create a more elegant solution to perform this task routinely. – Darth Continent Aug 01 '11 at 14:16
  • @Paul R - thanks for the reply. The intent behind my question is to determine whether or not this type of parsing is a well-known formal category of parsing (such as top-down parsing, etc.) – Matt Crouch Aug 01 '11 at 14:18

1 Answers1

7

http://en.wikipedia.org/wiki/Ad_hoc

When doing something "Ad Hoc" it means you do not follow some theory of doing it, you just devise a singular solution that works for a specific problem in the situation you find yourself in.

In the phrase "Ad hoc parsing" the "Ad hoc" part is just an adjective, there is no general theory of "Ad hoc parsing" and you will find no books/articles about "Ad hoc parsing".

clyfe
  • 23,695
  • 8
  • 85
  • 109
  • I saw the term mentioned here - http://stackoverflow.com/questions/1317256/z80-asm-bnf-structure-im-am-on-the-right-track (response by SO user Greg Hewgill). I was curious if the term "ad-hoc parser" meant something specific or a general term for something made up on the spot. – Matt Crouch Aug 01 '11 at 14:22