Re: Lexical feedback and lookahead

2005-07-27 Thread Frans Englich
On Tuesday 19 July 2005 15:01, Evan Lavelle wrote: > Thanks Tim. At first sight, this fix should be exactly what I need; > however, in my case, it doesn't work... :( > > The problem is that COBOL has a real keyword - FUNCTION - to 'lock on' > > to. So, in your production: > > xxx > > > > : { recogn

Re: Lexical feedback and lookahead

2005-07-20 Thread Hans Aberg
On 20 Jul 2005, at 09:21, Evan Lavelle wrote: It seems me that you know that a function has been completed when the function body top level "{" ... "}" has completed. This can be kept track of by a bracket depth count in the lexer. Unfortunately, the real grammar is much more complex

Re: Lexical feedback and lookahead

2005-07-20 Thread Evan Lavelle
Hans Aberg wrote: On 19 Jul 2005, at 17:01, Evan Lavelle wrote: The only way that I know a new function is coming up is that an existing function has just completed: there's no convenient keyword to give me warning. [If my grammar really was this simple, then I could probably use another t

Re: Lexical feedback and lookahead

2005-07-19 Thread Hans Aberg
On 19 Jul 2005, at 17:01, Evan Lavelle wrote: The problem is, in my input, there aren't *any* context-independent keywords (not in this case, anyway). This is equivalent to the COBOL problem where FUNCTION is optional. The grammar looks like this: program : function_list ; function_list

Re: Lexical feedback and lookahead

2005-07-19 Thread Evan Lavelle
Thanks Tim. At first sight, this fix should be exactly what I need; however, in my case, it doesn't work... :( The problem is that COBOL has a real keyword - FUNCTION - to 'lock on' to. So, in your production: xxx : { recognize_function_names = true; } FUNCTION valid_function ; the lexer c

Re: Lexical feedback and lookahead

2005-07-19 Thread Tim Van Holder
Evan Lavelle wrote: > I've got a problem where I need some communication back from Bison to > Flex (in this case, I need Flex to return two different tokens for the > same input, depending on context). > > The procedure is something like: > > 1 - parser determines context and sets global flag for

Lexical feedback and lookahead

2005-07-19 Thread Evan Lavelle
I've got a problem where I need some communication back from Bison to Flex (in this case, I need Flex to return two different tokens for the same input, depending on context). The procedure is something like: 1 - parser determines context and sets global flag for lexer 2 - lexer checks flag,