On 14/04/2008 17:28, Marc Haisenko wrote: > On Monday 14 April 2008, Lin wrote: >> On Apr 14, 11:18 pm, Charles E Campbell Jr <[EMAIL PROTECTED]> >> >> wrote: >>> The primary disadvantage is that effectively writing a new yacc/bison is >>> not a small task. I have a real thick book about writing a yacc-like >>> parser somewhere; if anyone's interested, I could look up its ISBN. >> The biggest advantage for writing a brand new LALR parser I think is >> that we can make it incremental. I know something about parsing LALR >> grammars. They would produce some intermediate table from the grammar >> definition (called status table?) to guide the parser, so that it >> operates like a finite automata with a stack equipped. If we have that >> table we can just store the stack and the parser's state to avoid >> looking back to previous codes. >> Then we also need a scanner recognizing different types of words. For >> this we can seek help from tools like Lex. >> >> Is C++ an LALR language? Not sure... >> >> Regards, >> Lin > > IMHO not a good idea. You will waste most of the time writing/debugging the > parser instead of the Vim part (plus all the time you need to solve problems > related to the parser and the grammar). Don't reinvent the wheel when there's > one that might suit your need sufficiently well. > > Writing a parser seems not that hard at first, but how many have you written > so far ? It really is not an easy task and that's why yacc/bison is still so > popular despite it having some limitations. > > Plus writing a grammar for C sounds as joyful as driving a glowing steel rod > through your private parts, considering all its ambiguities.
Ambiguities? The Standard is quite clear as to which bits are undefined or implementation defined ;-) There is even a nice Appendix that lists them all for you. The issue is all the sodding compiler extensions that people will want to have supported - gcc, VMS, VC, sundry embedded C compilers, etc. Mike -- Please hold. A representative will annoy you shortly. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---