prev next
Goals
Language Level
Since most of my programming is currently done in languages like C++
and Java, sopl (Speech Oriented Programming Language) is at roughly
the same level. Also, since interoperability with existing systems
vastly increases the appeal of a language, a primary goal is easy
translation from sopl to a commonly used language. Because Java
fulfills more of the other goals listed below (lower perplexity,
garbage collection, separate subtype/inheritance, etc.), I have tried
to make the semantics easily translatable to Java where possible.
Perplexity
A measure of the usability of a programming language with a voice
recognition system is the perplexity, a number which roughly
corresponds to the average number of lexemes that can be said in an
individual context. In a language like C++, the perplexity is very
high. For example, any of the following lines could follow a
semi-colon:
#include <stdio.h> // Preprocessor commands
int x; // Type names
x = 10; // Local variables
Screen::set_width(10); // Class names
cout << x; // Global variables
printf("Hello, world"); // Functions
for (x = 1; x < 10; x++) { // Language commands
The first goal for the language is therefore to lower the overall
perplexity.
Conventionalization
In natural languages, phrases which are used commonly become
conventionalized. Their literal meaning gets replaced by the
conventional usage. "Kick the bucket" is a good example, since we no
longer have access to the original literal meaning. Although in
programming there is a strong desire to generalize, in natural
languages there seems to be a pressure towards specialization. Sopl
conventionalizes some very common programming idioms in order to
achieve lower perplexity. For example, when I look at existing code,
80% of the "for" loops are simple counters with static upper bounds
and static increments. A conventionalized phrase can be used to
express this semantic using a very low perplexity construct:
loop for a from 1 to 10 by 2
After the word "loop", only "for", "while" or "until" can follow.
After "for", only the name of a variable can follow. After the
variable, the word "from" is required, etc. Although a "keyboard
programmer" may accuse this of chattiness, it is extremely easy to
enunciate.
Isolation of New Names
Since new names in a programming language (e.g. variables, classes,
etc.) can be just about anything, speech recognition engines have a
very hard time recognizing them. To ease the introduction of new names
for the speech recognizer, sopl lexically marks all such introductions
with known keywords. Note that because of type, storage, and access
qualifiers, C++ and Java do not provide this marking.
Ease of Utterance
The language should be easy to speak. At this point, "easy to speak"
is highly subjective. Certainly, short English words are easier than
punctuation or nonsense words. Further research is required.
Hoare
Where they do not conflict directly with the goals outlined above, I
have tried to follow Hoare's advise: Simplicity, security, fast
translation, efficient object code, and readability.
prev next