问题
Does iOS for iPad and iPhone have support for a parser? In particular, is lex/yacc or flex/bison available for iOS development? Does xcode4 have a natively supported library? (I could generate my grammar via lex/yacc and then take the *.c files and put them in my project, but I was hoping for more tightly supported libraries.)
Any ideas?
回答1:
lex, yacc, flex, and bison all come with the Mac/iOS developer tools. Xcode has built-in rules for processing .l files with flex and .y files with bison, and it automatically compiles the generated .c files with your project. If you use .lm or .ym file extensions, it will generate .m files, allowing you to use actions written in Objective-C.
A sample use case is available at
https://github.com/dgkris/ObjectiveC-STL-Parser/tree/master/STLParser
来源:https://stackoverflow.com/questions/5427544/what-are-the-standard-grammar-parsers-for-ios