Re: [Tack-devel] Questions about LLgen
Moved to https://github.com/davidgiven/ack
Brought to you by:
dtrg
From: David G. <dg...@co...> - 2022-02-05 10:33:37
|
That's beyond my knowledge --- I haven't done much with error recovery in parser generators. (Lemon's error recovery is the same as yacc's. I quote: "After extensive experimentation over several years, it has been discovered that the error recovery strategy used by yacc is about as good as it gets. And so that is what Lemon uses.") I'd be interested to hear how you get on with LLgen. On Sat, 5 Feb 2022 at 08:02, Wild Pi <wi...@pr...> wrote: > Thanks for your input. It's good to know it's been used for commercial > quality compilers. The main reason I want to use LLgen is its auto > generated error recovery mechanism. The approach/algorithm is very > interesting. If it works well as I hope for, it'll be a life saver. > > Correct me if I'm wrong. My understanding is, to this point, error > recovery is still a headache with LR parser. It's not clear how Lemon deals > with errors. It'll be painful if it's similar to Bison's approach. > > Bison is not very reliable either. I've broken it with some not so > complicated grammar. Either Bison crashed or the generated code doesn't > work. I don't remember the details. > > I'll test LLgen this weekend. I'll come back if I have questions. Thank > you, > > ------- Original Message ------- > On Friday, February 4th, 2022 at 10:58 AM, David Given <dg...@co...> > wrote: > > On Fri, 4 Feb 2022 at 19:30, Wild Pi <wi...@pr...> wrote: > >> Thank you for fixing the build error. Although make still fails with the >> error below, LLgen is built successfully. I'm going to play with it. >> > > I think the error you're getting is due to not having a full groff > installation. I'm not a groff expert, sadly, and I don't know which > distribution you're using, so can't advise there. However if you don't want > to build the documentation then editing the makefile not to try and build > and install it should be trivial. > > Going back to my second question. Have you built any OO language (C++/Java >> etc.) parser with LLgen? Basically, I'd like to know how practical it is to >> build a high quality parser for a full feature OO language. It'll be very >> helpful if someone could share their experience. >> > > So I've never used LLgen myself. There are a few references to it outside > the ACK, but the ACK itself is (AFAIK) the only major user. It's used for > C, Modula-2, Occam and Pascal, although note that the Occam compiler is for > a very primitive dialect and isn't really useful. The C compilers are > definitely production-quality as the ACK was sold commercially for a while. > > I know that it generates recursive descent compilers, so I can't use it > for my own compiler projects which need to be table-based. I would imagine > that if it can be used to describe C it could be used for an OO language > like Java without much difficulty. Note that LLgen will only cover the > gross syntax and not the type system, and you'll still need to have the > lexer talk to the symbol table to deal with context insensitivity. (Look in > lang/* for the ACK's front-end compilers. LLgen used .g files for its > grammars. LLgen's own grammar is also defined in LLgen.) > > I would imagine that the biggest problem you'll encounter is that LLgen is > extremely old, dating back to 1985! It does seem to generate ANSI C source, > but the lack of users means that if you encounter any problems you're > likely to be on your own, although I'll help if I can. It *appears* to be > a pretty competent extended LL(1) parser generator with useful features > such as parameterised rules and repeated tokens. There's a desk calculator > in appendix B of the manual: > http://tack.sourceforge.net/olddocs/LLgen.html The expression evaluator > is probably of interest. But of course, there's nothing LLgen will do that > you can't also do in other parser generators like bison or (my favourite) > lemon. > > > |