使用C#创建简单的编程语言 [英] Creating a Simple Programming Language with C#
本文介绍了使用C#创建简单的编程语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何创建一个简单的编程语言。例如,我想创建一个名为Simple1的编程语言。您在文本框中输入的所有代码都将转换为c#。我的IDE是Visual Studio 2010 Proffesional ...
I want to know how to create a simple programming languge.For example, I want to create a programming language called "Simple1." All codes you enter in a textbox will be converted to c#.My IDE is Visual Studio 2010 Proffesional...
推荐答案
step1:创建一个从您的语言到的映射表C#(只包括关键词)。
step2:通过映射表将文本框中的文本转换为C#。
step3:使用 CodeDom (或发出)编译并运行C#代码。
step1:create a mapping table from your language to C#(Just include key words).
step2:convert the text in textbox to C# by the mapping table.
step3:use CodeDom (or Emit) to compile and run the C# code.
这不是我们可以回答的问题。
这是非常复杂的。例如,看看这个: VB6 C#VB代码转换器 [< a href =http://www.codeproject.com/Articles/262950/VB6-Csharp-VB-Code-Convertertarget =_ blanktitle =New Window> ^ ]它可能会开始给你一个线索你需要做什么。
如果你真的尝试做这个项目,不要去C# - 去IL和使您的语言可与任何其他.NET语言互操作。它可能会更容易,而且肯定会更有用。这里有一篇文章: http://msdn.microsoft.com/en-us/magazine/ cc136756.aspx [ ^ ]
That isn''t really a question we can answer.
It is seriously complex. For example, have a look at this: VB6 C# VB Code Converter[^] It may start to give you a clue what you would need to do.
And if you really do try to do this project, don''t go to C# - go to IL and make your language interoperable with any other .NET language. It would probably be easier, and it would certainly be more useful. There is an article on this here: http://msdn.microsoft.com/en-us/magazine/cc136756.aspx[^]
您好,
将源代码字符串转换为另一种编程语言的应用程序的名称是编译器。
从这些开始:
自动机理论
教授语言理论和自动机
编译器设计基础知识
我喜欢它:编译器设计
之后,我想你会找到路。
====
当然,OriginalGriff也推荐了有用的链接。
Hello,
The name of an application that transforms a source code string into another programming language is "compiler".
Start with these:
Automata theory
TEACHING LANGUAGE THEORY AND AUTOMATA
Basics of Compiler Design
I like it: Compiler Design
After those, I think you will be able to find the way.
====
Of course OriginalGriff has recommended useful links too.
这篇关于使用C#创建简单的编程语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文