Plom is an in-development programming language that's designed specifically for programming on cellphones. It is currently still an evolving, experimental prototype. Development of Plom is done on GitHub. More documentation on the design of Plom can be found there as well.
Traditional text-based languages are too clunky for use with the cramped keyboards of mobile phones, so Plom has its own system for typing code. Although this system is unusual and does require some time to learn, it is a necessary trade-off. Programmers need a way to quickly type in their code for a programming language to be practical for real programming.
To make entering code faster, Plom presents a special keyboard to the programmer. This keyboard has buttons for whole instructions and other program tokens. Notably, the keyboard has buttons for operators and other special symbols that are normally difficult to find on a mobile keyboard. Pressing a button will add these tokens to your program. The buttons shown on the keyboard will change depending on the context. Plom will only show you buttons for program tokens that can be validly added at the cursor position.
Below are some examples that show how code can be typed into Plom. The examples may use simplified versions of the Plom keyboard to focus attention on certain features of the keyboard.
The basic "Hello World" program in Plom looks like this:
At the end of this example section is a small Plom coding area where one can practice typing in the above code example. One would first need to press the .print will appear in the code, with a blank space beside it for what should be printed. The cursor will automatically move to that blank space.
to type the first part of the code. After pressing the button, aStrings in Plom start with " symbols. The only button that starts with a " is the button. That is the button for typing strings. After ones presses that button, the Plom keyboard disappears, and one can type the text for the string using the normal keyboard. Pressing the will finish inputting the string.
To recap, the steps needed to type in the code for Hello World are
When typing in math expressions, the Plom keyboard will automatically change depending on the context to show buttons that you may need. Below is the Plom code for printing the result of the expression "1 + 2":
At the end of this example section is a Plom coding area with some existing code. The string "Hello World" needs to be deleted from this existing code in order to type the new 1 + 2 expression. Although the Plom editor is based on tokens instead of characters, editing text in Plom is similar to text editing. To delete the "Hello World" string, one taps on the code immediately after the "Hello World" token to move the cursor there and then one presses the button to delete that token.
To type the expression 1 + 2, one starts by typing the first number. One needs to press the button to enter a number, type 1 using the normal keyboard, and then press the button to finish inputting the number. The Plom keyboard should reappear but with a different set of buttons. One has to press the button to input a + token. Finally, to input the last number, one has to press the button, type 2 using the normal keyboard, and then press the button to finish.
To recap, the steps needed to edit the code are
Delete the old expression
Type the first number
Type the +
Type the second number
.{print: {"Hello World"}}
A real program will have multiple lines of code. Below is a Plom program that asks the user to type their name. The program then says hello to the user:
The details of the code are not important, but the first line creates a variable called .name, the second line asks the user to type their name and stores it in the variable, and the last line prints out a hello message using the name. At the end of this example section is a Plom coding area with the first and last line of code already entered. The rest of this example focuses on how to type the second line into Plom.
To start a new line, one should first move the cursor to the end of the first line. One can just tap at the end of the first line to move the cursor there. Alternately, one can also drag the circle handle underneath the cursor to move the cursor. Then, one can add a newline by pressing the
button.To type the second line, one needs to input the name of a variable. In Plom, all variable names, function names, method names, and other identifiers begin with a period. To type the variable .name, one first needs to press the button. Plom will then allow one to type the name of the variable, but Plom should show a suggesetion for name to the right of the code. Just tap on the suggestion . Next, press the button to input the assignment operator. Then, one needs to type the .input: function. Unlike with .print:, there is button for that. Instead, press the to input the function name. One can try to find the suggestion for .input: to the right of the code and choosing that suggestion. Alternately, one can simply type input: using the normal keyboard and then press the button. Finally, one can type the argument to the .input: function by pressing the button to create a string, typing What is your name? using the normal keyboard, and then pressing the button.
To recap, the steps needed to add the new line of code are
Create a new line
Type the new line
var .{name} @{string} := "User"
.{print: {"Hello, " + .{name}}}
Below is some code with a simple while loop that repeatedly prints "You are great."
Plom has special handling for these blocks of code inside control flow statements. Plom understands the structure of these blocks, and it will automatically handle all the code formatting to ensure everything is properly indented. At the end of this example section is a small Plom coding area where one can practice typing in the above code example.
To enter the above code into Plom, one first needs to press the while loop. Plom will automatically add the necessary parentheses and indentation for the code. Then, one should press the button.
button to create aNext, one needs to move the cursor between the { and } to type code there. Although one can simply tap on the screen or drag the cursor, Plom has a special button that will automatically move the cursor to the next available entry location in the code. One can press that button to move the cursor there. When there, one can press the button to call the print:. And then one presses the button to create a string. Finally, one can type You are great using the normal keyboard and the press the button to finish.
To recap, the steps needed to edit the code are
In the course of developing Plom, we found the need for a basic mobile git client to version control our Plom code. Although there are other mobile git clients, we wanted a free one that worked with certain APIs, so we made the PlomGit git client.