创建自己的编程语言 [英] Create Your Own Programming Language

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

问题描述

嗨Adrabi,



我想用简单的英语写一种编程语言。没有缩写。没有俚语。

没有标点符号。



理想情况下,找到C ++命令的索引并用英文重写它们。



编码就像解释一样。



谢谢

菲利普

Hi Adrabi,

I want to write a programming language in plain english. No abbreviations. No slang.
No punctuation.

Ideally find an index of C++ commands and rewrite them in english.

Coding would be like explaining.

Thanks
Philip

推荐答案

不要在Quick Answers下发布 - 如果您正在查看文章,那么该文章底部会显示一条新消息按钮,这会将电子邮件发送给作者。然后他们会被告知你想和他们说话。

这里发布这个依赖于他们匆匆而过并意识到这是为了他们。
Don''t post this under Quick Answers - if you were looking at an article, then there is a "new message" button at the bottom of that article, which causes an email to be sent to the author. They are then alerted that you wish to speak to them.
Posting this here relies on them "dropping by" and realising it is for them.


不幸的是这个由于两件事的组合,在实践中不会起作用。



目前还没有能够准确解析整体的算法或软件英语。甚至没有任何数学理论表明它可以通过图灵机(即非量子计算机)完全准确地解析



如果采取新的方法用英语中的等价物替换每种形式的C ++语句然后你会遇到另一个更微妙的问题。

您现在已经指定了一种用英语表达每种语句的正确方法,但是您的语言用户应该如何知道英语可以编码该语句的许多方法中的哪一种就是您已经选择。

许多更多的表格都是有效的英语,而不是新语言的有效表格。这可能会导致很多用户混淆并使您的新语言难以学习,特别是在一天结束时它仍然有效地成为C ++的语法和概念结构。



对于这些事情有一个经验法则,即如果两件事情不同,那么它们应该看起来不同。如果新语言看起来像英语,用户将认为它是英语,因为它不会是不快乐的。



然而,有关文学编程的想法可能会吸引您使用C ++等语言的高级功能,使其更像英语它是如此相似以至于混淆。
Unfortunately this will not work in practise because of a combination of 2 things.

There is as yet no algorithm or software which can accurately parse the whole English language. There is not even any mathematical theory which suggests that it can be completely and accurately parsed by a turing machine ( i.e. non quantum computer )

If you take the novel approach of replacing each form of C++ statement with something equivalent in English then you hit another more subtle issue.
You''ve now specified one correct way expressing each statement in English but how is the user of your language supposed to know which of the many dozens of ways that English could encode that statement is the one you have chosen.
Many many more forms would be valid English than would be valid in your new language. This would likely cause a lot of user confusion and make your new language very hard to learn, especially as at the end of the day it would still effectively be C++ in terms of it''s gramatical and conceptual structure.

There is a rule of thumb for these things that says that if 2 things are differect then they should appear different. If the new language looks like English the user will assume it is English and as it can''t be they will be unhappy.

There are however ideas around literate programming which may appeal to you which use advanced features of languages like C++ to make it more like English without it being so similar as to confuse.


这已经在20世纪50年代完成,目的是使管理人员和主管能够理解低级程序员所编写的代码。该语言中有一些功能(除语法外)对于该语言有些独特:十进制数,处理货币的能力。对十进制数的支持很大程度上是为什么它仍然存在于今天。现在这是一种厌恶的语言,因为任何正在进行认真编程的人都使用一种更有利于计算机结构的语言:循环,计数器,变量,分支,方法,而没有大量英语单词的等等开销。



哦,是的,这种语言被称为COBOL。你可以在这里阅读这里 [ ^ ]。
This was already done in the 1950''s, as a goal of enabling managers and supervisors to understand the code that the lowly programmers were writing. The language had some features in it that (besides the syntax) were somewhat unique to that language: decimal numbers, ability to handle currency. Support for decimal numbers is largely why it is still around today. It is a much loathed language nowadays, as anybody doing serious programming uses a language that is more conducive to computer constructs: loops, counters, variables, branches, methods without the "blah blah" overhead of a lot of english words.

Oh yeah, this language was called COBOL. You can read about it here[^].


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

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