问题
I'm looking for a good development environment in which to work on flex or bison or both.
Are there any IDE's that have these capabilities and/or are suitable for this?
(If not the next most general question is are there lexer/parser generators with IDE's?)
Thanks ~Alex
回答1:
ANTLR has several IDEs available, including one I wrote. By user count, ANTLRWorks is probably the most used. Mine has fewer overall features, but I use it extensively because it integrates so cleanly with my Visual Studio work. ANTLR's grammar syntax is clean and very powerful, generates code for many languages, and its generated lexers/parsers are clean, debuggable code.
Edit to address concerns in the comments:
- Commercial documentation for ANTLR exists and is recommended by many, but is certainly not required. The nFringe IDE product (commercial/closed source) I worked on uses ANTLR extensively and was developed completely without the aid of the ANTLR reference book.
- ANTLRWorks 1.x development is slow, but not stopped. There are currently no open issues, and two significant issues have been fixed since the latest 1.5 release.
- ANTLRWorks 2 is a completely different product and was written from scratch. A separate issue tracker is available for this product.
回答2:
Vim has excellent syntax highlighting support for flex / lex and bison / yacc files. Vim seems to guess from file extensions, so as long as my flex files end in .l or .lex and my bison files end in .y, it seems to work fine. I know, it's barely an IDE, but I find the syntax highlighting to be the most helpful feature for me.
回答3:
If you are comfortable in emacs, I would suggest these modes:
http://ftp.lip6.fr/pub/emacs/elisp-archive/incoming/bison-mode.el.gz
http://ftp.lip6.fr/pub/emacs/elisp-archive/incoming/flex-mode.el
Keep in mind that both are very buggy, but after a while I figured out most of the quirks to get the indentation working.
An example .emacs that loads these modes: http://www.elliotglaysher.org/emacs/
回答4:
Personally I use Gedit it has a native lex/flex yacc/bison highlighting
回答5:
Just found GOLD Parsing System. It's not Flex/Bison, but if something similar is acceptable this seems to be a great IDE, and there's great getting-started documentation on the web site.
回答6:
Visual studio has good support for flex/bison, https://sourceforge.net/p/winflexbison/wiki/Visual%20Studio%20custom%20build%20rules/
To summarize, you'll need install win_flex_bison, the GNUWin port of flex and bison, and set visual studio's custom build rule using 'targets' file present along with the port, set exe path in VC++ directories settings; then it be built and debugged as usual cpp files.
来源:https://stackoverflow.com/questions/1150301/flex-bison-ide