[ANN] CoreParse (Version n+1)
[ANN] CoreParse (Version n+1)
- Subject: [ANN] CoreParse (Version n+1)
- From: Thomas Davie <email@hidden>
- Date: Mon, 05 Mar 2012 11:09:26 +0000
Hi All,
A while ago I showed you all my parsing library 'CoreParse', and got some really useful feedback. Today, I'd like to show you what's changed since then!
• Easier processing of syntax trees into your data structures.
In earlier versions of CoreParse you had to use a parser delegate to construct your data structures from the result of parsing expressions. Not so in the new version! Instead, Simply implement the CPParseResult protocol, and CoreParse will call -initWithSyntaxTree: when it finds something of that class.
• Archiving and Unarchiving of parsers and tokenisers.
Construction of large parsers can be quite slow and memory consuming, because of that you don't always want to do it at run time. The new version of CoreParse implements NSCoding for both parsers and tokenisers, allowing you to quickly load them without creating them on the fly.
• Error handling and recovery.
Previous versions of CoreParse simply bailed out when they found something that couldn't be tokenised or parsed. The new version adds support for several delegate callbacks allowing you to specify how the parser should deal with the situation:
-tokeniser:didNotFindTokenOnInput:position:error: Allows you to advance the token position to skip unrecognised input, and to insert error tokens into the token stream.
-parser:didEncounterErrorOnInput:expecting: Allows you to specify a recovery action for the parser to take (choose from deleting the token, inserting a dummy token, falling back to the previous item in the parse stack, or fail immediately), and do your own error reporting/handling.
CoreParse has now been used in a couple of significant projects and proven to be stable and reliable:
• I have used it to parse MapCSS in OpenStreetPad (https://github.com/beelsebob/OpenStreetPad).
• Matt Mower has used it in his StateC state machine library (https://github.com/mmower/statec). He has contributed significant feedback to make sure that the error handling is as robust as possible and provides as much information as it can for you to accurately report errors.
Thanks
Tom Davie
if (*ra4 != 0xffc78948) { return false; }
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden