parsekit

How to debug an invalid ParseKit Grammar?

自闭症网瘾萝莉.ら 提交于 2020-01-13 19:32:07
问题 I am trying to write a grammar for ParseKit so that it matches basic propositional logic sentences in an iphone app. Can someone please tell me where im going wrong. @start = wff; wff = disjunction (implies disjunction)?; disjunction = conjuction (or conjuction)*; conjunction = notExpression (and notExpression)*; notExpression = (not | not primaryExpression); primaryExpression = variable | lbracket wff rbracket; variable = p | q | r; p = 'P'; q = 'Q'; r = 'R'; implies = '→'; and = '∧'; or = '

How to debug an invalid ParseKit Grammar?

為{幸葍}努か 提交于 2020-01-13 19:32:05
问题 I am trying to write a grammar for ParseKit so that it matches basic propositional logic sentences in an iphone app. Can someone please tell me where im going wrong. @start = wff; wff = disjunction (implies disjunction)?; disjunction = conjuction (or conjuction)*; conjunction = notExpression (and notExpression)*; notExpression = (not | not primaryExpression); primaryExpression = variable | lbracket wff rbracket; variable = p | q | r; p = 'P'; q = 'Q'; r = 'R'; implies = '→'; and = '∧'; or = '

Objective-C ParseKit return value

半世苍凉 提交于 2020-01-03 03:09:06
问题 In flex/lex/bison/yacc (all of which I just started reading about), you can set "$$" to be equal to some value ($1,$2,$3) and that's the value that gets returned. At least I think that's how it works. In ParseKit, you are given a stack so I imagine that the ($1,$2,$3) would be the first three values on the stack for example. But then I think what you would want to do is pop those values off the stack and put your return value on the stack. I see that the stack comes with a push method. Do you

Objective-C ParseKit return value

▼魔方 西西 提交于 2020-01-03 03:09:03
问题 In flex/lex/bison/yacc (all of which I just started reading about), you can set "$$" to be equal to some value ($1,$2,$3) and that's the value that gets returned. At least I think that's how it works. In ParseKit, you are given a stack so I imagine that the ($1,$2,$3) would be the first three values on the stack for example. But then I think what you would want to do is pop those values off the stack and put your return value on the stack. I see that the stack comes with a push method. Do you

When ParseKit tries to recognize my Grammar, it enters an infinite loop. What's wrong?

旧城冷巷雨未停 提交于 2019-12-24 13:08:06
问题 Hi I am creating grammar for some formula which is using recursion. The formula is much more complicated but for now I test only some part of it. After calling parse method it crashes on allMatchesFor method. The stack trace is full of allMatchesFor invocations so it looks like it is in infinite loop Where is the problem. Is it in my grammar construction logic or else ? How can I accomplish similar thing to avoid this crash My grammar is like: @start = formula; formula = valueTypeResult;

ParseKit - SQLite parser going into infinite recursion

落花浮王杯 提交于 2019-12-24 04:59:13
问题 For my application, I am trying to build an SQLite parser. As my application is using Objective-C, ParseKit seems like a good option. I read SQLite's syntax diagrams and built a grammar based on them. However, when I try to parse something using this grammar, the parser goes into infinite recursion. The only statements I need are SELECT, INSERT, UPDATE, and DELETE (I need SELECT mostly because the others refer to it). My @start is designed to handle multiple statements separated by semicolons

ParseKit: What built-in Productions should I use in my Grammars?

时光总嘲笑我的痴心妄想 提交于 2019-12-23 01:54:23
问题 I just started using ParseKit to explore language creation and perhaps build a small toy DSL. However, the current SVN trunk from Google is throwing a -[PKToken intValue]: unrecognized selector sent to instance ... when parsing this grammar: @start = identifier ; identifier = (Letter | '_') | (letterOrDigit | '_') ; letterOrDigit = Letter | Digit ; Against this input: foo Clearly, I am missing something or have incorrectly configured my project. What can I do to fix this issue? 回答1: Developer

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

空扰寡人 提交于 2019-12-18 03:38:18
问题 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? 回答1: Developer of ParseKit here. OK, after working through a tricky issue in Xcode 4, I have figured out my preferred way to do this: Create a new Workspace ("MySuite") which contains two sub-Projects Your Mac Cocoa Application Project ("MyApp") The ParseKit Framework

Can't get simple ParseKit example working

无人久伴 提交于 2019-12-13 14:35:16
问题 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 factory] parserFromGrammar:grammar assembler:self]; [parser parse:test]; } - (void)didMatchFoo:(PKAssembly *)a { NSLog(@"FOO"); } - (void)didMatchBar:(PKAssembly *)a { NSLog(@"BAR"); } My grammar file looks like this: @start = foo; foo = 'FOO:' bar; bar = 'BAR';

ParseKit greedy matching mode

南楼画角 提交于 2019-12-11 12:56:23
问题 I am making something like formula validator and I am using ParseKit framework to accomplish that. My approach is to create proper grammar and when didMatchFormula callback method is called on sample string I assume formula has been found and therefore it is valid. There is one difficulty however - formula is detected from sample string even if it contains also other characters following formula part. I would need something like greedy mode for matching - an entire string would be matched