• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Predicates and lex/yacc?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Predicates and lex/yacc?


  • Subject: Predicates and lex/yacc?
  • From: Nicholas Crosbie <email@hidden>
  • Date: Fri, 25 Nov 2005 11:11:46 +1100 (EST)

I'm trying to set up an XCode project to evaluate
expressions.  I thought of using
predicates but I'm not sure that predicates are
suitable for cases where all of the
following are free to change (naturally with certain
limits):

variable name, operator, and length/complexity of
expression

e.g. 	result 1 = e1 AND e2 NOT (k4 OR k6) ;
	result 2 = (e1 OR e3) AND (e2 ORe7) NOT ((k4 OR e6)
AND (k5 AND p7)) ;


***Please speak up if you think this can be handled
through predicates (and how).***

My current approach is to implement a  lex/yacc parser
to generate the Cocoa code.
I'm using "MathPaper" (from Garfinkel & Mahoney...
Building Cocoa Applications) as my test bed.

My steps thus far:

1. changed .l and .y files to .lm and .ym,
respectively.
2. added a printf statement to the rules.ym file
(builds
and runs)
3.  tried replacing the printf with an NSLog statement

i.e.

hello	{ printf ( "world"); }  /* works */
 hello	{ NSLog (@ "world"); }   /*  does not work */

Errors include:

JamToolExecution Evaluator (1 error)
......../jam failed with exit code 1

Undefined symbols:
objc_class_name_NSConstantString
_NSLog
__NSConstantStringClassReference

Mathpaper has two targets.  Do I need to compile the
lex/yacc
target (called "evaluator") on the command line and
then import this and the .lm and .ym files into XCode
without
specifying a target (I have heard that by not
specifying a target
for the lex and yacc files, XCode won't process them
and
incorrectly assume that they are generating pure ANSI
C code)?

Some other problem(s)?

Note that the method that receives the text back from
the
lex/yacc evaluator includes the following:

    str = [ [NSString alloc] initWithData:data
			     encoding:NSASCIIStringEncoding] ;

Since I'm trying to receive an output from NSLog, I
tried

    str = [ [NSString alloc] initWithData:data
			     encoding: NSUnicodeStringEncoding] ;

(i.e. replaced NSASCIIStringEncoding with
NSUnicodeStringEncoding)

I still get the same complaints about undefined
symbols.


- NDC












____________________________________________________
Do you Yahoo!?
Find a local business fast with Yahoo! Local Search
http://au.local.yahoo.com
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Predicates and lex/yacc?
      • From: Andrei Tchijov <email@hidden>
  • Prev by Date: Re: Cross platform development: Was: Deprecated methods in NSDocument
  • Next by Date: Re: Predicates and lex/yacc?
  • Previous by thread: Re: expose hotkeys
  • Next by thread: Re: Predicates and lex/yacc?
  • Index(es):
    • Date
    • Thread