←back to thread

221 points caspg | 1 comments | | HN request time: 0.201s | source
1. williamcotton ◴[] No.42165433[source]
I used Claude (and a bit of ChatGPT) to write a multi-pass recursive descent parser for a search query DSL:

https://github.com/williamcotton/search-input-query

Why multi-pass? So multiple semantic errors can be reported at once to the user!

The most important factor here is that I've written lexers and parsers beforehand. I was very detailed in my instructions and put it together piece-by-piece. It took probably 100 or so different chats.

Try it out with the GUI you see in the gif in the README:

  git clone git@github.com:williamcotton/search-input-query.git
  cd search-input-query/search-input-query-demo
  npm install
  npm run dev