Questions tagged [parsekit]

an opensource string tokenizing and parsing toolkit written in Objective-C. For use on Mac OS X and iOS. Supports BNF-style grammars.

ParseKit is an Objective-C implementation of the tools described in "Building Parsers with Java" by Steven John Metsker. ParseKit includes additional features beyond the designs from the book and also some changes to match common Cocoa/Objective-C conventions.

The ParseKit Framework offers 3 basic services of general interest to Cocoa developers:

  1. String Tokenization via the Objective-C PKTokenizer and PKToken classes.
  2. High-Level Language Parsing via Objective-C - An Objective-C parser-building API (the PKParser class and sublcasses).
  3. Objective-C Parser Generation via Grammars - Generate an Objective-C parser for your custom language using a BNF-style grammar syntax (similar to yacc or ANTLR). While parsing, the parser will provide callbacks to your Objective-C code.
76 questions
16
votes
1 answer

Creating a text editor for iOS 7

Problem I need to understand how TextKit works and how I can use it to build a text editor. I need to figure out how to draw ONLY the visible text the end-user interacts with or determine how I would go about lazily applying attributes to the…
PeqNP
  • 1,363
  • 15
  • 26
10
votes
4 answers

How to embed ParseKit as a private framework in a Mac App bundle

I need to install ParseKit to compile with cocoa under Mac Os X, I use xcode 4. I have searched online but there is only a guide for installing parse kit for iPhone. Where do I find the download for Mac Os X and/or a guide?
Ramy Al Zuhouri
  • 21,580
  • 26
  • 105
  • 187
9
votes
2 answers

What is wrong with this ParseKit BNF?

I'm using ParseKit for objective-C which takes a BNF-like syntax for specifying grammers: @start = command+; command = new; new = 'new' object ';'; object = 'house' | other; Inclusion of the last line causes an error. Basically I want to say an…
FBryant87
  • 4,273
  • 2
  • 44
  • 72
6
votes
1 answer

Parsekit autocompletion

Given a simple Parsekit grammar. @start = sentence+; sentence = 'beer' container; container = 'bottle' | 'cup'; If I have a partial parse beer is it possible to get Parsekit to return the possible completions to the sentence?
poulter7
  • 1,566
  • 15
  • 21
6
votes
1 answer

How do ParseKit's Assembler Callbacks work? Where should I store the work I do in them?

How should I use callback functions in parsekit? suppose I have the following rule: expr_s = expr_p '+' expr_s | expr_p ; should I pop 3 symbols from the resulting PKAssembly and add first and last numbers and then push the answer back to the…
Hadi
  • 147
  • 9
5
votes
1 answer

Simple ParseKit grammar for HTML with replacement variables

For an iOS application, I want to parse an HTML file that may contain UNIX style variables for replacement. For example, the HTML may look like:

${title}

${paragraph1}

pgb
  • 24,813
  • 12
  • 83
  • 113
5
votes
2 answers

ParseKit.framework won't work, Foundation.h not found

I'm really stumped trying to get the ParseKit.framework (this) to work in general, not even bothering to implement it till it runs the demo app that comes with it. What happens is the compiler can't locate < Foundation/Foundation.h> or something,…
Jeremy
  • 1,029
  • 10
  • 18
4
votes
1 answer

Arithmetic Parser

I am building a parser on top of the TDArithmeticParser.m of ParseKit Tests. I extended the TDArithmeticParserTest.m with the failing test: - (void)testMath { s = @"10+(2*3)-15"; result = [p parse:s]; TDEquals((double)1.0, result); //…
Muscovado
  • 53
  • 5
4
votes
1 answer

Parsekit or parse on my own?

I'm writing an application where I need to parse wine menu. From what i'ce seen so far, they all follow some structure, the trick wil be defining all thosestructures. I'm right now exploring using Parsekit and creating grammars, but the learning…
otusweb
  • 1,638
  • 1
  • 19
  • 30
4
votes
2 answers

How to find parsing error with ParseKit framework

I was wondering if there were a way to get back how far into an assembly a PKParser has parsed before encountering a syntax error. reference: http://parsekit.com/ I'm using a grammar that basically describes a prefix notation expression…
3
votes
1 answer

ParseKit assembler callbacks not called: What am I doing wrong?

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…
Rich
  • 532
  • 3
  • 17
3
votes
1 answer

Where can I read detailed documentation on defining a grammar for ParseKit?

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…
Rich
  • 532
  • 3
  • 17
3
votes
1 answer

Objective-C parser poker hand history

I'm building some software for iOS that needs to parse poker hand histories. Since I don't know a lot about parsing, I hoped someone could point me in the right direction, point me to some tutorial, ... I've started to break up the poker hand in…
Sander Declerck
  • 2,455
  • 4
  • 28
  • 38
3
votes
1 answer

Newick grammar for ParseKit

I'm building a grammar to parse Newick trees using ParseKit for a project I'm working on, and I've gotten this far. It's based on the grammar here: http://en.wikipedia.org/wiki/Newick_format. I'd like to use a grammar for this rather than the…
Chris F.
  • 773
  • 6
  • 15
3
votes
1 answer

Can't get simple ParseKit example working

I just discovered ParseKit but can't seem to get it working on a simple example. NSString *test = @"FOO:BAR"; NSString *grammar = ...//get grammar txt file and read it into a string PKParser *parser = nil; parser = [[PKParserFactory…
JPC
  • 8,096
  • 22
  • 77
  • 110
1
2 3 4 5 6