digitalmars.D - D grammar (again)
- Ivan Senji (255/255) May 21 2004 As there isn't any written i have decided to try to write one.
As there isn't any written i have decided to try to write one. So these are the thing that i have succeaded in parsing: <CODE> module IDN . IDN ; import IDN , IDN . IDN ; import IDN ; import IDN . IDN , IDN . IDN . IDN , IDN ; private { import IDN . IDN ; struct IDN { enum IDN { IDN , IDN , IDN = IDN / IDN } } } struct IDN { enum { IDN } } union { } enum IDN { IDN , IDN } int IDN , IDN ; float [ ] [ ] IDN ; int function ( int IDN , int [ ] IDN ) IDN ; </CODE> The first problem is the last line: int function ( int IDN , int [ ] IDN ) IDN ; with the current grammar i can't get: int function ( int , int [ ] ) IDN ; and this can be writen in the language. And i figured out that something neads to be added to Declarator but what? I'am not very good at grammars so i would appreciate any help! Thanks :) begin 666 dgram.gram M+3X ;6]D=6QE(#Q- M1$X-"CQ-;V1U;&5.86UE/B M/B \36]D=6QE3F%M93X +B!)1$X-" T*/$1E M8VQ$969S/B M/B \1&5C;$1E9CX /$1E8VQ$969S/ T*/$1E8VQ$969S/B M M968^("T^(#Q M<F9A8V5$96-L87)A=&EO;CX-"CQ$96-L1&5F/B M/B \06=G<F5G871E1&5C M/$1E8VQ$968^("T^(#Q496UP;&%T941E8VQA<F%T:6]N/ T*/$1E8VQ$968^ M("T^(#Q M<F%T:6]N/ T*/$1E8VQ$968^("T^(#Q M/B M/B \1&5S=')U8W1O<CX-"CQ$96-L1&5F/B M/B \26YV87)I86YT/ T* M/$1E8VQ$968^("T^(#Q5;FET=&5S=#X-"CQ$96-L1&5F/B M/B \4W1A=&EC M+3X ='EP961E9B \1&5C;#X-"CQ$96-L87)A=&EO;CX +3X 86QI87, /$1E M;W(^(#Q M<F%T;W));FET:6%L:7IE<CX-"CQ$96-L87)A=&]R<SX +3X /$1E8VQA<F%T M("T^(#Q$96-L87)A=&]R26YI=&EA;&EZ97(^("P /$1E8VQA<F%T;W))9&5N M=&EF:65R3&ES=#X-" T*/$1E8VQA<F%T;W));FET:6%L:7IE<CX +3X /$1E M<DQI<W0^("T^(#Q$96-L87)A=&]R261E;G1I9FEE<CX-"CQ$96-L87)A=&]R M261E;G1I9FEE<DQI<W0^("T^(#Q$96-L87)A=&]R261E;G1I9FEE<CX +" \ M:69I97(^("T^($E$3 T*/$1E8VQA<F%T;W))9&5N=&EF:65R/B M/B!)1$X M8U1Y<&4^("T^( ES:&]R= T*/$)A<VEC5'EP93X +3X "75S:&]R= T*/$)A M<VEC5'EP93X +3X "6EN= T*/$)A<VEC5'EP93X +3X "75I;G0-"CQ"87-I M<VEC5'EP93X +3X "6EF;&]A= T*/$)A<VEC5'EP93X +3X "6ED;W5B;&4- M"CQ"87-I8U1Y<&4^("T^( EI<F5A; T*/$)A<VEC5'EP93X +3X "6-F;&]A M= T*/$)A<VEC5'EP93X +3X "6-D;W5B;&4-"CQ"87-I8U1Y<&4^("T^( EC M<F5A; T*/$)A<VEC5'EP93X +3X "79O:60-"CQ"87-I8U1Y<&4^("T^( DN M(#Q)9&5N=&EF:65R3&ES=#X-"CQ"87-I8U1Y<&4^("T^( D\261E;G1I9FEE M("T^( D\5'EP96]F/B N(#Q)9&5N=&EF:65R3&ES=#X-" T*/$)A<VEC5'EP M93(^("T^("H-"CQ"87-I8U1Y<&4R/B M/B!;(%T-"CQ"87-I8U1Y<&4R/B M M/B!;(#Q M70T*/$)A<VEC5'EP93(^("T^(&1E;&5G871E(" /%!A<F%M971E<DQI<W0^ M("D-"CQ"87-I8U1Y<&4R/B M/B!F=6YC=&EO;B H(#Q087)A;65T97),:7-T M<CX-"CQ$96-L87)A=&]R/B M/B \0F%S:6-4>7!E,CX /$1E8VQA<F%T;W(^ M;&%R871O<CX *0T*/$1E8VQA<F%T;W(^("T^($E$3B \1&5C;&%R871O<E-U M9F9I>&5S/ T*/$1E8VQA<F%T;W(^("T^(" /$1E8VQA<F%T;W(^("D /$1E M8VQA<F%T;W)3=69F:7AE<SX-" T*/$1E8VQA<F%T;W)3=69F:7AE<SX +3X M1&5C;&%R871O<E-U9F9I>#X /$1E8VQA<F%T;W)3=69F:7AE<SX-" T*/$1E M8VQA<F%T;W)3=69F:7 ^("T^(%L 70T*/$1E8VQA<F%T;W)3=69F:7 ^("T^ M(%L /$5X<')E<W-I;VX^(%T-"CQ$96-L87)A=&]R4W5F9FEX/B M/B!;(#Q4 M=#X M(#Q496UP;&%T94EN<W1A;F-E/ T*/$ED96YT:69I97),:7-T/B M/B \5&5M M("T^('1Y<&5O9B H(#Q M96-L87)A=&]R,CX +3X /$)A<VEC5'EP93(^(#Q$96-L87)A=&]R,CX-"CQ$ M96-L87)A=&]R,CX +3X *" \1&5C;&%R871O<C(^("D-"CQ$96-L87)A=&]R M,CX +3X *" \1&5C;&%R871O<C(^("D /$1E8VQA<F%T;W)3=69F:7AE<SX- M3F%M94QI<W0^(#L-" T*/$UO9'5L94YA;65,:7-T/B M/B \36]D=6QE3F%M M93X-"CQ-;V1U;&5.86UE3&ES=#X +3X /$UO9'5L94YA;64^("P /$UO9'5L M86<^($E$3B![(#Q$96-L1&5F<SX ?0T*/$%G9W)E9V%T941E8VQA<F%T:6]N M(#H-"CQ!='1R:6)U=&53<&5C:69I97(^("T^(#Q!='1R:6)U=&4^(#Q$96-L M93X . T*/$%T=')I8G5T945L<V53<&5C:69I97(^("T^(#Q!='1R:6)U=&5% M;'-E/B \1&5C;$1E9D)L;V-K/ T*/$%T=')I8G5T945L<V53<&5C:69I97(^ M("T^(#Q!='1R:6)U=&5%;'-E/B \1&5C;$1E9D)L;V-K/B!E;'-E(#Q$96-L M/ T*/$%T=')I8G5T93X +3X /$%L:6=N071T<FEB=71E/ T*/$%T=')I8G5T M071T<FEB=71E/B M/B!P<F]T96-T960-"CQ!='1R:6)U=&4^("T^('!U8FQI M<FED90T*/$%T=')I8G5T93X +3X 86)S=')A8W0-"CQ!='1R:6)U=&4^("T^ M(&%U=&\-" T*/$%T=')I8G5T945L<V4^("T^(#Q$96)U9T%T=')I8G5T93X- M"CQ!='1R:6)U=&5%;'-E/B M/B \5F5R<VEO;D%T=')I8G5T93X-" T*/$1E M365M8F5R<SX-" T*/$5N=6U-96UB97(^("T^($E$3 T*/$5N=6U-96UB97(^ M("T^($E$3B ](#Q M5'EP93X +3X "40-"CQ,:6YK86=E5'EP93X +3X "5=I;F1O=W,-"CQ,:6YK M4')A9VUA/B M/B!P<F%G;6$ *"!)1$X *0T*/%!R86=M83X +3X <')A9VUA M=#X +3X /$5X<')E<W-I;VX^(#Q M<F5S<VEO;DQI<W1-;W)E/B L(#Q%>'!R97-S:6]N3&ES=#X M/B \8V]N9&ET:6]N86Q?97AP<F5S<VEO;CX-"CQA<W-I9VYM96YT7V5X<')E M<W-I;VX^("T^(#QA<W-I9VYM96YT7V5X<')E<W-I;VX^(#QA<W-I9VYM96YT M7V]P97)A=&]R/B \8V]N9&ET:6]N86Q?97AP<F5S<VEO;CX-" T*/&%S<VEG M;FUE;G1?;W!E<F%T;W(^("T^(#T-"CQA<W-I9VYM96YT7V]P97)A=&]R/B M M=%]O<&5R871O<CX +3X *CT-"CQA<W-I9VYM96YT7V]P97)A=&]R/B M/B O M<&5R871O<CX +3X )CT-"CQA<W-I9VYM96YT7V]P97)A=&]R/B M/B!\/0T* M/&%S<VEG;FUE;G1?;W!E<F%T;W(^("T^(%X]( T*/&%S<VEG;FUE;G1?;W!E M/&QO9VEC86Q?;W)?97AP<F5S<VEO;CX-"CQC;VYD:71I;VYA;%]E>'!R97-S M:6]N/B M/B \;&]G:6-A;%]O<E]E>'!R97-S:6]N/B _(#QE>'!R97-S:6]N M/B Z(#QC M>'!R97-S:6]N/B M/B \;&]G:6-A;%]A;F1?97AP<F5S<VEO;CX-"CQL;V=I M8V%L7V]R7V5X<')E<W-I;VX^("T^(#QL;V=I8V%L7V]R7V5X<')E<W-I;VX^ M('Q\(#QL M97AP<F5S<VEO;CX +3X /&QO9VEC86Q?86YD7V5X<')E<W-I;VX^("8F(#QO M97-S:6]N/ T*/&]R7V5X<')E<W-I;VX^("T^(#QO<E]E>'!R97-S:6]N/B!\ M(#QX;W)?97AP<F5S<VEO;CX-" T*/'AO<E]E>'!R97-S:6]N/B M/B \86YD M(#QA;F1?97AP<F5S<VEO;CX )B \97%U86QI='E?97AP<F5S<VEO;CX-" T* M/&5Q=6%L:71Y7V5X<')E<W-I;VX^("T^(#QR96QA=&EO;F%L7V5X<')E<W-I M<W-I;VX^(#QE<75A;&ET>5]O<&5R871O<CX /')E;&%T:6]N86Q?97AP<F5S M<VEO;CX-" T*/&5Q=6%L:71Y7V]P97)A=&]R/B M/B ]/0T*/&5Q=6%L:71Y M7V]P97)A=&]R/B M/B A/0T*/&5Q=6%L:71Y7V]P97)A=&]R/B M/B ]/3T- M<')E<W-I;VX^("T^(#QS:&EF=%]E>'!R97-S:6]N/ T*/')E;&%T:6]N86Q? M97AP<F5S<VEO;CX +3X /')E;&%T:6]N86Q?97AP<F5S<VEO;CX /')E;&%T M:6]N86Q?;W!E<F%T;W(^(#QS M;VYA;%]O<&5R871O<CX +3X / T*/')E;&%T:6]N86Q?;W!E<F%T;W(^("T^ M(#P M;W!E<F%T;W(^("T^(#X M/0T*/')E;&%T:6]N86Q?;W!E<F%T;W(^("T^("$\/ T*/')E;&%T:6]N86Q? M;W!E<F%T;W(^("T^(#P M97)A=&]R/B M/B A/CT-"CQR96QA=&EO;F%L7V]P97)A=&]R/B M/B A/ T* M/')E;&%T:6]N86Q?;W!E<F%T;W(^("T^("$\/0T*/')E;&%T:6]N86Q?;W!E M=F5?97AP<F5S<VEO;CX-"CQS:&EF=%]E>'!R97-S:6]N/B M/B \<VAI9G1? M97AP<F5S<VEO;CX /'-H:69T7V]P97)A=&]R/B \861D:71I=F5?97AP<F5S M<VEO;CX-" T*/'-H:69T7V]P97)A=&]R/B M/B \/ T*/'-H:69T7V]P97)A M=&]R/B M/B ^/ T*/'-H:69T7V]P97)A=&]R/B M/B ^/CX-" T*/&%D9&ET M:79E7V5X<')E<W-I;VX^("T^(#QM=6QT:7!L:6-A=&EV95]E>'!R97-S:6]N M/ T*/&%D9&ET:79E7V5X<')E<W-I;VX^("T^(#QA9&1I=&EV95]E>'!R97-S M:6]N/B \861D:71I=F5?;W!E<F%T;W(^(#QM=6QT:7!L:6-A=&EV95]E>'!R M"CQM=6QT:7!L:6-A=&EV95]E>'!R97-S:6]N/B M/B \=6YA<GE?97AP<F5S M<VEO;CX-"CQM=6QT:7!L:6-A=&EV95]E>'!R97-S:6]N/B M/B \;75L=&EP M;&EC871I=F5?97AP<F5S<VEO;CX /&UU;'1I<&QI8V%T:79E7V]P97)A=&]R M/B \=6YA<GE?97AP<F5S<VEO;CX-" T*/&UU;'1I<&QI8V%T:79E7V]P97)A M97-S:6]N/B M/B \<&]S=&9I>%]E>'!R97-S:6]N/ T*/'5N87)Y7V5X<')E M<VEO;CX +3X 9&5L971E(#QU;F%R>5]E>'!R97-S:6]N/ T*/'5N87)Y7V5X M<')E<W-I;VX^("T^(&YE=R /&YE=U]E>'!R97-S:6]N/ T*/'5N87)Y7V5X M<')E<W-I;VX^("T^(" /'1Y<&5N86UE/B I(#QU;F%R>5]E>'!R97-S:6]N M/ T*/'5N87)Y7V5X<')E<W-I;VX^("T^(" /'1Y<&5N86UE/B I("X 241. M:6]N/B N($E$3 T*/'!O<W1F:7A?97AP<F5S<VEO;CX +3X /'!O<W1F:7A? M97AP<F5S<VEO;CX *RL-"CQP;W-T9FEX7V5X<')E<W-I;VX^("T^(#QP;W-T M<&]S=&9I>%]E>'!R97-S:6]N/B H(#QO<'1?87)G=6UE;G1?;&ES=#X *0T* M/'!O<W1F:7A?97AP<F5S<VEO;CX +3X /'!O<W1F:7A?97AP<F5S<VEO;CX M($E$3 T*/'!R:6UA<GE?97AP<F5S<VEO;CX +3X =&AI<PT*/'!R:6UA<GE? M97AP<F5S<VEO;CX +3X <W5P97(-"CQP<FEM87)Y7V5X<')E<W-I;VX^("T^ M(#QN M;%]L:71E<F%L/ T*/'!R:6UA<GE?97AP<F5S<VEO;CX +3X /&YU;65R:6-? M;&ET97)A;#X-"CQP<FEM87)Y7V5X<')E<W-I;VX^("T^(#QS=')I;F=?;&ET M97)A;#X-"CQP<FEM87)Y7V5X<')E<W-I;VX^("T^(#QA<W-E<G1?97AP<F5S M<VEO;CX-"CQP<FEM87)Y7V5X<')E<W-I;VX^("T^(#QT>7!E;F%M93X +B!) M1$X-" T*/&%S<V5R=%]E>'!R97-S:6]N/B M/B!A<W-E<G0 *" \17AP<F5S ` end
May 21 2004