how to work with Bison locations?

2009-06-02 Thread Kynn Jones
Hi. I'm working with Bison (and Flex) for the first time, and it's rough going. I can't get Bison locations to work. The following toy parser illustrates the problem. Here's the file for Flex, bug.l: --- %{ #include "

Re: how to work with Bison locations?

2009-06-02 Thread Kynn Jones
On Tue, Jun 2, 2009 at 5:06 PM, Hans Aberg wrote: > On 2 Jun 2009, at 22:27, Kynn Jones wrote: > >> I can't get Bison locations to work. > > Bison now has a %locations option - see this link and its example. > http://lists.gnu.org/archive/html/help-bison/2009-05/msg00

Re: how to work with Bison locations?

2009-06-03 Thread Kynn Jones
On Wed, Jun 3, 2009 at 1:28 AM, Luca wrote: > Location are created by lexer and "reduced" by the parser, so you have to > create them using the lexer: > > #define YY_USER_ACTION {yylloc.first_line = yylineno; yylloc.first_column = > colnum; colnum=colnum+yyleng; yylloc.last_column=colnum; yylloc.l

callbacks, #define/typedef tricks

2009-06-04 Thread Kynn Jones
Hi. I want to write a "base parser" for JSON that can be easily customized to generate objects in any interpreted language (such as Perl or R) whose underlying implementation is in C. The idea is that I need a good way to plugin callbacks corresponding to the various "parser events". E.g. I want