Programming in controlled natural languages
We've discussed controlled languages on these lists
from time to time, and there's some work at MIT on
using a version of English that isn't well controlled.
It isn't really full English, but since the grammar
is not fully controlled, it isn't really a CNL.
Following is an article based on an interview with
Hugo Liu, a graduate student and research assistant
at MIT:
http://www.trnmag.com/Stories/2005/032305/Tool_turns_English_to_code_032305.html
The original papers, which are rather short conference
articles, can be found on Liu's web site:
http://web.media.mit.edu/%7Ehugo/publications/
publications :: hugo liu
The system, called Metafor, is experimental, and
has not be used to generate any serious programs.
Some excerpts below.
John Sowa
____________________________________________________
English:
There is a bar with a bartender who makes drinks.
Code:
class bar:
the_bartender = bartender()
class bartender:
def make(drink): pass
English:
The bar has a menu containing some drinks, which include:
a sour apple martini, a margarita, and rum and coke.
Code:
class bar:
the_bartender = bartender()
the_menu = menu()
class bartender:
def make(drink): pass
class menu:
drinks = [sour_apple_martini, margarita, rum_and_coke]
class drink: pass
class apple_martini(drink):
properties = [“sour”]
class margarita(drink): pass
class rum_and_coke(drink): pass