关于编译器设计 [英] About compiler design

查看:66
本文介绍了关于编译器设计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个包含一些规则的代码.使用这些规则,它将遵循某些过程,例如加法或减法.完成所有这些过程后,它将说出它遵循了哪些规则序列....如何我可以做到吗?
(一个问号就足够了)

I want to do a code that will take some rules .Using these rules it will follow some process such as Addition or subtraction .After completing all of these process it will say that what sequences of rules it followed....How I can do this?
(one question mark is enough)

推荐答案

在Visual Studio中创建一个新的解决方案,然后开始编码.
Create a new solution in Visual Studio, and start coding.


您要发布的一个大问题.通常,您想要的是一种能够在执行后被跟踪的代码中转换有限状态机的引擎.您最好寻找一些提供这种环境的库.
It is a big question you''re posting. In general what you want is an engine that is capable of translating a finite state machine in code that is executed and then traced. You''re better off looking for some library that provides such environment.


有很多工具可以在此方面为您提供很大帮助.
看看经典的 flex [ ^ ]和野牛 [ boost的精神 [ ^ ].
如果您不习惯C/C++,请查看(基于java的) ANTLR [ Lua [ LPeg库 [^ ].
:)
There are a lot of tools that can greatly help you on that.
Have a look at classic flex[^] and bison[^] or to ''modern'' boost''s spirit[^].
If you''re not stuck with C/C++, then a look at (java-based) ANTLR[^] is worthy.
Finally, if you want to have even some fun, check out Lua[^] and its powerful LPeg library[^].
:)


这篇关于关于编译器设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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