Re: how to parse linear equations

2010-01-16 Thread Hans Aberg
[Please keep the cc to the Help-Bison list, so that others can help.] On 16 Jan 2010, at 19:00, Michael Chen wrote: If I use an array to hold the coefficients. Do I dynamically allocate an array ... If, at least for a start until you know the other things work, you use an array that can hol

Re: how to parse linear equations

2010-01-16 Thread Philip Herron
On 16/01/2010 15:02, Hans Aberg wrote: On 16 Jan 2010, at 15:52, Michael Chen wrote: Exactly, I would like to first process the linear expression, which are coefficients and a constant; how can I do it over my ast tree recursively? + * * 2+ 3 - x

Re: how to parse linear equations

2010-01-16 Thread Hans Aberg
On 16 Jan 2010, at 15:52, Michael Chen wrote: Exactly, I would like to first process the linear expression, which are coefficients and a constant; how can I do it over my ast tree recursively? + * * 2+ 3 - x y z x Just make a da

Re: how to parse linear equations

2010-01-16 Thread Michael Chen
Exactly, I would like to first process the linear expression, which are coefficients and a constant; how can I do it over my ast tree recursively? + * * 2+ 3 - x y z x Michael On Sat, Jan 16, 2010 at 8:44 AM, Hans Aberg wrote:

Re: how to parse linear equations

2010-01-16 Thread Hans Aberg
On 16 Jan 2010, at 15:21, Michael Chen wrote: My goal is to get to the matrix form Ax =b by collecting and combining linear terms while I am parsing the ast tree. Once I get a clean matrix form Ax=b, it is straightforward to call my other routines to solve it. It may be easier to first parse p

Re: how to parse linear equations

2010-01-16 Thread Michael Chen
My goal is to get to the matrix form Ax =b by collecting and combining linear terms while I am parsing the ast tree. Once I get a clean matrix form Ax=b, it is straightforward to call my other routines to solve it. I also realized that symbolic programming or CLP probably need to so similar thin

Re: how to parse linear equations

2010-01-16 Thread Hans Aberg
On 16 Jan 2010, at 01:40, Michael Chen wrote: The input I have is linear equation like: 2 * x + ( x - y ) = x + 1 And I would like to get at end 2 * x - y = 1 I studied the calculator example, and be able to build ast tree. however I have no way to reduce it. Please give me an example or li

Re: how to parse linear equations

2010-01-15 Thread Rui Maciel
Michael Chen wrote: > Dear there, > > The input I have is linear equation like: > > 2 * x + ( x - y ) = x + 1 > > And I would like to get at end > > 2 * x - y = 1 > > I studied the calculator example, and be able to build ast tree. > however I have no way to reduce it. Please give me an exam

how to parse linear equations

2010-01-15 Thread Michael Chen
Dear there, The input I have is linear equation like: 2 * x + ( x - y ) = x + 1 And I would like to get at end 2 * x - y = 1 I studied the calculator example, and be able to build ast tree. however I have no way to reduce it. Please give me an example or link. Thanks. -- Best regards, Michae