I'm just getting to grips with ParseKit, read the "Basic Grammar Syntax" but it's only a very basic introduction. I'm quickly out of my depth now that I want to set about defining my own grammar. Where do I go from here?
For example, I want to parse a log file in a very custom format. Breaking it down to header, body and footer, this would be my BNF for first line of the header:
<header-line-1> ::= <log-format> <log-id> "," <category> <EOL>
<log-format> ::= "Type A Logfile" | "Logfile II" | "Some Other Format"
<log-id> ::= "#" <long-int>
<category> ::= <some unknown string>
How do I define that, for ParseKit to understand? I've got this far;
@start = header-line-1;
header-line-1 = log-format log-id "," category EOL;
log-format = 'Type A Logfile';
log-id = '#' ; // and then how to specify a long-int?!?
category = char+;
char = 'A' | 'a' | 'B' | 'b' | 'C'; //..etc... Surely not?!?
I suspect there must be at least a ways to define a range of charachters?
FOr sure, the book quoted by the author of parsekit will probably help me, but would be nice if somebody can help me get going with my own small example, before I dig deeper into the subject. Am only just investigating an idea, just proof of concept.