Going by OP's description, Flex and Bison appear to be well suited for what he/she intends to do. There is a bit of a learning curve, but I think it's well worth it. I have been working with both for a few years now and find them very flexible.…
……对 Walter Bright 这种大佬来说,这文章写得也太水了。就提了点基础建议,一点干货都没有?既没有书单链接,也没有 parser 和实现的参考?最容易上手的入门资料是 Anthony A. Aaby 写的《Compiler Construction using Flex and Bison》,网上有免费的 pdf;要是想把 LLVM 也整合进来,可以看这个链接:http://gnuu.org/2009/09/18/writing-your-own-toy-compiler/ 还有太多东西值得展开了,比如指向……的链接
…article for someone like Walter Bright. Just some basic recommendations, but nothing practical? No links to books, parsers, implementations? The easiest start would be "Compiler Construction using Flex and Bison" by Anthony A. Aaby, available as free pdf, and for adding LLVM to the mix the link would be: http://gnuu.org/2009/09/18/writing-your-own-toy-compiler/ There needs much more to be said, e.g. links to…
…I admit that there are often better options out there these days, I'm just saying that some of these complaints about Flex / Bison may be a bit outdated. Multiple grammars are fine, you just instruct Flex and Bison to use static or add prefixes. No worries about ODR or LTO. If your build system can't handle generated code, that's an indictment of your build system. I know that's a bit harsh, but there are plenty…
I've been thinking about writing my own programming language for some time. This to gain a deeper understanding of how programming languages, and by extent, computers work. I've bought the Flex and Bison book by John Levine to have a resource on parsing and lexing. I have come to realize however, that writing a complete language like Java, Python, Ruby, from bottom to the top, is of course not a small…
"Jargon", perhaps. "Never been in use by authors"? Not so. The current "international economy edition" of Aho, et al uses "lexing" 29 times, according to the search function on Amazon. Flex & Bison by John Levine (O'Reilly and Associates) uses "lexing" 38 times. And so on.
…the professor to give us the option of using a parser generator for the next phase (DML) since the point of the class wasn't parsing context free grammars and more focused on executing the SQL. I used Flex and Bison since the project was in C. Getting up and running and understanding how the tools have to be set up with different options was a bit tricky, but after that, my parser was up and running in about two…
从楼主的描述来看,Flex 和 Bison 似乎非常适合他/她想做的事情。虽然有一定的学习曲线,但我认为完全值得。我自己用这两个工具好几年了,感觉它们非常灵活。……
Going by OP's description, Flex and Bison appear to be well suited for what he/she intends to do. There is a bit of a learning curve, but I think it's well worth it. I have been working with both for a few years now and find them very flexible.…
……对 Walter Bright 这种大佬来说,这文章写得也太水了。就提了点基础建议,一点干货都没有?既没有书单链接,也没有 parser 和实现的参考?最容易上手的入门资料是 Anthony A. Aaby 写的《Compiler Construction using Flex and Bison》,网上有免费的 pdf;要是想把 LLVM 也整合进来,可以看这个链接:http://gnuu.org/2009/09/18/writing-your-own-toy-compiler/ 还有太多东西值得展开了,比如指向……的链接
…article for someone like Walter Bright. Just some basic recommendations, but nothing practical? No links to books, parsers, implementations? The easiest start would be "Compiler Construction using Flex and Bison" by Anthony A. Aaby, available as free pdf, and for adding LLVM to the mix the link would be: http://gnuu.org/2009/09/18/writing-your-own-toy-compiler/ There needs much more to be said, e.g. links to…
……我承认现在确实往往有更好的替代方案,但我想说的是,对 Flex / Bison 的某些抱怨可能有点过时了。处理多个文法完全没问题,直接让 Flex 和 Bison 生成 static 代码或者加上前缀就行。根本不用担心 ODR 或 LTO 的问题。如果你的构建系统连自动生成的代码都搞不定,那是你构建系统不行。我知道这话有点冲,但确实有很多……
…I admit that there are often better options out there these days, I'm just saying that some of these complaints about Flex / Bison may be a bit outdated. Multiple grammars are fine, you just instruct Flex and Bison to use static or add prefixes. No worries about ODR or LTO. If your build system can't handle generated code, that's an indictment of your build system. I know that's a bit harsh, but there are plenty…
我琢磨着自己写门编程语言已经有一阵子了。主要是为了更深入地理解编程语言,以及从更广的维度上理解计算机到底是怎么工作的。我买了 John Levine 写的 Flex 和 Bison 那本书,用来学习 parsing 和 lexing。不过我也逐渐意识到,从零开始搞出一门像 Java、Python、Ruby 这样完整的语言,绝对不是一件小事……
I've been thinking about writing my own programming language for some time. This to gain a deeper understanding of how programming languages, and by extent, computers work. I've bought the Flex and Bison book by John Levine to have a resource on parsing and lexing. I have come to realize however, that writing a complete language like Java, Python, Ruby, from bottom to the top, is of course not a small…
算“行话”也许还说得过去,但“作者们从没用过”?绝非如此。根据亚马逊的搜索功能,阿霍(Aho)等人的经典龙书最新“国际经济版”里,“lexing”这个词出现了29次。John Levine 写的《Flex & Bison》(O'Reilly 出版)里,“lexing”出现了38次。诸如此类,不胜枚举。
"Jargon", perhaps. "Never been in use by authors"? Not so. The current "international economy edition" of Aho, et al uses "lexing" 29 times, according to the search function on Amazon. Flex & Bison by John Levine (O'Reilly and Associates) uses "lexing" 38 times. And so on.
……教授同意我们在下一阶段(DML)使用 parser 生成器,毕竟这门课的重点不是解析上下文无关文法(CFG),而是更侧重于执行 SQL。因为项目是用 C 写的,所以我用了 Flex 和 Bison。刚上手搞明白怎么用不同的 option 配置这些工具确实有点头疼,但配好之后,我的 parser 大概用了两……就跑起来了。
…the professor to give us the option of using a parser generator for the next phase (DML) since the point of the class wasn't parsing context free grammars and more focused on executing the SQL. I used Flex and Bison since the project was in C. Getting up and running and understanding how the tools have to be set up with different options was a bit tricky, but after that, my parser was up and running in about two…