views:

539

answers:

12

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?)?

A: 

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.

lajos
+1  A: 

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!

NilObject
+5  A: 

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.

joel.neely
Seen this done on an early palm pilot. Now, if only I ws any good a lisp...
dmckee
http://www.lispme.de/lispme/
Andy Dent
+1  A: 

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.

Kevin ORourke
+5  A: 

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:

   for (;;) {
   }
T.E.D.
I have to agree with this. The best mobile applications always come down to how little the user actually has to type. Programming is no different.
Fostah
+3  A: 

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.

Norman Ramsey
I actually don't think that's a very good idea. APL has all kinds of characters that aren't even in ASCII, and has often been used with special keyboards. J gets around the problem by using diagraphs (extra characters), but that defeats your whole reason for using APL here.
T.E.D.
(not a bad enough idea to vote down though. At least you're thinking along the right lines...)
T.E.D.
+2  A: 

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.

GvS
+3  A: 

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.

le dorfier
of course, its integration with the phone's API may be, uh, limited ... but it's an easy language to implement, and fairly fun to use (I'm currently writing an interpreter in Java)
kdgregory
Quartus Forth has full integration with the entire Palm SDK and even allows you to compile standalone apps, on the device! http://www.quartus.net/products/forth/
Andy Dent
+1  A: 

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....

Randolpho
I didn't know about Brainfuck. Very cool.
Michael Tiller
And of course Whitespace is even better ;-)
Jonas Kölker
+4  A: 

You might want to look into Hecl: http://www.hecl.org/

Michael Tiller
+8  A: 

Hi, 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.

David N. Welton
+1 for writing Hecl and Hecl implementation document. Congratulations. (I needed a scripting language for one of my projects it was the best for my needs but it was not possible for me to give you credits :) company policy. So implemented something different)
JCasso
Wow, sounds like an insanely bad open source policy - the Apache license doesn't require you to cover your home page with the Hecl logo or anything like that - just a simple note somewhere. And for that you get a whole language for free, that you can even include in commercial products and sell!Still, though, I'm glad it helped you out as a model in any case.
David N. Welton
+1  A: 

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.

Andy Dent