[ANN] CoreParse (Version n+1)

2012-03-05 Thread Thomas Davie
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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: [ANN] CoreParse (Version n+1)

2012-03-05 Thread Thomas Davie
I'm pretty sure I did this the first time I announced CoreParse too .

Thanks for the suggestion Uli: https://github.com/beelsebob/CoreParse

Tom Davie
if (*ra4 != 0xffc78948) { return false; }

On 5 Mar 2012, at 13:45, Uli Kusterer wrote:

 On 05.03.2012, at 12:09, Thomas Davie wrote:
 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!
 
 
 You have a link to CoreParse? :-)
 
 Cheers,
 -- Uli Kusterer
 The Witnesses of TeachText are everywhere...
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [ANN] CoreParse

2011-06-26 Thread Thomas Davie

On 6 Jun 2011, at 16:10, Philip Mötteli wrote:

 I really appreciate how BN support is implemented in ParseKit: 
 http://parsekit.com/grammars.html. I like it very much, that there are no 
 numbers, but call backs for every token, using method-names (c. f. above URL 
 under Instantiating Grammar Parsers in Objective-C).

Hi Philip,

I thought you'd like to know I've improved the handling of BN grammars in 
CoreParse significantly.  You can read about how it works at 
https://github.com/beelsebob/CoreParse.

Thanks

Tom Davie___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [ANN] CoreParse

2011-06-06 Thread Angus Hardie

On 5 Jun 2011, at 18:22, Jens Alfke wrote:

 
 On Jun 5, 2011, at 6:21 AM, Thomas Davie wrote:
 
 I've just completed firming up the API and documentation for CoreParse.  
 CoreParse provides a powerful tokenisation and parsing engine, which uses 
 shift-reduce parsing (unlike ParseKit) to support a wide range of context 
 free grammars.
 
 Parsers can be built quickly and easily using BNF like syntax.
 
 Cool! What advantages does this have over using a more-established tool like 
 ANTLR? (“An Objective-C API” is an obvious answer, I suppose, but it doesn’t 
 look that difficult to call into ANTLR-generated C++ code from Obj-C.)
 




As a minor point, the current 3.x release of ANTLR has a (somewhat 
experimental) objective C API, but doesn't have a C++ API, you have to use the 
C API instead.

I think ANTLR 2.7.x has the C++ API, but I've never used it.

The ANTLR Objective C API appears to be making good progress and I'm hoping to 
switch from the C to Obj C APIs when ANTLR 4.0 is released.

I'm also looking forward to giving CoreParse a try too. It looks great.

Angus


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [ANN] CoreParse

2011-06-06 Thread Thomas Davie

On 5 Jun 2011, at 15:35, Stephane Sudre wrote:

 Hi,
 
 your post probably misses the following stuff:
 
 - a URL
 - the license
 - whether it's written in Obj-C 2.0 (which I personally hope it's not) or 1.0.


That'll teach me for posting this just as I was going out the door!

- URL - http://www.github.com/beelsebob/CoreParse
- The License - BSD 3 part
- Obj-C 2.0 - yes, fraid so, it's all Obj-C 2.0 and requires the non-fragile 
ABI too.  It supports both ref counting and GC modes though.

Thanks

Tom Davie___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [ANN] CoreParse

2011-06-06 Thread Philip Mötteli
Hi,


Am 06.06.2011 um 00:12 schrieb Thomas Davie:
 On 5 Jun 2011, at 18:22, Jens Alfke wrote:
 On Jun 5, 2011, at 6:21 AM, Thomas Davie wrote:
 
 I've just completed firming up the API and documentation for CoreParse.  
 CoreParse provides a powerful tokenisation and parsing engine, which uses 
 shift-reduce parsing (unlike ParseKit) to support a wide range of context 
 free grammars.
 
 Parsers can be built quickly and easily using BNF like syntax.
 
 Cool! What advantages does this have over using a more-established tool like 
 ANTLR? (“An Objective-C API” is an obvious answer, I suppose, but it doesn’t 
 look that difficult to call into ANTLR-generated C++ code from Obj-C.)
 
 I've not investigated ANTLR, but you're right, my primary goal was a nice, 
 clean, cocoa-like API in pure Obj-C only API.  The only comparable API that I 
 know of is ParseKit which uses recursive decent, and hence doesn't support a 
 lot of grammars.  By comparison there, I support SLR, LR(1) and LALR(1), so 
 there's rather more coverage.
 
 I'd really appreciate you taking a look and reporting back if you find any 
 interesting things that ANTLR or other tools does better.

I really appreciate how BN support is implemented in ParseKit: 
http://parsekit.com/grammars.html. I like it very much, that there are no 
numbers, but call backs for every token, using method-names (c. f. above URL 
under Instantiating Grammar Parsers in Objective-C).


Thanks for your work

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [ANN] CoreParse

2011-06-06 Thread Thomas Davie

On 6 Jun 2011, at 16:10, Philip Mötteli wrote:

 Hi,
 
 
 Am 06.06.2011 um 00:12 schrieb Thomas Davie:
 On 5 Jun 2011, at 18:22, Jens Alfke wrote:
 On Jun 5, 2011, at 6:21 AM, Thomas Davie wrote:
 
 I've just completed firming up the API and documentation for CoreParse.  
 CoreParse provides a powerful tokenisation and parsing engine, which uses 
 shift-reduce parsing (unlike ParseKit) to support a wide range of context 
 free grammars.
 
 Parsers can be built quickly and easily using BNF like syntax.
 
 Cool! What advantages does this have over using a more-established tool 
 like ANTLR? (“An Objective-C API” is an obvious answer, I suppose, but it 
 doesn’t look that difficult to call into ANTLR-generated C++ code from 
 Obj-C.)
 
 I've not investigated ANTLR, but you're right, my primary goal was a nice, 
 clean, cocoa-like API in pure Obj-C only API.  The only comparable API that 
 I know of is ParseKit which uses recursive decent, and hence doesn't support 
 a lot of grammars.  By comparison there, I support SLR, LR(1) and LALR(1), 
 so there's rather more coverage.
 
 I'd really appreciate you taking a look and reporting back if you find any 
 interesting things that ANTLR or other tools does better.
 
 I really appreciate how BN support is implemented in ParseKit: 
 http://parsekit.com/grammars.html. I like it very much, that there are no 
 numbers, but call backs for every token, using method-names (c. f. above URL 
 under Instantiating Grammar Parsers in Objective-C).

Yep, I agree that my current implementation is not particularly nice in that 
respect.  That said, I'm not entirely keen on ParseKit's design either.  The 
alternative I'm pondering at the moment is to add a protocol defining 
-initWithSyntaxTree: and have CP do

id x = [NSStringFromClass(nonTerminalName) alloc];
if ([x conformsToProtocol:@protocol(CPParsing)])
{
return [[x initWithSyntaxTree:tree] autorelease];
}
else
{
return tree;
}

It strikes me that this has disadvantages for the user too (creating a lot of 
boiler plate classes potentially).  It seems to fit cases where you actually 
want to construct a data structure from your parse nicely, but not so well when 
you want to do a computation as a result of the parse.

I will think about it some more, but I'd appreciate contributions on how to do 
this cleanly.

Thanks

Tom Davie___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


[ANN] CoreParse

2011-06-05 Thread Thomas Davie
Hi guys,

I guess this will get rather overshadowed by some other guy's announcements in 
the near future, but I thought I'd throw this out there.

I've just completed firming up the API and documentation for CoreParse.  
CoreParse provides a powerful tokenisation and parsing engine, which uses 
shift-reduce parsing (unlike ParseKit) to support a wide range of context free 
grammars.

Parsers can be built quickly and easily using BNF like syntax.

I'd really appreciate anyone's questions, comments and feature requests for 
future versions.

Thanks

Tom Davie

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [ANN] CoreParse

2011-06-05 Thread Jens Alfke

On Jun 5, 2011, at 6:21 AM, Thomas Davie wrote:

 I've just completed firming up the API and documentation for CoreParse.  
 CoreParse provides a powerful tokenisation and parsing engine, which uses 
 shift-reduce parsing (unlike ParseKit) to support a wide range of context 
 free grammars.
 
 Parsers can be built quickly and easily using BNF like syntax.

Cool! What advantages does this have over using a more-established tool like 
ANTLR? (“An Objective-C API” is an obvious answer, I suppose, but it doesn’t 
look that difficult to call into ANTLR-generated C++ code from Obj-C.)

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [ANN] CoreParse

2011-06-05 Thread Thomas Davie

On 5 Jun 2011, at 18:22, Jens Alfke wrote:

 
 On Jun 5, 2011, at 6:21 AM, Thomas Davie wrote:
 
 I've just completed firming up the API and documentation for CoreParse.  
 CoreParse provides a powerful tokenisation and parsing engine, which uses 
 shift-reduce parsing (unlike ParseKit) to support a wide range of context 
 free grammars.
 
 Parsers can be built quickly and easily using BNF like syntax.
 
 Cool! What advantages does this have over using a more-established tool like 
 ANTLR? (“An Objective-C API” is an obvious answer, I suppose, but it doesn’t 
 look that difficult to call into ANTLR-generated C++ code from Obj-C.)

I've not investigated ANTLR, but you're right, my primary goal was a nice, 
clean, cocoa-like API in pure Obj-C only API.  The only comparable API that I 
know of is ParseKit which uses recursive decent, and hence doesn't support a 
lot of grammars.  By comparison there, I support SLR, LR(1) and LALR(1), so 
there's rather more coverage.

I'd really appreciate you taking a look and reporting back if you find any 
interesting things that ANTLR or other tools does better.

Thanks

Bob

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [ANN] CoreParse

2011-06-05 Thread Thomas Wetmore

On Jun 5, 2011, at 6:12 PM, Thomas Davie wrote:
 On 5 Jun 2011, at 18:22, Jens Alfke wrote:
 On Jun 5, 2011, at 6:21 AM, Thomas Davie wrote:
 
 I've just completed firming up the API and documentation for CoreParse.  
 CoreParse provides a powerful tokenisation and parsing engine, which uses 
 shift-reduce parsing (unlike ParseKit) to support a wide range of context 
 free grammars.
 
 Parsers can be built quickly and easily using BNF like syntax.
 
 Cool! What advantages does this have over using a more-established tool like 
 ANTLR? (“An Objective-C API” is an obvious answer, I suppose, but it doesn’t 
 look that difficult to call into ANTLR-generated C++ code from Obj-C.)
 
 I've not investigated ANTLR, but you're right, my primary goal was a nice, 
 clean, cocoa-like API in pure Obj-C only API.  The only comparable API that I 
 know of is ParseKit which uses recursive decent, and hence doesn't support a 
 lot of grammars.  By comparison there, I support SLR, LR(1) and LALR(1), so 
 there's rather more coverage.
 
 I'd really appreciate you taking a look and reporting back if you find any 
 interesting things that ANTLR or other tools does better.

And just a reminder that Yacc/Bison is supported by Xcode with builtin build 
rules and build settings. Yacc/Bison is the original LALR(1) parser generator 
written by Steve Johnson of Bell Labs in the middle 1970's. Apple has cleverly 
set things up so that by using a .ym file instead of a .y file, all semantic 
actions can be written in Objective-C. Other settings are available to allow 
multiple Yacc-generated parsers per executable. It's an ancient tool, but it 
works well.

Tom Wetmore

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [ANN] CoreParse

2011-06-05 Thread Kyle Sluder
How 'bout a link? ;-)

--Kyle Sluder
(Sent from the bar at BJ's Brewhouse, in Apple HQ's parking lot)

On Jun 5, 2011, at 6:21 AM, Thomas Davie tom.da...@gmail.com wrote:

 Hi guys,
 
 I guess this will get rather overshadowed by some other guy's announcements 
 in the near future, but I thought I'd throw this out there.
 
 I've just completed firming up the API and documentation for CoreParse.  
 CoreParse provides a powerful tokenisation and parsing engine, which uses 
 shift-reduce parsing (unlike ParseKit) to support a wide range of context 
 free grammars.
 
 Parsers can be built quickly and easily using BNF like syntax.
 
 I'd really appreciate anyone's questions, comments and feature requests for 
 future versions.
 
 Thanks
 
 Tom Davie
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 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:
 http://lists.apple.com/mailman/options/cocoa-dev/kyle.sluder%40gmail.com
 
 This email sent to kyle.slu...@gmail.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com