将Bison/Flex/Yacc集成到XCode [英] Integrating Bison/Flex/Yacc into XCode

查看:198
本文介绍了将Bison/Flex/Yacc集成到XCode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有将Bison/Flex/Yacc集成到XCode中的简单方法?

Is there a simple way for integrating Bison/Flex/Yacc into XCode?

我想编写自己的语言进行解析,该语言与我的ObjC对象进行交互.

I want to write my own language to be parsed, which interacts with my ObjC objects.

但是这些工具仅将STDIN作为输入,并且仅生成C代码,而不是ObjC.基本上,它们只对命令行工具有用,否则每次我重新生成解析器代码时,它们都需要付出巨大的努力才能覆盖输出.

But the tools will only take STDIN as input, and will only produce C code, instead of ObjC. They're basically only seem useful for command-line tools, otherwise they need massive pain to override the output every time I regenerate the parser code.

推荐答案

简而言之,为语法文件提供.ym扩展名而不是.y.然后Xcode将以必要的魔法来运行Bison以支持Objective-C.

In a nutshell, give your grammar files a .ym extension instead of .y. Xcode will then run Bison with the necessary magic to support Objective-C.

奇怪的是,我发现了这个问题,因为我想做同样的事情.我记得在Apple的cocoa-dev邮件列表上有过有关该问题的讨论,但是在我的Google搜索中出现的问题更高.我找到了我记得的讨论,但在CocoaBuilder上 -最后有一个相当广泛的例子.我希望这对我们双方都有帮助,大声笑!

Oddly enough, I found this question because I wanted to do the same thing. I remembered a discussion about it on Apple's cocoa-dev mailing list, but this question came up higher in my Google search. I found the discussion I remembered though, on CocoaBuilder - there's a pretty extensive example at the end. I hope it helps both of us, LOL!

(编辑)让我大吃一惊,顺便说一句,有人设法找到了它-我仍然还没有找到有关它的任何官方文档.

(Edit) Beats the heck out of me how anyone ever managed to find this out, by the way - I still haven't found any official documentation about it.

这篇关于将Bison/Flex/Yacc集成到XCode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆