help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: parsing the content of a terminal


From: Hans Aberg
Subject: Re: parsing the content of a terminal
Date: Fri, 25 Nov 2005 19:20:42 +0100

On 25 Nov 2005, at 16:04, Arkadius Nowakowski wrote:

I've got to parse a grammar (BSDL) that contains strings.
That strings furthermore contain information which has to be parsed.
The problem lies in the concatenation of the BSDL strings:

" substring_1 " &
" substring_2 " &
...
" substring_n "

What I have to do now is build the whole string and parse its content:
" substring_1 substring_2 ... substring_n "

Don't know if I'm right, but I guess the complete string has to be a
terminal. And I have to call bison in a recursvie way to parse the
content of the string. I've searched the internet but I could not find
enough information how to do this.

First, whenever you try to implement a well-known grammar, check out first if somebody else might already have tried it. You might put up a question in the Usenet newsgroup comp.compilers.

Otherwise, the stuff does not have to be anywhere: you put it where it works. If it is simpler to concatenate the strings in the lexer, do that. Otherwise, you can build the string in the parser grammar actions, provided that your semantic type supports string. If you do the latter, make sure your lexer properly clones the strings into the semantic type from the lexer buffer.

  Hans Aberg






reply via email to

[Prev in Thread] Current Thread [Next in Thread]