Cosmin Prund wrote: > (1) Is there a Delphi clone of the UNIX tools lex and yacc that > generates "modern" output? By "modern" I mean something that can handle > two parsers running simultaneously and allows reading from something > other than TEXT files. All lex/yacc clones I've seen depend on a > "lexlib" library that's full of global variables and expects > input/output to be done on TEXT files. I almost never need to parse text > files, I'm always parsing text from in-memory "strings" or TStringList > or TStream descendents. Also I expect my lexers/parsers to work in > multi-threaded environments so global variables are automatically > excluded!
GNU Flex has a C++ mode, where the lexer it generates is a class rather than a set of global variables and functions. It also lets you provide your own yyinput function, where you fill Flex's buffer from whatever source you want, including a stream. (In C, you can also simply provide your own FILE* value, which is usually a file, but can also be any other C file handle.) > (2) Are there any other tools similar to lex/yacc, commercial or open > source that can generate Delphi code? I've been following a few other > parser projects but they don't generate Delphi code. Mike Lischke's Delphi Compiler Generator is based on TP Lex. Have you looked at it yet? You might try asking on the comp.compilers newsgroup. -- Rob _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

