Re: Is there a wisent analog to Bison %empty non-empty rule?
Christian Johansson <[email protected]> Sun, 14 Jun 2020 23:32:41 +0200
| Newsgroups | gmane.emacs.semantic |
|---|---|
| Message-ID | <[email protected]> |
--===============4280360339644200272== Content-Type: multipart/alternative; boundary=Apple-Mail-60763F4A-1683-4896-8E1E-C1AD72340CD6 Content-Transfer-Encoding: 7bit --Apple-Mail-60763F4A-1683-4896-8E1E-C1AD72340CD6 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Eric! Alright, I don=E2=80=99t just want to create tags, I would like to build a c= omplete AST equivalent of the PHP AST. Can you improve the Wisent parser to f= ully support GNU Bison? Or is there a work-around I can use to make the gram= nar work? Ideally I would like to spot code parser errors in Elisp without having to r= un the code via a PHP runtime executable. Best regards Christian > 14 juni 2020 kl. 22:21 skrev Christian Johansson <[email protected]>: >=20 > Hi Eric! >=20 > Alright, I don=E2=80=99t just want to create tags, I would like to build a= complete AST equivalent of the PHP AST. Can you improve the Wisent q >=20 >> 13 juni 2020 kl. 21:36 skrev Eric Ludlam <[email protected]>: >>=20 >> Hi Christian, >>=20 >> Using %prec, etc doesn't occur much in Wisent grammars because the usual u= se case is to generate tags, and not evaluate code that requires precedence.= If your goal is to just generate tags, there is a good chance you can just= ignore the %prec pieces of the rule. If the precedence is not used in expr= essions used after an equal, then you may be able to just delete the whole r= ule backup_fn_flags. >>=20 >> A quick read of bison %empty indicates it can be safely left out as well,= so if you need to keep the rule, just delete %empty. >>=20 >> Hope this helps. >> Eric >>=20 >>> On 6/6/20 1:47 AM, Christian Johansson wrote: >>> Hi! >>> I'm translating the PHP bison grammar to wisent and currently I'm stuck a= t a rule that looks like this: >>> backup_fn_flags: >>> %prec PREC_ARROW_FUNCTION %empty { $$ =3D CG(extra_fn_flags); CG(extr= a_fn_flags) =3D 0; } >>> ; >>> The %prec symbol seems to work with Wisent but for the %empty I get the m= essage "wisent-parse-nonterminals: Symbol =E2=80=98%empty=E2=80=99 is used, b= ut is not defined as a token and has no rules" >>> Is it possible to solve this? >>> For empty %empty rules I just replace %empty with ;; empty\n but I don't= know what to do when there are other nonterminals in the rule >=20 >=20 >=20 > _______________________________________________ > cedet-semantic mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/cedet-semantic --Apple-Mail-60763F4A-1683-4896-8E1E-C1AD72340CD6 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=3D= utf-8"></head><body dir=3D"auto"><div dir=3D"ltr"></div><div dir=3D"ltr"><di= v dir=3D"ltr"><font color=3D"#000000"><span style=3D"caret-color: rgb(0, 0, 0= ); background-color: rgba(255, 255, 255, 0);">Hi Eric!<br><br>Alright, I don= =E2=80=99t just want to create tags, I would like to build a complete AST eq= uivalent of the PHP AST. Can you improve the Wisent parser to fully support G= NU Bison? Or is there a work-around I can use to make the gramnar work?</spa= n></font></div><div dir=3D"ltr"><font color=3D"#000000"><span style=3D"caret= -color: rgb(0, 0, 0); background-color: rgba(255, 255, 255, 0);"><br></span>= </font></div><div dir=3D"ltr"><font color=3D"#000000"><span style=3D"caret-c= olor: rgb(0, 0, 0); background-color: rgba(255, 255, 255, 0);">Ideally I wou= ld like to spot code parser errors in Elisp without having to run the code v= ia a PHP runtime executable.</span></font></div><div dir=3D"ltr"><font color= =3D"#000000"><span style=3D"caret-color: rgb(0, 0, 0); background-color: rgb= a(255, 255, 255, 0);"><br></span></font></div><div dir=3D"ltr">Best regards<= /div><div dir=3D"ltr">Christian</div></div><div dir=3D"ltr"><br>14 juni 2020= kl. 22:21 skrev Christian Johansson <<a href=3D"mailto:[email protected]"= >[email protected]</a>>:<br><br></div><blockquote type=3D"cite"><div dir=3D= "ltr"><span>Hi Eric!</span><br><span></span><br><span>Alright, I don=E2=80=99= t just want to create tags, I would like to build a complete AST equivalent o= f the PHP AST. Can you improve the Wisent q</span><br><span></span><br><bloc= kquote type=3D"cite"><span>13 juni 2020 kl. 21:36 skrev Eric Ludlam <<a h= ref=3D"mailto:[email protected]">[email protected]</a>>:</span><b= r></blockquote><blockquote type=3D"cite"><span></span><br></blockquote><bloc= kquote type=3D"cite"><span>Hi Christian,</span><br></blockquote><blockquote t= ype=3D"cite"><span></span><br></blockquote><blockquote type=3D"cite"><span>U= sing %prec, etc doesn't occur much in Wisent grammars because the usual use c= ase is to generate tags, and not evaluate code that requires precedence. &nb= sp;If your goal is to just generate tags, there is a good chance you can jus= t ignore the %prec pieces of the rule. If the precedence is not used i= n expressions used after an equal, then you may be able to just delete the w= hole rule backup_fn_flags.</span><br></blockquote><blockquote type=3D"cite">= <span></span><br></blockquote><blockquote type=3D"cite"><span>A quick read o= f bison %empty indicates it can be safely left out as well, so if you need t= o keep the rule, just delete %empty.</span><br></blockquote><blockquote type= =3D"cite"><span></span><br></blockquote><blockquote type=3D"cite"><span>Hope= this helps.</span><br></blockquote><blockquote type=3D"cite"><span>Eric</sp= an><br></blockquote><blockquote type=3D"cite"><span></span><br></blockquote>= <blockquote type=3D"cite"><blockquote type=3D"cite"><span>On 6/6/20 1:47 AM,= Christian Johansson wrote:</span><br></blockquote></blockquote><blockquote t= ype=3D"cite"><blockquote type=3D"cite"><span>Hi!</span><br></blockquote></bl= ockquote><blockquote type=3D"cite"><blockquote type=3D"cite"><span>I'm trans= lating the PHP bison grammar to wisent and currently I'm stuck at a rule tha= t looks like this:</span><br></blockquote></blockquote><blockquote type=3D"c= ite"><blockquote type=3D"cite"><span>backup_fn_flags:</span><br></blockquote= ></blockquote><blockquote type=3D"cite"><blockquote type=3D"cite"><span> &nb= sp; %prec PREC_ARROW_FUNCTION %empty { $$ =3D CG(extra_fn_flags);= CG(extra_fn_flags) =3D 0; }</span><br></blockquote></blockquote><blockquote= type=3D"cite"><blockquote type=3D"cite"><span>;</span><br></blockquote></bl= ockquote><blockquote type=3D"cite"><blockquote type=3D"cite"><span>The %prec= symbol seems to work with Wisent but for the %empty I get the message "wise= nt-parse-nonterminals: Symbol =E2=80=98%empty=E2=80=99 is used, but is not d= efined as a token and has no rules"</span><br></blockquote></blockquote><blo= ckquote type=3D"cite"><blockquote type=3D"cite"><span>Is it possible to solv= e this?</span><br></blockquote></blockquote><blockquote type=3D"cite"><block= quote type=3D"cite"><span>For empty %empty rules I just replace %empty with ;= ; empty\n but I don't know what to do when there are other nonterminals in t= he rule</span><br></blockquote></blockquote><span></span><br><span></span><b= r><span></span><br><span>_______________________________________________</sp= an><br><span>cedet-semantic mailing list</span><br><span><a href=3D"mailto:c= [email protected]">[email protected]</a= ></span><br><span><a href=3D"https://lists.sourceforge.net/lists/listinfo/ce= det-semantic">https://lists.sourceforge.net/lists/listinfo/cedet-semantic</a= ></span><br></div></blockquote></body></html>= --Apple-Mail-60763F4A-1683-4896-8E1E-C1AD72340CD6-- --===============4280360339644200272== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============4280360339644200272== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ cedet-semantic mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cedet-semantic --===============4280360339644200272==--