www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [sorry for this again] D grammar

reply "Ivan Senji" <ivan.senji public.srce.hr> writes:
I have writen D grammar and i wanted to test it but:
-my LR parser generator generates a table with over 17000
states, and it takes around 3hours to calculate the table, using (200MB
of memory) (Probably mostly so slow because of my implementation of set
using an array and unoptimized algorithms)

So is there any tool for testing a grammar that could make grammar
debugging easier and faster?
Aug 18 2004
next sibling parent reply Charlie <Charlie_member pathlink.com> writes:
Yacc grammar ?  Not sure, though eclipse has a plugin for antlr that makes
developing super cool.  

and it takes around 3hours to calculate the table, using (200MB
of memory)
Not sure what this means, I hope thats not a runtime calculation :). Do you have the grammar posted somewhere ? Charlie In article <cfvhdi$2d8o$1 digitaldaemon.com>, Ivan Senji says...
I have writen D grammar and i wanted to test it but:
-my LR parser generator generates a table with over 17000
states, and it takes around 3hours to calculate the table, using (200MB
of memory) (Probably mostly so slow because of my implementation of set
using an array and unoptimized algorithms)

So is there any tool for testing a grammar that could make grammar
debugging easier and faster?
Aug 18 2004
parent reply "Ivan Senji" <ivan.senji public.srce.hr> writes:
"Charlie" <Charlie_member pathlink.com> wrote in message
news:cg04m0$8m6$1 digitaldaemon.com...
 Yacc grammar ?  Not sure, though eclipse has a plugin for antlr that makes
 developing super cool.

and it takes around 3hours to calculate the table, using (200MB
of memory)
Not sure what this means, I hope thats not a runtime calculation :). Do
you
 have the grammar posted somewhere ?
Well, a table has to be calculated only once and can be used many times :) I'll post the grammar if i finish it, i have taken another aproach of writing it one little peace at a time. So now i have expressions, import, declarations, and while :) But i don't think it is possible to solve some ambiguities that i have found, like identifier: basicType or primaryExpression? Right now to solve this my grammars basicTypes begins with "type". So this may turn out to be a grammar for a hypothetical language and not for D. If my memory serves me well, you mentioned writing a grammar too, how is that going?
 Charlie

 In article <cfvhdi$2d8o$1 digitaldaemon.com>, Ivan Senji says...
I have writen D grammar and i wanted to test it but:
-my LR parser generator generates a table with over 17000
states, and it takes around 3hours to calculate the table, using (200MB
of memory) (Probably mostly so slow because of my implementation of set
using an array and unoptimized algorithms)

So is there any tool for testing a grammar that could make grammar
debugging easier and faster?
Aug 18 2004
parent Charlie <Charlie_member pathlink.com> writes:
I modified the java grammar that ships with antlr, it almost works but it had
some ambiguity problems with attribues, it can do 'public :', and 'public {
declDefs }' but not just 'public' :S.

Its at dsource.org under General ( sites down atm or id give link ), under D
Grammar.

Ive given it up though for the DMD front end , which is very nice.  We defintly
need a grammar though.

Charlie

In article <cg0bj9$sak$1 digitaldaemon.com>, Ivan Senji says...
"Charlie" <Charlie_member pathlink.com> wrote in message
news:cg04m0$8m6$1 digitaldaemon.com...
 Yacc grammar ?  Not sure, though eclipse has a plugin for antlr that makes
 developing super cool.

and it takes around 3hours to calculate the table, using (200MB
of memory)
Not sure what this means, I hope thats not a runtime calculation :). Do
you
 have the grammar posted somewhere ?
Well, a table has to be calculated only once and can be used many times :) I'll post the grammar if i finish it, i have taken another aproach of writing it one little peace at a time. So now i have expressions, import, declarations, and while :) But i don't think it is possible to solve some ambiguities that i have found, like identifier: basicType or primaryExpression? Right now to solve this my grammars basicTypes begins with "type". So this may turn out to be a grammar for a hypothetical language and not for D. If my memory serves me well, you mentioned writing a grammar too, how is that going?
 Charlie

 In article <cfvhdi$2d8o$1 digitaldaemon.com>, Ivan Senji says...
I have writen D grammar and i wanted to test it but:
-my LR parser generator generates a table with over 17000
states, and it takes around 3hours to calculate the table, using (200MB
of memory) (Probably mostly so slow because of my implementation of set
using an array and unoptimized algorithms)

So is there any tool for testing a grammar that could make grammar
debugging easier and faster?
Aug 18 2004
prev sibling next sibling parent reply "Sammy" <not there.com> writes:
Yvan,

Here is a Yacc grammar for the "C" Language.
When processed by Bison, its gives a parser
with 355 states. There are 217 rules in this grammar.

The parser is produced in less than 2 seconds.

I think a "D" lalr grammar should be  comparable in size
and time processing to the "C" one.

Try the "C" one. If you do not get better figures, then
there might be a bug in your parser generator.

If you need any of the other files produced by Bison,
like the ansic.tab.c or the ansic.output file, just ask.

You posted a grammar recently (May, 2 2004), dgram.gram.
Is this the grammar you are using ?

I will do some tests with it and report my findings (if any).

-- S

"Ivan Senji" <ivan.senji public.srce.hr> wrote in message
news:cfvhdi$2d8o$1 digitaldaemon.com...
 I have writen D grammar and i wanted to test it but:
 -my LR parser generator generates a table with over 17000
 states, and it takes around 3hours to calculate the table, using (200MB
 of memory) (Probably mostly so slow because of my implementation of set
 using an array and unoptimized algorithms)

 So is there any tool for testing a grammar that could make grammar
 debugging easier and faster?
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.740 / Virus Database: 494 - Release Date: 04-08-16 begin 666 ansic.y M10HC9&5F:6YE(%12144*"B-I;F-L=61E(#QS=')I;F<N:#X*(VEN8VQU9&4 M/'-T9&%R9RYH/ HC:6YC;'5D92 \<W1D:6\N:#X*(VEN8VQU9&4 /'-T9&QI M8BYH/ HC:6YC;'5D92 \<W1D9&5F+F ^"B-I;F-L=61E(#QC='EP92YH/ HC M:6YC;'5D92 B=')E92YH( HC:6YC;'5D92 B='EP97,N:"(*(VEN8VQU9&4 M(G-Y;71B;"YH( H*=F]I9"!Y>65R<F]R*"!C:&%R("IS("D["FEN="!Y>6QE M>" I.PIE>'1E<FX :6YT('EY;&EN96YO.PH*:6YT('EY<&%R<V4H*3L*"B5] M" HE=6YI;VX*>PES=')U8W0*"7L)<W1R=6-T(&YO9&4 *G1R965?:6YF;SL* M"0ES=')U8W0 4WEM8F]L5&%B;&5.;V1E("IS>6UP='([" D)<W1R=6-T('1Y M3TQ/3 HE=&]K96X 05543PHE=&]K96X 4D5'25-415(*)71O:V5N(%-4051) M0PHE=&]K96X 15A415)."B5T;VME;B!465!%1$5&"B5T;VME;B!63TE$"B5T M"B5T;VME;B!&3$]!5 HE=&]K96X 1$]50DQ%"B5T;VME;B!324=.140*)71O M:V5N(%5.4TE'3D5$"B5T;VME;B!465!%1$5&7TY!344*)71O:V5N($-/3E-4 M"B5T;VME;B!63TQ!5$E,10HE=&]K96X 241%3E1)1DE%4 HE=&]K96X 3$5& M5%]"04Y!3D$*)71O:V5N(%))1TA47T)!3D%.00HE=&]K96X 4U1254-4"B5T M($-/3$]."B5T;VME;B!%3E5-"B5T;VME;B!,14947U!!4D5.5$ *)71O:V5N M(%))1TA47U!!4D5.5$ *)71O:V5N($Q%1E1?0E)!0TM%5 HE=&]K96X 4DE' M2%1?0E)!0TM%5 HE=&]K96X 05-415))4TL*)71O:V5N($5,3$E04TE3"B5T M10HE=&]K96X 4U=)5$-("B5T;VME;B!72$E,10HE=&]K96X 1$\*)71O:V5N M($9/4 HE=&]K96X 1T]43PHE=&]K96X 0T].5$E.544*)71O:V5N($)214%+ M"B5T;VME;B!215154DX*)71O:V5N($U53%1)4$Q97T5154%,"B5T;VME;B!$ M259)1$5?15%504P*)71O:V5N(%)%34%)3D1%4E]%455!3 HE=&]K96X 4$Q5 M4U]%455!3 HE=&]K96X 34E.55-?15%504P*)71O:V5N($Q%1E1?4TA)1E1? M15%504P*)71O:V5N(%))1TA47U-(24947T5154%,"B5T;VME;B!!3D1?15%5 M04P*)71O:V5N(%A/4E]%455!3 HE=&]K96X 3U)?15%504P*)71O:V5N(%%5 M3$%-051)3TX*)71O:V5N($-)4D-/3D9,15 *)71O:V5N($%-4$524T%.1 HE M=&]K96X 15%504Q?15%504P*)71O:V5N($Y/5%]%455!3 HE=&]K96X 3$53 M4PHE=&]K96X 34]210HE=&]K96X 3$534U]%455!3 HE=&]K96X 1U)%051% M4E]%455!3 HE=&]K96X 3$5&5%]32$E&5 HE=&]K96X 4DE'2%1?4TA)1E0* M)71O:V5N(%!,55,*)71O:V5N($U/24Y54PHE=&]K96X 4TQ!4T *)71O:V5N M(%!%4D-%3E0*)71O:V5N(%!,55-?4$Q54PHE=&]K96X 34E.55-?34E.55,* M)71O:V5N(%-)6D5/1 HE=&]K96X 5$E,1$4*)71O:V5N($]2"B5T;VME;B!0 M3TE.5 HE=&]K96X 05)23U<*)71O:V5N(%-44DE.1PHE=&]K96X 24Y414=% M"B5S=&%R="!S;W5R8V4*"B4E" IS;W5R8V4*"3H)=')A;G-L871I;VY?=6YI M= H).PH*=')A;G-L871I;VY?=6YI= H). EE>'1E<FYA;%]D969I;FET:6]N M" E\"71R86YS;&%T:6]N7W5N:70 ("!E>'1E<FYA;%]D969I;FET:6]N" D[ M" IE>'1E<FYA;%]D969I;FET:6]N" DZ"69U;F-T:6]N7V1E9FEN:71I;VX* M"7P)9&5C;&%R871I;VX*"3L*"F9U;F-T:6]N7V1E9FEN:71I;VX*"3H)9&5C M;&%R871I;VY?<W!E8VEF:65R<R 9&5C;&%R871O<B 9&5C;&%R871I;VY? M;&ES="!C;VUP;W5N9%]S=&%T96UE;G0*"7P (&1E8VQA<F%T;W( (&1E8VQA M<F%T:6]N7VQI<W0 8V]M<&]U;F1?<W1A=&5M96YT" E\"61E8VQA<F%T:6]N M7W-P96-I9FEE<G, (&1E8VQA<F%T;W( 8V]M<&]U;F1?<W1A=&5M96YT" E\ M"61E8VQA<F%T;W( 8V]M<&]U;F1?<W1A=&5M96YT" D[" ID96-L87)A=&EO M;E]L:7-T" DZ"61E8VQA<F%T:6]N" E\"61E8VQA<F%T:6]N7VQI<W0 (&1E M8VQA<F%T:6]N" D[" ID96-L87)A=&EO; H (" Z"61E8VQA<F%T:6]N7W-P M96-I9FEE<G, ("!I;FET7V1E8VQA<F%T;W)?;&ES="!314U)0T],3TX*"7P M(&1E8VQA<F%T:6]N7W-P96-I9FEE<G, (" (" (" (" (" (" (" M("!314U)0T],3TX*(" .PH*9&5C;&%R871I;VY?<W!E8VEF:65R<PH). ES M=&]R86=E7V-L87-S7W-P96-I9FEE<B (&1E8VQA<F%T:6]N7W-P96-I9FEE M<G,*"7P)<W1O<F%G95]C;&%S<U]S<&5C:69I97(*(" ? ET>7!E7W-P96-I M9FEE<B (" (" (" (&1E8VQA<F%T:6]N7W-P96-I9FEE<G,*"7P)='EP M95]S<&5C:69I97(*(" ? ET>7!E7W%U86QI9FEE<B (" (" (" (&1E M8VQA<F%T:6]N7W-P96-I9FEE<G,*(" ? ET>7!E7W%U86QI9FEE< H (" [ M" IS=&]R86=E7V-L87-S7W-P96-I9FEE< H). E!551/"B ('P)4D5'25-4 M15(*(" ? E35$%424,*(" ? E%6%1%4DX*(" ? E465!%1$5&"B (#L* M(" ? E)3E0*(" ? E,3TY'"B ('P)1DQ/050*(" ? E$3U5"3$4*(" M? E324=.140*(" ? E53E-)1TY%1 H ("!\"7-T<G5C=%]O<E]U;FEO;E]S M<&5C:69I97(*(" ? EE;G5M7W-P96-I9FEE< H ("!\"5194$5$149?3D%- M"B (#L*"G-T<G5C=%]O<E]U;FEO;E]S<&5C:69I97(*"3H)<W1R=6-T7V]R M7W5N:6]N("!)1$5.5$E&2452("!,14947T)!3D%.02 <W1R=6-T7V1E8VQA M<F%T:6]N7VQI<W0 4DE'2%1?0D%.04Y!"B ('P)<W1R=6-T7V]R7W5N:6]N M(" (" (" (" ("!,14947T)!3D%.02 <W1R=6-T7V1E8VQA<F%T:6]N M7VQI<W0 4DE'2%1?0D%.04Y!"B ('P)<W1R=6-T7V]R7W5N:6]N("!)1$5. M5$E&2452"B (#L M7U5.24]."B (#L*"G-T<G5C=%]D96-L87)A=&EO;E]L:7-T" DZ"7-T<G5C M=%]D96-L87)A=&EO; H ("!\"7-T<G5C=%]D96-L87)A=&EO;E]L:7-T(" M<W1R=6-T7V1E8VQA<F%T:6]N"B (#L*"FEN:71?9&5C;&%R871O<E]L:7-T M" DZ"6EN:71?9&5C;&%R871O< H ("!\"6EN:71?9&5C;&%R871O<E]L:7-T M(" 0T]-34$ ("!I;FET7V1E8VQA<F%T;W(*(" .PH*:6YI=%]D96-L87)A M=&]R" DZ"61E8VQA<F%T;W(*(" ? ED96-L87)A=&]R(" 15%504P ("!I M;FET:6%L:7IE< H (" [" IS=')U8W1?9&5C;&%R871I;VX*"3H)<W!E8VEF M:65R7W%U86QI9FEE<E]L:7-T("!S=')U8W1?9&5C;&%R871O<E]L:7-T(" M4T5-24-/3$]."B (#L*"G-P96-I9FEE<E]Q=6%L:69I97)?;&ES= H). ET M>7!E7W-P96-I9FEE<B <W!E8VEF:65R7W%U86QI9FEE<E]L:7-T"B ('P) M='EP95]S<&5C:69I97(*(" ? ET>7!E7W%U86QI9FEE<B <W!E8VEF:65R M7W%U86QI9FEE<E]L:7-T"B ('P)='EP95]Q=6%L:69I97(*(" .PH*<W1R M=6-T7V1E8VQA<F%T;W)?;&ES= H). ES=')U8W1?9&5C;&%R871O< H)? ES M=')U8W1?9&5C;&%R871O<E]L:7-T($-/34U!('-T<G5C=%]D96-L87)A=&]R M" D[" IS=')U8W1?9&5C;&%R871O< H). ED96-L87)A=&]R" E\"61E8VQA M<F%T;W( 0T],3TX 8V]N<W1A;G1?97AP<F5S<VEO; H)? D (" (" (" M($-/3$].(&-O;G-T86YT7V5X<')E<W-I;VX*"3L*"F5N=6U?<W!E8VEF:65R M" DZ"45.54T 241%3E1)1DE%4B!,14947T)!3D%.02!E;G5M97)A=&]R7VQI M<W0 4DE'2%1?0D%.04Y!" E\"45.54T (" (" (" ("!,14947T)!3D%. M02!E;G5M97)A=&]R7VQI<W0 4DE'2%1?0D%.04Y!" E\"45.54T 241%3E1) M1DE%4 H).PH*96YU;65R871O<E]L:7-T" DZ"65N=6UE<F%T;W(*"7P)96YU M;65R871O<E]L:7-T($-/34U!(&5N=6UE<F%T;W(*"3L*"F5N=6UE<F%T;W(* M"3H)241%3E1)1DE%4 H)? E)1$5.5$E&2452($5154%,(&-O;G-T86YT7V5X M<')E<W-I;VX*"3L*"F1E8VQA<F%T;W(*"3H)<&]I;G1E<B!D:7)E8W1?9&5C M;&%R871O< H ("!\"2 (" (" 9&ER96-T7V1E8VQA<F%T;W(*(" .PH* M9&ER96-T7V1E8VQA<F%T;W(*"3H)241%3E1)1DE%4 H ("!\"4Q%1E1?4$%2 M14Y42" 9&5C;&%R871O<B 4DE'2%1?4$%214Y42 H ("!\"61I<F5C=%]D M96-L87)A=&]R("!,14947T)204-+150 (&-O;G-T86YT7V5X<')E<W-I;VX M(%))1TA47T)204-+150*(" ? ED:7)E8W1?9&5C;&%R871O<B 3$5&5%]" M('P)9&ER96-T7V1E8VQA<F%T;W( ($Q%1E1?4$%214Y42" <&%R86UE=&5R M7W1Y<&5?;&ES=" 4DE'2%1?4$%214Y42 H ("!\"61I<F5C=%]D96-L87)A M=&]R("!,14947U!!4D5.5$ (&ED96YT:69I97)?;&ES=" (" (%))1TA4 M7U!!4D5.5$ *(" ? ED:7)E8W1?9&5C;&%R871O<B 3$5&5%]005)%3E1( M(" (" (" (" (" (" (" ("!224=(5%]005)%3E1("B (#L*"G!O M:6YT97(*"3H)05-415))4TL ('1Y<&5?<75A;&EF:65R7VQI<W0*(" ? E! M4U1%4DE32PH ("!\"4%35$5225-+("!T>7!E7W%U86QI9FEE<E]L:7-T("!P M;VEN=&5R"B ('P)05-415))4TL (" (" (" (" (" (" (" ('!O M:6YT97(*(" .PH*='EP95]Q=6%L:69I97)?;&ES= H). ET>7!E7W%U86QI M9FEE< H ("!\"71Y<&5?<75A;&EF:65R7VQI<W0 ("!T>7!E7W%U86QI9FEE M< H (" [" IP87)A;65T97)?='EP95]L:7-T" DZ"7!A<F%M971E<E]L:7-T M"G!A<F%M971E<E]L:7-T" DZ"7!A<F%M971E<E]D96-L87)A=&EO; H ("!\ M"7!A<F%M971E<E]L:7-T(" 0T]-34$ ("!P87)A;65T97)?9&5C;&%R871I M;VX*(" .PH*<&%R86UE=&5R7V1E8VQA<F%T:6]N" DZ"61E8VQA<F%T:6]N M7W-P96-I9FEE<G, ("!D96-L87)A=&]R"B ('P)9&5C;&%R871I;VY?<W!E M8VEF:65R<R (&%B<W1R86-T7V1E8VQA<F%T;W(*(" ? ED96-L87)A=&EO M;E]S<&5C:69I97)S"B (#L*"FED96YT:69I97)?;&ES= H). E)1$5.5$E& M;FET:6%L:7IE< H). EA<W-I9VYM96YT7V5X<')E<W-I;VX*(" ? E,1494 M7T)!3D%.02 (&EN:71I86QI>F5R7VQI<W0 (" (" (" (%))1TA47T)! M3D%.00H ("!\"4Q%1E1?0D%.04Y!(" :6YI=&EA;&EZ97)?;&ES=" ($-/ M34U!(" 4DE'2%1?0D%.04Y!"B (#L*"FEN:71I86QI>F5R7VQI<W0*"3H) M:7IE< H).PH*='EP95]N86UE" DZ"7-P96-I9FEE<E]Q=6%L:69I97)?;&ES M=" 86)S=')A8W1?9&5C;&%R871O< H ("!\"7-P96-I9FEE<E]Q=6%L:69I M97)?;&ES= H (" [" IA8G-T<F%C=%]D96-L87)A=&]R" DZ"7!O:6YT97(* M(" ? EP;VEN=&5R("!D:7)E8W1?86)S=')A8W1?9&5C;&%R871O< H ("!\ M"61I<F5C=%]A8G-T<F%C=%]D96-L87)A=&]R"B (#L*"F1I<F5C=%]A8G-T M<F%C=%]D96-L87)A=&]R" DZ(" (" (" (" (" (" (" (" (" M("!,14947U!!4D5.5$ (&%B<W1R86-T7V1E8VQA<F%T;W( 4DE'2%1?4$%2 M14Y42 H ("!\"61I<F5C=%]A8G-T<F%C=%]D96-L87)A=&]R($Q%1E1?0E)! M(" (" (" (" (" (%))1TA47T)204-+150*(" ? D (" (" (" M(" (" (" (" (" ("!,14947T)204-+150 8V]N<W1A;G1?97AP<F5S M<VEO;B 4DE'2%1?0E)!0TM%5 H ("!\"2 (" (" (" (" (" (" M(" (" ($Q%1E1?0E)!0TM%5" (" (" (" (" (" (" ("!224=( M14947U!!4D5.5$ <&%R86UE=&5R7W1Y<&5?;&ES=" 4DE'2%1?4$%214Y4 M2 H ("!\( ED:7)E8W1?86)S=')A8W1?9&5C;&%R871O<B!,14947U!!4D5. M5$ (" (" (" (" (" (" (" 4DE'2%1?4$%214Y42 H ("!\(" M(" (" (" (" (" (" (" (" ($Q%1E1?4$%214Y42"!P87)A;65T M97)?='EP95]L:7-T("!224=(5%]005)%3E1("B ('P (" (" (" (" M(" (" (" (" (" 3$5&5%]005)%3E1((" (" (" (" (" (" M(" (%))1TA47U!!4D5.5$ *(" .PH*<W1A=&5M96YT" DZ"6QA8F5L961? M<W1A=&5M96YT"B ('P)97AP<F5S<VEO;E]S=&%T96UE;G0*(" ? EC;VUP M;W5N9%]S=&%T96UE;G0*(" ? EI=&5R871I;VY?<W1A=&5M96YT"B ('P) M:G5M<%]S=&%T96UE;G0*(" ? ES96QE8W1I;VY?<W1A=&5M96YT"B (#L* M" IL86)E;&5D7W-T871E;65N= H). E)1$5.5$E&2452(" (" (" (" M97AP<F5S<VEO;B ($-/3$].("!S=&%T96UE;G0*(" ? E$149!54Q4(" M(" (" (" (" (" (" ($-/3$].("!S=&%T96UE;G0*(" .PH*97AP M<F5S<VEO;E]S=&%T96UE;G0*"3H)97AP<F5S<VEO;B 4T5-24-/3$]."B M('P)4T5-24-/3$]."B (#L*"F-O;7!O=6YD7W-T871E;65N= H). E,1494 M7T)!3D%.02 (&1E8VQA<F%T:6]N7VQI<W0 ("!S=&%T96UE;G1?;&ES=" M(%))1TA47T)!3D%.00H ("!\"4Q%1E1?0D%.04Y!(" 9&5C;&%R871I;VY? M;&ES=" (" (" (" (" (" (" 4DE'2%1?0D%.04Y!"B ('P)3$5& M5%]"04Y!3D$ (" (" (" (" (" (" (" <W1A=&5M96YT7VQI<W0 M("!224=(5%]"04Y!3D$*(" ? E,14947T)!3D%.02 (" (" (" (" M(" (" (" (" (" (" (" (" (%))1TA47T)!3D%.00H (" [" IS M=&%T96UE;G1?;&ES= H). ES=&%T96UE;G0*(" ? ES=&%T96UE;G1?;&ES M=" <W1A=&5M96YT"B (#L*"G-E;&5C=&EO;E]S=&%T96UE;G0*"3H)4U=) M5$-(($Q%1E1?4$%214Y42"!E>'!R97-S:6]N(%))1TA47U!!4D5.5$ <W1A M=&5M96YT"B ('P)248 (" ($Q%1E1?4$%214Y42"!E>'!R97-S:6]N(%)) M1TA47U!!4D5.5$ <W1A=&5M96YT"B ('P)248 (" ($Q%1E1?4$%214Y4 M2"!E>'!R97-S:6]N(%))1TA47U!!4D5.5$ <W1A=&5M96YT($5,4T4 <W1A M=&5M96YT"B (#L*"FET97)A=&EO;E]S=&%T96UE;G0*"3H)5TA)3$4 ("!, M14947U!!4D5.5$ ("!E>'!R97-S:6]N(" 4DE'2%1?4$%214Y42" ('-T M871E;65N= H ("!\"41/(" <W1A=&5M96YT(" 5TA)3$4 ("!,14947U!! M3 H ("!\"49/4B!,14947U!!4D5.5$ ;W!T7V5X<'( 4T5-24-/3$].(&]P M;65N= H (" [" IO<'1?97AP< H). H ("!\"65X<')E<W-I;VX*(" .PH* M:G5M<%]S=&%T96UE;G0*"3H)1T]43R ($E$14Y4249)15( (" 4T5-24-/ M3$]."B ('P)0T].5$E.544 (" (" (" (" 4T5-24-/3$]."B ('P) M0E)%04L (" (" (" (" (" 4T5-24-/3$]."B ('P)4D5455).(" M97AP<F5S<VEO;B 4T5-24-/3$]."B ('P)4D5455).(" (" (" (" M(" 4T5-24-/3$]."B (#L*"F5X<')E<W-I;VX*"3H)87-S:6=N;65N=%]E M>'!R97-S:6]N"B ('P)97AP<F5S<VEO;B ($-/34U!(" 87-S:6=N;65N M=%]E>'!R97-S:6]N"B (#L*"F%S<VEG;FUE;G1?97AP<F5S<VEO; H). EC M;VYD:71I;VYA;%]E>'!R97-S:6]N"B ('P)=6YA<GE?97AP<F5S<VEO;B!A M<W-I9VYM96YT7V]P97)A=&]R(&%S<VEG;FUE;G1?97AP<F5S<VEO; H (" [ M" IA<W-I9VYM96YT7V]P97)A=&]R" DZ("!%455!3 H ("!\"4U53%1)4$Q9 M7T5154%,"B ('P)1$E6241%7T5154%,"B ('P)4D5-04E.1$527T5154%, M"B ('P)4$Q54U]%455!3 H ("!\"4U)3E537T5154%,"B ('P)3$5&5%]3 M2$E&5%]%455!3 H ("!\"5))1TA47U-(24947T5154%,"B ('P)04Y$7T51 M54%,"B ('P)6$]27T5154%,"B ('P)3U)?15%504P*(" .PH*8V]N9&ET M:6]N86Q?97AP<F5S<VEO; H). EL;V=I8V%L7T]27V5X<')E<W-I;VX*"7P) M;&]G:6-A;%]/4E]E>'!R97-S:6]N("!154535$E/3B 97AP<F5S<VEO;B M0T],3TX 8V]N9&ET:6]N86Q?97AP<F5S<VEO; H (" [" IC;VYS=&%N=%]E M>'!R97-S:6]N" DZ"6-O;F1I=&EO;F%L7V5X<')E<W-I;VX*(" .PH*;&]G M:6-A;%]/4E]E>'!R97-S:6]N" DZ"6QO9VEC86Q?04Y$7V5X<')E<W-I;VX* M(" ? EL;V=I8V%L7T]27V5X<')E<W-I;VX ("!/4E]/4B (&QO9VEC86Q? M04Y$7V5X<')E<W-I;VX*(" .PH*;&]G:6-A;%]!3D1?97AP<F5S<VEO; H) M. EI;F-L=7-I=F5?3U)?97AP<F5S<VEO; H ("!\"6QO9VEC86Q?04Y$7V5X M<')E<W-I;VX ("!!3D1?04Y$(" :6YC;'5S:79E7T]27V5X<')E<W-I;VX* M(" .PH*:6YC;'5S:79E7T]27V5X<')E<W-I;VX*"3H)97AC;'5S:79E7T]2 M7V5X<')E<W-I;VX*(" ? EI;F-L=7-I=F5?3U)?97AP<F5S<VEO;B ($]2 M(&5X8VQU<VEV95]/4E]E>'!R97-S:6]N"B (#L*"F5X8VQU<VEV95]/4E]E M>'!R97-S:6]N" DZ"4%.1%]E>'!R97-S:6]N"B ('P)97AC;'5S:79E7T]2 M.PH*04Y$7V5X<')E<W-I;VX*"3H)97%U86QI='E?97AP<F5S<VEO; H ("!\ M"4%.1%]E>'!R97-S:6]N(" 04U015)304Y$(" 97%U86QI='E?97AP<F5S M<VEO; H (" [" IE<75A;&ET>5]E>'!R97-S:6]N" DZ"7)E;&%T:6]N86Q? M97AP<F5S<VEO; H ("!\"65Q=6%L:71Y7V5X<')E<W-I;VX ("!%455!3%]% M455!3" (')E;&%T:6]N86Q?97AP<F5S<VEO; H ("!\"65Q=6%L:71Y7V5X M<')E<W-I;VX ("!.3U1?15%504P (" (')E;&%T:6]N86Q?97AP<F5S<VEO M; H (" [" IR96QA=&EO;F%L7V5X<')E<W-I;VX*"3H)<VAI9G1?97AP<F5S M<VEO; H ("!\"7)E;&%T:6]N86Q?97AP<F5S<VEO;B ($Q%4U, (" (" M(" (" <VAI9G1?97AP<F5S<VEO; H ("!\"7)E;&%T:6]N86Q?97AP<F5S M<VEO;B ($U/4D4 (" (" (" (" <VAI9G1?97AP<F5S<VEO; H ("!\ M"7)E;&%T:6]N86Q?97AP<F5S<VEO;B ($Q%4U-?15%504P (" (" <VAI M9G1?97AP<F5S<VEO; H ("!\"7)E;&%T:6]N86Q?97AP<F5S<VEO;B ($=2 M14%415)?15%504P (" <VAI9G1?97AP<F5S<VEO; H (" [" IS:&EF=%]E M>'!R97-S:6]N" DZ"6%D9&ET:79E7V5X<')E<W-I;VX*(" ? ES:&EF=%]E M>'!R97-S:6]N(" 3$5&5%]32$E&5" (" (" (&%D9&ET:79E7V5X<')E M<W-I;VX*(" ? ES:&EF=%]E>'!R97-S:6]N(" 4DE'2%1?4TA)1E0 (" M(" (&%D9&ET:79E7V5X<')E<W-I;VX*(" .PH*861D:71I=F5?97AP<F5S M<VEO; H). EM=6QT:7!L:6-A=&EV95]E>'!R97-S:6]N"B ('P)861D:71I M=F5?97AP<F5S<VEO;B (%!,55, ("!M=6QT:7!L:6-A=&EV95]E>'!R97-S M:6]N"B ('P)861D:71I=F5?97AP<F5S<VEO;B ($U/24Y54R!M=6QT:7!L M:6-A=&EV95]E>'!R97-S:6]N"B (#L*"FUU;'1I<&QI8V%T:79E7V5X<')E M<W-I;VX*"3H)8V%S=%]E>'!R97-S:6]N"B ('P);75L=&EP;&EC871I=F5? M97AP<F5S<VEO;B ($%35$5225-+("!C87-T7V5X<')E<W-I;VX*(" ? EM M=6QT:7!L:6-A=&EV95]E>'!R97-S:6]N(" 4TQ!4T (" (&-A<W1?97AP M14Y4(" 8V%S=%]E>'!R97-S:6]N"B (#L*"F-A<W1?97AP<F5S<VEO; H) M. EU;F%R>5]E>'!R97-S:6]N"B ('P)3$5&5%]005)%3E1((" ='EP95]N M86UE(" 4DE'2%1?4$%214Y42" (&-A<W1?97AP<F5S<VEO; H (" [" IU M;F%R>5]E>'!R97-S:6]N" DZ"7!O<W1F:7A?97AP<F5S<VEO; H ("!\"5!, M55-?4$Q54R (" (" (" ("!U;F%R>5]E>'!R97-S:6]N"B ('P)34E. M55-?34E.55, (" (" (" ('5N87)Y7V5X<')E<W-I;VX*(" ? EU;F%R M>5]O<&5R871O<B (&-A<W1?97AP<F5S<VEO; H ("!\"5-)6D5/1B ('5N M87)Y7V5X<')E<W-I;VX*(" ? E325I%3T8 ("!,14947U!!4D5.5$ ('1Y M<&5?;F%M92 4DE'2%1?4$%214Y42 H (" [" IU;F%R>5]O<&5R871O< H) M. E!35!%4E-!3D0*(" ? E!4U1%4DE32PH ("!\"5!,55,*(" ? E-3TE. M55,*(" ? E424Q$10H ("!\"4580TQ!34%424]."B (#L*"G!O<W1F:7A? M97AP<F5S<VEO; H). EP<FEM87)Y7V5X<')E<W-I;VX*(" ? EP;W-T9FEX M7V5X<')E<W-I;VX ($Q%1E1?0E)!0TM%5" 97AP<F5S<VEO;B 4DE'2%1? M0E)!0TM%5 H ("!\"7!O<W1F:7A?97AP<F5S<VEO;B 3$5&5%]005)%3E1( M("!A<F=U;65N=%]E>'!R97-S:6]N7VQI<W0 (%))1TA47U!!4D5.5$ *(" M? EP;W-T9FEX7V5X<')E<W-I;VX ($Q%1E1?4$%214Y42" (" (" (" M(" (" (" (" (" ("!224=(5%]005)%3E1(" E\"7!O<W1F:7A?97AP M<F5S<VEO;B 4$])3E0 ($E$14Y4249)15(*(" ? EP;W-T9FEX7V5X<')E M<W-I;VX ($%24D]7($E$14Y4249)15(*(" ? EP;W-T9FEX7V5X<')E<W-I M;VX (%!,55-?4$Q54PH ("!\"7!O<W1F:7A?97AP<F5S<VEO;B 34E.55-? M34E.55,*(" .PH*<')I;6%R>5]E>'!R97-S:6]N" DZ"4E$14Y4249)15(* M(" ? EC;VYS=&%N= H ( E\"5-44DE.1PH ("!\"4Q%1E1?4$%214Y42" M97AP<F5S<VEO;B 4DE'2%1?4$%214Y42 H (" [" IA<F=U;65N=%]E>'!R M97-S:6]N7VQI<W0*"3H)87-S:6=N;65N=%]E>'!R97-S:6]N"B ('P)87)G M97-S:6]N"B (#L*"F-O;G-T86YT" DZ"4E.5$5'15)?0T].4U1!3E0*(" M("!\"45.54U%4D%424].7T-/3E-404Y4"B (#L*"B4E(" (" +RH <W1A M<G0 ;V8 <')O9W)A;7, *B\*"G9O:60 >7EE<G)O<B 8VAA<B J<R I"GL* M"69P<FEN=&8H('-T9&5R<BP (B5S(&YE87( ;&EN92 E9%QN(BP <RP >7EL 8:6YE;F\ *3L*(" )97AI=" Q*3L*?0H* ` end
Aug 18 2004
parent "Ivan Senji" <ivan.senji public.srce.hr> writes:
"Sammy" <not there.com> wrote in message
news:cg17n8$2ohr$1 digitaldaemon.com...
 Yvan,

 Here is a Yacc grammar for the "C" Language.
 When processed by Bison, its gives a parser
 with 355 states. There are 217 rules in this grammar.
My lr(1) parser generates 1503 states and i think this is a normal difference between lalr and lr(1)
 The parser is produced in less than 2 seconds.
Mine takes a little less than 2min, i think i should consider making a switch wich parser to create lalr or lr(1), it shouldn't be too difficult.
 I think a "D" lalr grammar should be  comparable in size
 and time processing to the "C" one.

 Try the "C" one. If you do not get better figures, then
 there might be a bug in your parser generator.
I wouldn't like this, because from experience these bugs are very hard to find.
 If you need any of the other files produced by Bison,
 like the ansic.tab.c or the ansic.output file, just ask.

 You posted a grammar recently (May, 2 2004), dgram.gram.
 Is this the grammar you are using ?
No. That is an old attempt (and not a very good one) I think i know now why in my first attempt i got 17000 states: i was writing a grammar by figuring out what "parse.c" does. As this is basicaly a recursive descent parser + some magic the grammar i got was more complicated that it should have been because it was more like a ll(1) than lr(1) grammar. Implementing just two changes in two rules (ideas from c gram), decreased the number of states by ~100. PS. I should be studying these days so it will take a couple more days before i get an even partially usefull grammar to post.
Aug 19 2004
prev sibling parent reply "Sammy" <not there.com> writes:
 -my LR parser generator generates a table with over 17000
In my preceding post i forgot to ask: What parser generator are you using, your own or another parser available on the Net ? --
Aug 18 2004
parent reply "Ivan Senji" <ivan.senji public.srce.hr> writes:
"Sammy" <not there.com> wrote in message
news:cg1ipc$mec$1 digitaldaemon.com...
 -my LR parser generator generates a table with over 17000
In my preceding post i forgot to ask: What parser generator are you using, your own or another parser available on the Net ?
My own :) (that is why it is so slow :)
Aug 19 2004
parent reply "Sammy" <not there.com> writes:
 My own :) (that is why it is so slow :)
it is written in C. C++, ??? Will you opensource it ?
Aug 19 2004
parent reply "Ivan Senji" <ivan.senji public.srce.hr> writes:
"Sammy" <not there.com> wrote in message
news:cg22uf$1sg5$1 digitaldaemon.com...
 My own :) (that is why it is so slow :)
it is written in C. C++, ???
What kind of a question is this? D ofcourse! :)
 Will you opensource it ?
Maybe, if i get to parse D with it and conclude it is working, then i would only have to translate it to English and make it public. Actually the grammar is going really well, except for one (not that tiny) simplification.
Aug 19 2004
parent reply Charlie <Charlie_member pathlink.com> writes:
Actually the grammar is going really well, except for
one (not that tiny) simplification.
Whats the simplification ? Charlie In article <cg26hg$1tp5$1 digitaldaemon.com>, Ivan Senji says...
"Sammy" <not there.com> wrote in message
news:cg22uf$1sg5$1 digitaldaemon.com...
 My own :) (that is why it is so slow :)
it is written in C. C++, ???
What kind of a question is this? D ofcourse! :)
 Will you opensource it ?
Maybe, if i get to parse D with it and conclude it is working, then i would only have to translate it to English and make it public. Actually the grammar is going really well, except for one (not that tiny) simplification.
Aug 19 2004
parent "Ivan Senji" <ivan.senji public.srce.hr> writes:
"Charlie" <Charlie_member pathlink.com> wrote in message
news:cg3f41$2lir$1 digitaldaemon.com...
Actually the grammar is going really well, except for
one (not that tiny) simplification.
Whats the simplification ?
As i can't tell the difference between basicType and primaryExpression (identifier can be both..) i made a change that basicType begins with "type" so instead of int x; -> type int x; int func(char[] y); -> type int func(type char[] y); Maybe when i finish the grammar someone will come up with a way of combining the rules for basicType and primaryExpression to eliminate the problem.
 Charlie

 In article <cg26hg$1tp5$1 digitaldaemon.com>, Ivan Senji says...
"Sammy" <not there.com> wrote in message
news:cg22uf$1sg5$1 digitaldaemon.com...
 My own :) (that is why it is so slow :)
it is written in C. C++, ???
What kind of a question is this? D ofcourse! :)
 Will you opensource it ?
Maybe, if i get to parse D with it and conclude it is working, then i would only have to translate it to English and make it public. Actually the grammar is going really well, except for one (not that tiny) simplification.
Aug 20 2004