if you receive for twice time this message i'm sorry i made a mistake Hello, i'm using Bison for compute a mathematic tool to resolve this kind of thing: u(n)=u(n-1)+3*u(n-2);u{0}=1;u{1}=2; the example is very simple and this tools can do more things So the subject: when I execute bison It builds a syntaxical tree (doesn't it?) how recover number (they could change of course) in a correct order cause i need to know how the formulation is written.. i give you a parse of the code: (the print are just here in order for me to understand how does it works)
g : '=' d g {printf("=");} |U '{'N '}' g {printf("U{N}");} |U '{ N '-'NB'}'g {printf("U{n-%d}",$5);} |U '{' N '+' NB '}' g {printf("U{N+%d}",$5);} |U '{' NB '}' g {printf("U{%d}",$3);} |d g {printf(" ");} |V g {printf(" ");} |/*empty*/ {printf(" ")} d : g T {printf(" ");} |NB ';' {printf(" %d ",$1);} T : /*vide*/ {printf(" ");} |NB T {printf("%d",$1);} |'*' T {printf("*");} |'/' T {printf("/");} |'^' T {printf("^");} |'+' T {printf("+");} |'-' T {printf("-");} |';' T {printf(";");} so for this part of an example (without all the rest of the example) U{N}=U{N-1}+3*U{N-2}; U{0}=1; U{1}=2; it's give me: *3+ ; 1 2 =U{1}=U{0} U{n-2} U{n-1} =U{N} how can i do to recover correctly which number for which part of code ? more precisely i need to generate code in java and to do that i need which kind of fomulation its given? thanks for your help! if you need more precision let's continue: moreover it's inside of a group of result globaly like that for this code:the indentation are here just to be clearer begin Name=Suite; begin DEFINITION=RECURRENTE; U{N}=U{N-1}+3*U{N-2}; U{0}=1; U{1}=2; TERME[1..8]; VARIATION; TYPE; SI_ARITH begin FORMULE_ARITH; SOMME_ARITH[1..8]; end SI_GEO begin FORMULE_GEO; SOMME_GEO[1..8]; end end end i'have this tree (the printf("blabla"); ) the indentation are here just to be clearer *3+ ; 1 2 SumAri formulArith begin qa end [1..8] sumGeo formulgeo begin qb end si_Geo si_arith type variation; terme =U{1}=U{0} U{n-2} U{n-1} =U{N} recurrente Definition= begin end name=(null)| begin end syntax error thanks for your help! _______________________________________________ Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison