Plom

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.

How to type code in Plom

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.

Example: Inputting Tokens

The basic "Hello World" program in Plom looks like this:

.print: "Hello World"

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: to type the first part of the code. After pressing the button, a .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.

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

💡
Plom Principle
Plom is designed so that the next button you need to press on the keyboard usually matches the next character(s) of the text you want to type.

To recap, the steps needed to type in the code for Hello World are

  1. Press the .print: button
  2. Press the "…" button
  3. Type Hello World and press the button

Example: Deleting tokens and expressions

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":

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

💡
Plom Principle
Although Plom has its own special input system based on tokens and code structure, it is designed to mimic a traditional text editor. You can modify text like a normal text editor by moving a cursor/caret, deleting text using Backspace, or adding lines using the Enter button.

To type the expression 1 + 2, one starts by typing the first number. One needs to press the 123… 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 123… 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

  1. Tap immediately after the "Hello World" token
  2. Press the button
  3. Type the first number

  4. Press the 123… button
  5. Type 1 and press the button
  6. Type the +

  7. Press the + button
  8. Type the second number

  9. Press the 123… button
  10. Type 2 and press the button
.{print: {"Hello World"}}

Example: Multiple lines and identifiers

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:

var .name @string := "User" .name := .input: "What is your name?" .print: "Hello, " + .name

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

  1. Tap at the end of the first line
  2. button.
  3. Type the new line

  4. Press the . button
  5. Choose the name suggestion shown to the right of the code
  6. Press the := button
  7. Press the . button
  8. Find the input: suggestion and choose it; alternately, type input: and press the button
  9. Press the "…" button
  10. Type What is your name? and press the button
var .{name} @{string} := "User" .{print: {"Hello, " + .{name}}}

Example: Control flow blocks

Below is some code with a simple while loop that repeatedly prints "You are great."

while true { .print: "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.

💡
Plom Principle
Because code must be formatted differently to fit on different devices and because formatting code on a mobile phone is cumbersome, Plom automatically formats program code instead of letting programmers control it. This is consistent with industry practices where code formatting is managed by computer in order to ensure consistent formatting.

To enter the above code into Plom, one first needs to press the while button to create a while loop. Plom will automatically add the necessary parentheses and indentation for the code. Then, one should press the true button.

Next, 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 .print: 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

  1. Press the while button
  2. Press the true button
  3. Press the button
  4. Press the print: button
  5. Press the "…" button
  6. Type You are great and press the button

PlomGit

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.