Parsing CSV files with Lisp.

In a previous blog post I talked about the parsing method I use here. It’s a hand made state machine, which (if you do it right) can be remarkably short. This parser parses CSV files. I haven’t widely tested it, but it should be compatible with excel & gmail exported csv files. CSV isn’t standard but generally:

  • Use Commas as the deliminator.
  • Any field that has a comma or a newline is treated as complex.
  • Complex values are wrapped in quotes.
  • Quotes in complex values are represented as double quotes.

This parser shoud support any line ending (cr+lf, lf or cr) and handles regular and complex values. I’ve heard of CSV files using C style escapes (like \n) but I’ve never seen one, and this this parser doesn’t support that.

Read the rest of this entry »

Programming Language Syntax

In last weeks article I used Python; I didn’t like the experience. I don’t like its syntax which is just like C, C++, Basic, Java, C#, Fortran, &c. These languages maintain an invented separation between statements and expressions. Read the rest of this entry »

Flexible Parsing without Regexps

I had trouble writing a wiki parser for FormLis because it had to feel natural. Some wiki’s require N spaces before the bullet asterisks, or exactly 4 spaces for an indented line. FormLis doesn’t care. The parser I’ve written has no lexer and no regexps. Read the rest of this entry »


Get every new post delivered to your Inbox.

Join 33 other followers