CSAIL Publications and Digital Archive header
bullet Technical Reports bullet Work Products bullet Research Abstracts bullet Historical Collections bullet

link to publications.csail.mit.edu link to www.csail.mit.edu horizontal line

 

Research Abstracts - 2006
horizontal line

horizontal line

vertical line
vertical line

Syntax-free Programming

Greg Little & Robert Miller

Motivation

Modern applications often provide scripting interfaces to programmatically control their content. For instance, Microsoft Word allows users to modify documents using Visual Basic. Blender, an open source application for 3d modeling and animation, allows users to write Python scripts to manipulate 3d models. Firefox, a popular web browser, has extensions like Chickenfoot[1] that allow users to modify webpages using Javascript. The Gimp, an open source image editing program, allows users to modify images using LISP. These, and many other applications provide scripting support.

Scripting is useful in these applications to automate repetitive tasks, and to record complicated procedures so that they can be repeated later (or shared with other people). Unfortunately, users must overcome several hurdles in order to write scripts:

  • First, they need to be familiar with programming in general. They need to be comfortable writing sequences of instructions, and they need to be detail oriented enough to deal with the rigid syntax constraints imposed by most languages.
  • Second, they need to be familiar with the particular scripting language in use. They need to know how to formulate common expressions in the language, and they need to know some of the built-in functions for manipulating basic data types.
  • Third, they need to be familiar with the Application Programming Interface (API) for the application they are scripting. They need to have some idea how the functions are named, and how they depend on one another.

Many people who use the applications mentioned above are not familiar with programming. Even those who are may not be familiar with the particular scripting language in use. And if they are, they still need to learn the API for the application. This learning curve is so high that many professional users of these applications do not know how to write scripts for them.

Application

We propose Syntax-free Programming: a programming paradigm that eschews rigid syntax and strives to parse suggestive and loosely grammatical expressions. Consider the expression "left margin 2 inches" in the context of Microsoft Word. This expression suggests the idea of making the left margin of the current document 2 inches wide. It can be expressed in the formal syntax of Visual Basic as ActiveDocument.PageSetup.LeftMargin = InchesToPoints(2). A Syntax-free Programming system will try to automatically generate this code from the original expression.

Diagram depicting syntax free programming
Figure 1. Diagram depicting syntax free programming.

Using this approach, users face a smaller set of hurdles for writing scripts:

  • They still need to be familiar with the idea of writing sequences of instructions, but they do not need to be as concerned with the details of syntax.
  • They still need to be able to recognize what an instruction will do (to confirm that the system has understood their intent), but they do not need to know how to generate these expressions on their own.
  • They still need to know what sorts of functions are available in the API, but they do not need to know their exact names, and they may not need to know how they depend on one another.
Current Work

We have prototyped an SFP system which understands many of the javascript commands available in Chickenfoot for interacting with webpages. We will be conducting a user study to see if people can use this system to accomplish various web browsing tasks without using the mouse, but rather typing in sequences of commands.

We have also prototyped an SFP system which understands the API for Microsoft Word. In this prototype, the expression "left margin 2 inches" generates the Visual Basic command: ActiveDocument.PageSetup.LeftMargin = InchesToPoints(2). We are investigating how to make this system most useful for end-users, since they are more likely to be familiar with the terminology in the user interface, rather than the terminology in the API, and these do not always coincide.

We are working to prototype an SFP system which understands the Java API, and explore the potential benefits this might have for writing Java code.

Acknowledgements

This work was supported in part by the National Science Foundation under award number IIS-0447800. Any opinions, findings, conclusions or recommendations expressed in this publication are those of the authors and do not necessarily reflect the views of the National Science Foundation.

References

[1] Michael Bolin, Matthew Webber, Philip Rha, Tom Wilson, and Robert C. Miller. "Automation and Customization of Rendered Web Pages." UIST 2005, pp. 163-172.  Winner of best paper award.

vertical line
vertical line
 
horizontal line

MIT logo Computer Science and Artificial Intelligence Laboratory (CSAIL)
The Stata Center, Building 32 - 32 Vassar Street - Cambridge, MA 02139 - USA
tel:+1-617-253-0073 - publications@csail.mit.edu