Citation: Zan, T.; Hu, Z. VoiceJava: A
Syntax-Directed Voice Programming
Language for Java. Electronics 2023,
12, 250. https://doi.org/10.3390/
electronics12010250
Academic Editors: Sanjay Misra,
Robertas Damaševiˇcius and
Bharti Suri
Received: 28 November 2022
Revised: 27 December 2022
Accepted: 29 December 2022
Published: 3 Juanuary 2023
Copyright: © 2023 by the authors.
Licensee MDPI, Basel, Switzerland.
This article is an open access article
distributed under the terms and
conditions of the Creative Commons
Attribution (CC BY) license (https://
creativecommons.org/licenses/by/
4.0/).
Article
VoiceJava: A Syntax-Directed Voice Programming Language
for Java
Tao Zan
1,
* and Zhenjiang Hu
2
1
School of Mathematics and Information Engineering, Longyan University, Longyan 364012, China
2
Key Lab of High Confidence Software Technologies, Ministry of Education, Department of Computer Science
and Technology, EECS, Peking University, Beijing 100091, China
* Correspondence: zan@lyun.edu.cn
Abstract:
About 5–10% of software engineers suffer from repetitive strain injury, and it would be
better to provide an alternative way to write code instead of using a mouse and keyboard and sitting
on a chair the whole day. Coding by voice is an attractive approach, and quite a bit of work has been
done in that direction. At the same time, dictating plain Java text with low accuracy through the
existing voice recognition engines or providing complex panels controlled by the voice makes the
coding process even more complex. We argue that current programming languages are suitable for
programming by hand, not by mouth. We try to solve this problem by designing a new programming
language, VoiceJava, suitable for dictating. A Java program is constructed in a syntax-directed
way through a sequence of VoiceJava commands. As a result, users do not need to dictate spaces,
parentheses, and commas, reducing the vocal load.
Keywords: voice coding; syntax-directed editing; code generation
1. Introduction
A famous venture investor, Marc Andreessen, claimed that “software is eating the
world”, which is true that nowadays, as almost everything depends on software in our
daily life. Software is written by software engineers. Unluckily, 5–10% or even more of
them suffer from repetitive strain injury (RSI) [
1
]. RSI describes discomfort and pain in
muscles, nerves, and tendonitis of the wrist or hand. Prolonged repetitive movements of
the same body parts are eventually leading to an overuse of those body parts.
RSI is common among software engineers primarily because their wrists are either
flexed or extended during keyboarding, and they spend extended hours sitting in front of a
computer day in and day out. For programmers who suffer from RSI, it would be better
to provide an alternative way to write code instead of a mouse and keyboard. Coding
by voice sounds like an attractive approach, and quite a bit of work has been done in
that direction [
2
]. At the same time, it is still difficult to be applied in the actual software
development process since dictating in plain text has a low accuracy [
3
–
5
] and providing
complex panels increases the coding complexity [6–8].
For example, suppose a programmer wants to dictate a simple statement such as:
( i < 1)
In VocalIDE [
7
], the programmer has to say: “type open parentheses i space less than space
one close parentheses"
Coding by voice in this way takes work since it involves vocal and cognitive loads.
When writing code by keyboard, only 7 keystrokes are needed, while it involves 11 words
when speaking. It is worth mentioning that programmers have to speak the word space
explicitly to indicate a space between words.
Desilets proposed a speech interface named VoiceCode [
9
], which lets users dictate
pseudocode in a natural way, and then it is translated into actual code. For example,
suppose the programmer wants to declare a method in Java [10]:
Electronics 2023, 12, 250. https://doi.org/10.3390/electronics12010250 https://www.mdpi.com/journal/electronics