创建移动编程语言
我正在考虑创建一种非常容易在手机上输入的小语言(J2ME), 为了在手机中运行它(始终是j2me),要实现什么更合适的语言? 含义恰当,语法小/简单,易于在手机中输入。
是口齿不清吗? 某种 Basic/Python/Ruby(我认为不是......)? 或者另一个新的(你能提出一个新的语法吗?)?
I'm thinking about creating a small language that is very easy to type on a mobile phone (J2ME),
What is the more appropriate language to implement in order to run it inside a mobile phone (j2me always)? Appropriate meaning, small/easy syntax, easy to type in a mobile phone.
Is it lisp? Some sort of Basic/Python/Ruby (I think not...)? Or another new (can you propose a new syntax?)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(12)
我就是这样一种语言的作者:Hecl,位于 http://www.hecl.org 。 为了使应用程序变得更容易,我还创建了一个网站,您可以在其中通过 Web 界面构建简单的应用程序: http:// www.heclbuilder.com 。 我还写了一篇讨论该语言的实现的文章:
http://www.welton.it/articles/ hecl_implementation
其他值得关注的语言包括 Lua 和 Javascript,它们都有移动实现。
I am the author of just such a language: Hecl, at http://www.hecl.org . In order to make quite applications easier, I also created a site where you can build simple apps through a web interface: http://www.heclbuilder.com . I also wrote an article discussing the implementation of the language:
http://www.welton.it/articles/hecl_implementation
Other languages that are worth looking at include Lua, and Javascript, both of which have mobile implementations.
如果包含编辑器支持(嵌套结构、缩进显示、平衡等),那么某种形式的 LISP 将相对容易实现和使用。 我见过用于实时交互式表演编程的基于 LISP 的语言的屏幕截图(但现在找不到)。 它使用屏幕上缩进的阴影矩形区域(而不是括号)来显示结构的嵌套。
If you include editor support (nesting structures, indented display, balancing, ...) then some form of LISP would be relatively straightforward to implement and use. I've seen screenshots (but can't find them now) of a LISP-based language for live interactive-performance programming. It used indented, shaded rectangular areas on the screen (instead of parentheses) to show nesting of structure.
我认为编辑器的设计是最大的考虑因素,而不是语言。 例如,支持某种类似“智能感知”的自动完成对于节省拇指操作至关重要。 编辑器中某种语言敏感性也会有很大帮助。 例如,当 C 用户键入“for”时,自动完成功能应显示一个用于填写循环语法的选项:
I would think the design of the editor would be the biggest consideration, not the language. For instance, supporting some kind of "intellisense"-like autocompletion would be vital for saving thumbstrokes. Some kind of language sensitivity in the editor would help a lot too. For instance, when a C user types "for" the autocomplete should show an option for filling out the syntax of a loop:
您可能想查看 Hecl:http://www.hecl.org/
You might want to look into Hecl: http://www.hecl.org/
我不确定在手机上容易输入什么,但我所知道的每个字符计算能力最强的语言是 APL。 作为语法或设计思想的来源,您可能更喜欢它的现代后继者,J 编程语言。
I'm not sure what's easy to type on a mobile phone, but the language I know with the most computing power per character is APL. As a source of syntactic or design ideas, you might prefer its modern successor, the J programming language.
在手机上,您还应该考虑像 Scratch (smalltalk) 这样的语言,因为非打字界面会易于使用。
同样在具有拖放功能的智能手机上,这将是一件好事。
另一方面,IDE 对 CPU 和硬件的负担会更大。 其他资源。
On a mobile phone, you should also consider languages like Scratch (smalltalk), because the non-typing interface would be easy to use.
Also on the smartphones with drag&drop capability, it would be something good.
On the other hand, the IDE would be a lot heavier on CPU & other resources.
Forth 通常被认为是满足此类要求的合法竞争者。 它就像你可以想象的那样简洁。 可扩展、小型且可塑。 还内置小屏幕编辑器。
Forth is usually considered a legitimate contender for these kinds of requirements. And it's about as terse as can be imagined. Extensible, small and malleable. Built-in small screen editor, too.
如果你想要超级紧凑,请尝试 nano-False http://www.aldweb.com/ pages/winikoff/#false
它不是很有用,尽管比故意让人痛苦的 Brainfuck 和 Whitepace 更有用。 将其视为 Forth,简单的语法使其更加简洁;-)
我发现 Quartus Forth相当容易使用,只要您可以在堆栈中思考,并且通过对 API 的更多 Intellisense 支持,它会更加高效。 对于在 Palm 上制作小算法原型,我更喜欢 Plua 或 Lispme。 无论如何,LispMe 环境都值得研究,因为它很好地利用了列表来查找关键字,因此简化了 GUI 编程。
您必须做出的重大决定是,您是否希望用户只使用手机数字键盘,或者能够输入合理的近似值一个完整的键盘。 Palm 的巨大优势之一是高品质的全尺寸折叠键盘,我很遗憾地怀念它(并希望有人制作一个 iPhone 配件来连接)。 如果您没有完整的键盘,请使用动词选择器,以便他们可以使用选择操作,而不必输入单词。 与用户代码相比,请考虑在框架类和方法的传统代码中键入的代码量。
If you want super-compact, try nano-False http://www.aldweb.com/pages/winikoff/#false
It isn't very usable, although more so than the deliberately painful Brainfuck and Whitepace. Think of it as Forth with the easy syntax made more concise ;-)
I found Quartus Forth reasonably easy to use, provided you can think in stacks, and with more Intellisense support for the API it would have been much more productive. For prototyping little algorithms on the Palm I preferred Plua or Lispme. The LispMe environment is worth studying anyway because it provided good use of lists for finding keywords and so eased GUI programming
The big decision you have to make is whether you expect users to just use a phone numeric keypad or be able to type in reasonable approximations to a full keyboard. One of the huge benefits of the Palm was the high-quality full-size folding keyboards which I sadly miss (and hope someone makes an iPhone accessory to connect). If you don't have a full keyboard, make use of selectors for verbs so they can use picking actions rather than having to type in words. Consider the amount of code typed in traditional code for the framework classes and methods compared to the user code.
当我开始梦想一种语言时,我会思考哪些功能在我梦想时对我来说很重要。 只有弄清楚哪些功能对您来说很重要,您才能对哪些语法提出最佳答案。 例如,如果您想要命名参数,它会极大地影响您对方法调用外观的设计选择(如 Objective-C 或 Python)。
设计一种语言可能是一项非常有趣的任务。 我鼓励您退一步问自己“我真的喜欢 X 中的做法吗?” (替换一些语言名称)。 如果这是您一直喜欢的东西,偷走它。 如果没有,请看看其他地方。 创建你喜欢的东西的终极混搭,并留下你讨厌的东西!
When I go about dreaming about a language, I think about what features are important to me at the time I'm dreaming. Only once you figure out what features are important to you can you come up with the best answer to what syntax. For example, if you want named parameters, it greatly influences your design choice about how method calls look (a la Objective-C or Python).
Designing a language can be a really fun task. I encourage you to step back and ask yourself "Do I really like how this is done in X?" (substituting some language name). If that's something you've always loved, steal it. If not, look elsewhere. Create your ultimate mashup of what you love, and leave out what you hate!
尽管 joel.neely 的回答展示了解决该问题的一种方法,但由于所有 (),Lisp 很难输入。
因此,如果您想使用现有语言,您可能需要查看哪些语言使用最少的异常字符。
然后是屏幕尺寸问题。 语言越冗长,您能够立即显示在屏幕上的代码就越少。 您的目标是什么类型的设备? 大屏幕智能手机(受众有限)还是 240x240 像素功能手机?
请记住,您的语言的解释器/VM 必须适应少量内存,并且性能可能不是很好。
Lisp would be difficult to type because of all the ()s, although joel.neely's answer demonstrates one way of working around that problem.
So if you want to use an existing language you might want to look at which ones use least unusual characters.
Then there's the screen size issue. The more verbose the language the less code you're going to be able to fit onto the screen at once. What kind of devices are you aiming at? Smartphones with big screens (a limited audience) or 240x240 pixel feature phones?
Bear in mind that the interpreter/VM for your language will have to fit into a small amount of memory and performance may not be very good.
Brainfuck 只有 8 个字符——非常容易在手机上输入。
当然,理解并用它做事......并不那么容易。 不过满足要求了......
Brainfuck has only 8 characters -- very easy to type in on a mobile phone.
Of course, understanding and doing stuff with it... not so easy. But it satisfies the requirement....
基本很简单。
我会远离 lisp。 除非您想让移动用户在无线电波带来的头痛之外再头痛。
Basic is very easy.
I would stay away from lisp. Unless you want to give your mobile users a headache on top of the headache they have from radio waves.