简体   繁体   English

在Mac上安装flex(词法分析器)

[英]Installing flex (lexical analyzer) on Mac

Can someone tell me how I can install flex (lexical analyzer) on my Mac? 有人能告诉我如何在我的Mac上安装flex(词法分析器)吗? I searched everywhere on google and I can't find it. 我在谷歌的各个地方搜索,我找不到它。 I have the universal binary and I extracted it to my desktop but I have no idea where to go from here. 我有通用二进制文件,我将它解压缩到我的桌面,但我不知道从哪里开始。 Any help would be greatly appreciated! 任何帮助将不胜感激!

尝试使用Homebrew(适用于Mac的数据包管理器)并使用以下命令: -

brew install flex

您可以使用macports来安装flex

You can always install from source. 您始终可以从源安装。 Download the tarball from the flex site , extract it, cd to the directory where you extracted it, and run the following: flex站点下载tarball,解压缩,cd到你解压缩的目录,然后运行以下命令:

./configure
make
make install
make clean

Assuming you have make and a C compiler on your Mac, which I believe all Macs have. 假设你的Mac上有make和C编译器,我相信所有的Mac都有。

Flex is shipped with the xCode Command line tools; Flex随xCode命令行工具一起提供; you only got to install them via xcode > preferences > downloads > Command line tools. 你只需要通过xcode> preferences> downloads>命令行工具安装它们。 This also includes gcc (Clang). 这还包括gcc(Clang)。

This info can help to somebody to save time: 此信息可以帮助有人节省时间:

Just today I have try to install FLEX 2.5.39 from sources. 就在今天,我尝试从源代码安装FLEX 2.5.39。 Make - fails. 制造 - 失败。

After some thoughts I have decide to try older archives. 经过一番思考后,我决定尝试更旧的档案。 2.5.38 - fail 2.5.37 - OK 2.5.38 - 失败2.5.37 - 好的

It seems on now() = 2015-03-15, macport also uses 2.5.37 build. 现在似乎()= 2015-03-15,macport也使用2.5.37版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM