9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] plan9 lexer problem
@ 2008-11-10 11:24 erik quanstrom
  0 siblings, 0 replies; 3+ messages in thread
From: erik quanstrom @ 2008-11-10 11:24 UTC (permalink / raw)
  To: prem.mallappa, 9fans

> %{
> %}
>
> %%
> stop	print("Stop!! recieved\n");
> start	print("Start -> recieved\n");
> %%

the fix for this should be to add
#include <u.h>
#include <libc.h>

between %{ and %} but this doesn't work because
lex includes stdio.h before it processes %{ %}.
you'll need to write a shim, fixlex.c, that goes like this

#include <u.h>
#include <libc.h>
#include "lex.yy.c"

that is unless you want to dive into the lex source. :-)

- erik



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

* Re: [9fans] plan9 lexer problem
       [not found] <d60411c2783a8e0daa773573790ea2b5@quanstro.net>
@ 2008-11-10 11:46 ` Prem Mallappa
  0 siblings, 0 replies; 3+ messages in thread
From: Prem Mallappa @ 2008-11-10 11:46 UTC (permalink / raw)
  To: erik quanstrom; +Cc: 9fans

the manual for lex says ..
lex -9
should generate a Plan9 compatible code with u.h and libc.h included,
otherwise 8c and 8l will generate error searching for vsprintf(...)

/Prem


On Mon, Nov 10, 2008 at 4:54 PM, erik quanstrom <quanstro@quanstro.net> wrote:
>> %{
>> %}
>>
>> %%
>> stop  print("Stop!! recieved\n");
>> start print("Start -> recieved\n");
>> %%
>
> the fix for this should be to add
> #include <u.h>
> #include <libc.h>
>
> between %{ and %} but this doesn't work because
> lex includes stdio.h before it processes %{ %}.
> you'll need to write a shim, fixlex.c, that goes like this
>
> #include <u.h>
> #include <libc.h>
> #include "lex.yy.c"
>
> that is unless you want to dive into the lex source. :-)
>
> - erik
>



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

* [9fans] plan9 lexer problem
@ 2008-11-10  9:56 prem
  0 siblings, 0 replies; 3+ messages in thread
From: prem @ 2008-11-10  9:56 UTC (permalink / raw)
  To: 9fans

Hi,
I was trying to learn lex/yacc decided to use Plan9 (9vx) for writing
example programs. I wrote the following
--------start.l-----
%{
%}

%%
stop	print("Stop!! recieved\n");
start	print("Start -> recieved\n");
%%

-------------

I lex'ed it
-> lex -9 start.l
-> 8c lex.yy.c
-> 8l lex.yy.8
-> ./8.out
start
output: inappropriate use of fd
sd: /bin/sd file does not exists

(with small modifications i.e use of <stdio.h> and using printf, I am
able to compiler and run this). could someone help whats happening in
this case ..



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

end of thread, other threads:[~2008-11-10 11:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-10 11:24 [9fans] plan9 lexer problem erik quanstrom
     [not found] <d60411c2783a8e0daa773573790ea2b5@quanstro.net>
2008-11-10 11:46 ` Prem Mallappa
  -- strict thread matches above, loose matches on Subject: below --
2008-11-10  9:56 prem

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).