Groups | Search | Server Info | Login | Register
Groups > comp.compilers > #104
| From | Chris F Clark <cfc@shell01.TheWorld.com> |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Re: YACCaty YACC - Parsing YACC with YACC |
| Date | 2011-04-25 19:15 -0400 |
| Organization | The World Public Access UNIX, Brookline, MA |
| Message-ID | <11-04-037@comp.compilers> (permalink) |
| References | <11-04-034@comp.compilers> |
There is a grammar for Yacc++ (which includes its lexer, which is in a yacc-like rather than lex-like notation) included with Yacc++. It is the same grammar we use to build the tool itself, stripped of the semantic actions. Being able to compile Yacc++ with itself was an explicit requirement we had from the beginning. ----------------------------------------------------------------------- Personal diatribe warning: Without a hack, one cannot write a plain yacc grammar in yacc, because the semicolon at the end of a rule is optional, one needs to look for identifier : to find the start of a new rule (end of the current one). this means that the grammar for yacc is LALR(2) and not LALR(1). Thus, there are yacc grammars in yacc, but they require this lexical trick to work. The notation for lex is also hard to parse, but mostly because of issues at the lexical level. This is because of the prevalent tendency of the Unix/C community of the time to like 1-character tokens with \ escapes. Most of the shell and make tools are similarly hard to deal with neatly lexically. The general regular expression syntax in Emacs or Perl is also likewise obfuscated, with slight variations that can make them subtly incompatible. However, it is worth noting that the issues with dealing with the lexical issues is balanced by the terseness of the notation and the fact that one can often read them with a C program that looks only at 1 character at a time. It is just a personal foible that I prefer a language that is highly consistent to one which is terse. The other tends to lead to ad hack processing fraught with special cases that are never fully generalized. ----------------------------------------------------------------------- Final note, if you want a copy of Yacc++ for personal [non-commercial] use, send me an email explaining what you want to do with it. I "give away" to individuals a free version with the limitation that any software built with it must be GPLed. Hope this helps, -Chris ****************************************************************************** Chris Clark email: christopher.f.clark@compiler-resources.com Compiler Resources, Inc. Web Site: http://world.std.com/~compres 23 Bailey Rd voice: (508) 435-5016 Berlin, MA 01503 USA twitter: @intel_chris
Back to comp.compilers | Previous | Next — Previous in thread | Find similar
YACCaty YACC - Parsing YACC with YACC ben senior <okobloko@googlemail.com> - 2011-04-18 08:21 +0200 Re: YACCaty YACC - Parsing YACC with YACC Chris F Clark <cfc@shell01.TheWorld.com> - 2011-04-25 19:15 -0400
csiph-web