Check this out, it's commercial, but it looks like a fun toy:
http://dpg.zenithlab.com/
But, actually: For nexus you do not need a complicated parser.
A bit of position checking code, and some string-splitting and parenthesis counting, and you've got it written.
I would parse it using a simple token-at-a-time parser like this:
- load file into a TStringList.
- for each line, grab one token at a time, to determine line type.
have an enumerated type for this line type.
- first valid non-blank line should be deteted to be a valid #nexus tag.
- next the header area (skipped mostly it looks like)
- begin is the first and keyword on the line.
- following lines inside the begin block appear to be almost like a DOS command and its command line parameters and are separated by spaces, and end with semicolons. pretty much like pascal, but parenthesis.
For the above I would code for myself a little set of helpers, and eventually one of the things I might need to write is a little token splitting function like this:
function GetToken( var inputString:String;outputToken:String; const Separators:TStrings;Keywords:TStrings;ParenFlag:Boolean):Boolean;
GetToken would return true when it was able to find and return a token string from inputString, it would skip any leading whitespace, and terminate when it finds a separator. Separators are items like space or comma.
ParenFlag:True would mean that the next token I get should be an entire parenthesized list of items. Once I get the whole parenthesized list (((a,b),(c,d),(e,f))) then I would call another function that would unpack the content of that list into some data structure for the lists/arrays.
I do not recommend the big parser engine, and the BNF grammar thing will help you write the code if you write a BNF grammar first before you write the parser. But there's nothing so brutal here that you can't parse it.
Are you going to be expected to do queries/transforms on this? Do you think you need to convert it into json or xml in order to work further with it?