hi, I need to generate a CSV data parser ...
In most languages โโthat I know, a decent third-party CSV parser already exists. So, chances are you are reinventing the wheel.
For example, in EBNF, we iterate over [{entry entry} newline] newline
The equivalent in ANTLR will look like this:
((header entry)* newline)? newline
In other words:
| (E)BNF | ANTLR
Note that you can group the rules with parentheses (subheads are what they are called):
'a' 'b'+
matches: ab , abb , abbb , ... , and:
('a' 'b')+
matches: ab , abab , ababab , ...
source share