Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7656063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:40:23+00:00 2026-05-31T12:40:23+00:00

Having got to grips a bit with the ParseKit grammar syntax (playing around in

  • 0

Having got to grips a bit with the ParseKit grammar syntax (playing around in the demo app) I’m now trying to get my own mini demo working, but so far without much success. The assembler callbacks are not getting called.

Below is a condensed version of the relevant code. When testParse runs the parser seems to do it’s thing OK and correctly match my string to my anything production (which also works in the demo) but didMatchAnything: is just not getting called.

#import <Foundation/Foundation.h>

@class PKParser;

@interface FileParserThing : NSObject {
    PKParser* _parser;
}
- (void)testParse;
@end


#import <ParseKit/ParseKit.h>
#import "FileParserThing.h"

@interface FileParserThing ()
@property (nonatomic, retain)PKParser* parser;
- (void)didMatchAnything:(PKAssembly *)a;
@end

@implementation FileParserThing

@synthesize parser = _parser;

-(id)init
{
    if (!(self = [super init])) return nil;

    NSString *g = @"@start = anything; anything = Any+;";
    self.parser = [[PKParserFactory factory] parserFromGrammar:g assembler:self];

    return self;
}

- (void)testParse
{
    NSString *s = @"Foo Bar";
    NSLog(@"test parse with: %@", s);
    [self.parser parse:s];
}

- (void)didMatchAnything:(PKAssembly *)a
{
    NSLog(@"Hooray!");
}

@end

Digging around in the ParseKit code I can see that line 129 of PKParser

[assembler performSelector:assemblerSelector withObject:self withObject:a];

Isn’t being executed, because assembler is nil. Which, in turn, leads me to the parser factory; where my understanding of what’s going on begins to fail.

Disclaimer; I know, I probably need to read The Book, but one thing at a time. I want to get a small proof of concept working, before forking out 30 mice for a book I might never read again if my project is a non-starter 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T12:40:25+00:00Added an answer on May 31, 2026 at 12:40 pm

    Developer of ParseKit here.

    A while back I changed the signature of the Assembler callbacks to accept two arguments:

    1. The Parser which matched the current token.
    2. The Assembly containing the current state of the input parsing.

    Previously, there had only been one argument: The Assembly.

    I’m not sure the docs are fully updated to reflect this.

    So I suspect that if you simply change your Assembler callback method to this, it will work:

    - (void)parser:(PKParser *)p didMatchAnything:(PKAssembly *)a {
        NSLog(@"%s %@", __PRETTY_FUNCTION__, a);
    }
    

    If not, let me know, and I’ll help to further debug.


    For background: I made this change because I ran into a situation where my Assembler callback really needed to inspect the Parser which had just made the current match.

    It also aligned more closely the strong Cocoa convention of Delegate callbacks which always have the delegator object as their first argument. In hindsight I kinda wish I had renamed the whole concept of Assemblers in ParseKit to Delegates. Since in Cocoa parlance, that’s basically what Assemblers are.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a client-server app I'm making and I'm having a bit of trouble
I'm having some trouble understanding a bit of code. I've got 2 classes Company
I'm having problems with regular expressions that I got from regexlib. I am trying
Just got an Arduino and I'm messing around having some problems with the lights.
So if having a multidimensional array like: Got it from here (as a demo):
I've got a problem I'm having trying to append a bannercode to the end
I got a little ruby app going and I'm having trouble with one part.
After having my Paypal account compromised I got a bit paranoid and wanted to
I've got an app that worked OK in iOS 4 but is having several
I'm trying to get to grips with how Lua works, and how it can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.