[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Grammars and jumps
From: |
Hans Aberg |
Subject: |
Re: Grammars and jumps |
Date: |
Tue, 25 Jun 2002 20:16:50 +0200 |
Reply-to: address@hidden
At 00:28 -0300 2002/06/25, Bruno Ribeiro wrote:
>Well, everything is working properly when I use just one single_command
>per line. But I want to have things like:
>
>A = B + C +
>D + E
>
>In other words, a newline ("\n") inside a single_command.
If possible, I use to put into my Flex .l file a line:
%%
[[:space:]]+ { /* Skip white-space. */ }
This way, white-space is zipped out before it reaches the parser. If
newlöines are important only in certain localized parts of your grammr, the
next step would be to try using Flex start-conditions. See the Flex manual,
and the
Help-flex mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/help-flex
>2) I'm trying to implement a function like:
>
>A = B + FAT(3) + C
>
>But when I jump yyacc to the position of FAT(3), I have to know the
>return position (+ C). There's a way for retrieve the current position
>of yyin (before jump)?
One is not doing that way, trying to make the parser jumping. Instead one
builds a parser tree or "closure" using the actions, which is executed
after the parser has been terminated (or finished suitable parsing blocks).
There was a thread here recently "speed-up parsing"; check the Help Bison
archive:
http://mail.gnu.org/mailman/listinfo/help-bison
Hans Aberg