9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] yacc question
@ 2007-02-04 20:12 Joel Salomon
  2007-02-04 20:40 ` Russ Cox
  0 siblings, 1 reply; 10+ messages in thread
From: Joel Salomon @ 2007-02-04 20:12 UTC (permalink / raw)
  To: 9fans

How do I best tell yacc to expect a Rune?  For example, defining a
“colon-equals” assignment operator with
	%right	L'≔'
then adding it to the grammar with
	expr:	NUMBER
		| VAR		{ $$ = mem[$1]; }
		| VAR L'≔' expr	{ $$ = mem[$1] = $3; }
		| …
results in the yacc error message:
	fatal error:must specify type for  ≔, /usr/chesky/src/hak/hoc/hoc2.y:23
Expressing the character constant as '≔' rather than L'≔' gets rid of
that error message, but now I’m not confident that it’s looking for
the correct value; I find no reference to the character ≔ or to the
numbers 2254 or 8788 in y.tab.c.  (Although y.output does have it in
the proper place.) More disturbing, if I say
	%right	L'≔'
	…
	expr:	NUMBER
		| VAR		{ $$ = mem[$1]; }
		| VAR '≔' expr	{ $$ = mem[$1] = $3; }
(keeping the L prefix on one instace), yacc is satisfied as well.

What is the “right” way of using Rune literals in yacc?

--Joel



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-02-05  9:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-04 20:12 [9fans] yacc question Joel Salomon
2007-02-04 20:40 ` Russ Cox
2007-02-04 20:52   ` Joel Salomon
2007-02-04 21:00     ` charstod (Was re: [9fans] yacc question) Joel Salomon
2007-02-04 21:01     ` [9fans] yacc question Russ Cox
2007-02-04 22:05       ` Joel Salomon
2007-02-05  1:06       ` geoff
2007-02-05  2:49         ` Joel Salomon
2007-02-05  3:06           ` geoff
2007-02-05  9:36             ` Bruce Ellis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).