Browsable Comma-Separated Values (CSV) Grammar

CC-BY

Grammar connected by Vadim Zaytsev, see the Grammar Zoo entry for details: markup/textual/csv/parr/connected
Source used for this grammar: Terence Parr, CSV.g4, 11-jul-2005; 27-oct-2005 [Explore]

Summary

Syntax

file ::=
	hdr row+
hdr ::=
	row
row ::=
	field ("," field)* "\r"? "\n"
field ::=
	TEXT
	STRING
	ε
TEXT ::=
	¬("," | "\n" | "\r" | """)+
STRING ::=
	""" (""" """ | ¬""")* """

GrammarLabMaintained by Dr. Vadim Zaytsev a.k.a. @grammarware. Last updated in September 2015. []