我如何创建自己的languaje [英] how can i create my own languaje

查看:136
本文介绍了我如何创建自己的languaje的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1.创建我自己的变量
2.创建自己的保留字
3.具有结构性(开始/完成)(需要一个循环* for,wile *和一个条件

1. create my own variable
2. create my own reserve words
3. have the estructure (start/finish) (need to have a cycle *for, wile* and a conditional

推荐答案

除了Christian的回复,您确实需要阅读和理解《龙书》之类的东西

编译器:原理,技术和工具"

能够做到这一点...

http://en.wikipedia.org/wiki/Compilers:_Principles,_Techniques,_and_Tools [ ^ ]
In addition to Christian''s reply, you really need to read and understand something like ''The Dragon Book''

"Compilers: Principles, Techniques, and Tools"

to be able to do this ...

http://en.wikipedia.org/wiki/Compilers:_Principles,_Techniques,_and_Tools[^]


如前所述,您需要创建一个编译器.
一般来说,创建编译器是一项相当困难的任务.但是,这实际上取决于您的语言要求(一种简单且常规"的语言会使您的工作更加轻松).无论如何,您需要一些有关编译器构造技术的背景.我可能会建议:
As already suggested you need to create a compiler.
Generally speaking creating a compiler is a rather difficult task. However it really depends on the requirements of your language (a simple and ''regular'' language would make your task easier). Anyway you need some background on compiler construction techniques. I might suggest:

  • The dragon book - (already suggested) provides a strong theoretical approach.
  • lcc, A Retargetable Compiler for ANSI C[^] - shows a complete implementation of a C compiler (might be the ''natural'' practical complement of the dragon book).
  • Wirth''s Compiler Construction [^] - freely available, it shows neatly the complete implementation of a simple language.
  • Crenshaw''s Let''s build a compiler[^] - freely available, has a very simple, pragmatical approach.


为此,您需要编写自己的编译器.我不确定1是什么意思-创建自己的变量类型?您可以使用宏为现有事物创建新名称,但是对于全新事物,则需要编写编译器来理解新对象. C ++的第一个版本只是将C ++转换为C,然后在其上运行了C编译器,因此也许您可以执行类似的操作.
To do that you need to write your own compiler. I am not sure what 1 means - create your own variable type ? You can use macros to create new names for existing things, but something brand new, you need to write a compiler to understand your new objects. The first version of C++ just turned C++ in to C and then ran a C compiler on it, so perhaps you can do something similar.


这篇关于我如何创建自己的languaje的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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