|fully parenthesized expression? firstname.lastname@example.org (Mr.E) (2007-03-03)|
|Re: fully parenthesized expression? email@example.com (Dmitry A. Kazakov) (2007-03-05)|
|Re: fully parenthesized expression? firstname.lastname@example.org (Mr.E) (2007-03-08)|
|Re: fully parenthesized expression? email@example.com (Dmitry A. Kazakov) (2007-03-08)|
|Re: fully parenthesized expression? firstname.lastname@example.org (Mr.E) (2007-03-10)|
|From:||"Dmitry A. Kazakov" <email@example.com>|
|Date:||5 Mar 2007 03:32:44 -0500|
|Organization:||cbb software GmbH|
|Posted-Date:||05 Mar 2007 03:32:44 EST|
On 3 Mar 2007 23:31:39 -0500, Mr.E wrote:
> After a good deal of research and effort I have a working operator
> precedence parser. For debugging purposes I would like to output a
> fully parenthesized representation of the original expression.
> Unfortunately, I'm not having success in displaying this. Before I
> reduce I print out what is on the stack ( value 'operator' value ) but
> in most cases the left hand side of the stack contains the result of
> the previous operation I no longer have the original value.
> May I ask if someone would suggest a way to display the operation as
> it is performed.
You need an output queue with both ends accessible rather than a FIFO
output stream ["print"]. But the technique I am using is different. I add
the source location range to all values on the operation and the argument
stacks. The expression terms get the location range of the corresponding
literal / identifier. So do the operations. When a new value is computed
its location range is evaluated as the least range containing the ranges of
the operation and operands generating the value. The ranges can be then
used for error messages generation and in your case to indicate parsing /
evaluation progress and operands association in the source.
Dmitry A. Kazakov
Return to the
Search the comp.compilers archives again.