From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6784fd29e43ab726 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-01-20 06:40:21 PST Path: supernews.google.com!sn-xit-02!supernews.com!isdnet!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp2.deja.com!nnrp1.deja.com!not-for-mail From: Robert Dewar Newsgroups: comp.lang.ada Subject: Re: Ada 95 grammar for aflex? Date: Sat, 20 Jan 2001 14:30:50 GMT Organization: Deja.com Message-ID: <94c7eq$i89$1@nnrp1.deja.com> References: <3A6703BD.5D78D62@informatik.uni-stuttgart.de> <949qf7$l43$1@nnrp1.deja.com> <3A68877B.C7AF95D2@uol.com.br> NNTP-Posting-Host: 205.232.38.14 X-Article-Creation-Date: Sat Jan 20 14:30:50 2001 GMT X-Http-User-Agent: Mozilla/4.61 [en] (OS/2; U) X-Http-Proxy: 1.0 x70.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 X-MyDeja-Info: XMYDJUIDrobert_dewar Xref: supernews.google.com comp.lang.ada:4234 Date: 2001-01-20T14:30:50+00:00 List-Id: In article <3A68877B.C7AF95D2@uol.com.br>, Cesar Rabak wrote: > Robert Dewar wrote: > > > > In article , > > comp.lang.ada@ada.eu.org wrote: > > > > [...] I've taken a look at the lexical analyser of gnat > > [...] > > > > > > Where is it? I'd like to take a look at this also, as I am > > > looking for an alternative to lex/yacc, ASIS, OpenToken. > > > > The lexical analyzer for GNAT can be found in the GNAT sources, > > available from any GNAT mirror site. > > But, IIRC, it was hand made and not written in a language like > [f]lex/yacc. Did this change? No, but the question (see quote above) was a request specifically for information on the GNAT lexical analyzer. To use something like lex for a lexical analyzer in a production compiler is a real mistake, because the resulting lexical analyzer is much less efficient than a straightforward hand written analyzer, tends to produce much worse error messages, and saves a negligible amount of effort. Lex is fine for occasional use in generating command language user interfaces, but it not a tool for real compilers. As for yacc, this particular tool is dreadfully out of date, generates perfectly awful error messages (since it is not informed by decades of work on error recovery), and also if you are not careful tends to generate slow parsers. As for the issue of whether a modern up to date parser generator (see the work of Fisher and Charles, IBM and NYU, in this area, which was used for Ada/Ed) is the right choice, or a hand written parser, that's still an arguable discussion. GNAT is a hand written parser, and is intended as a demonstration of what can be achieved by hand writing parsers with respect to error recovery (e.g. its ability to distinguish between semicolon and IS in subprograms and correct wrong usage). Recently there have been discussions of the parser in g++. Amazingly, this parser takes significant time, indicating one of the results of less than careful use of automated parsers. Parsing should take no detectable time if a parser is well written. There is by the way an active funded project to replace the g++ parser with a hand written version. Sent via Deja.com http://www.deja.com/