PUT Language for Specifying Instructions
by Roedy Green ©1996-2008 Canadian Mind Products
This essay is about a suggested
student project in
Java programming. This essay gives a rough overview of how it might work. It
does not describe an actual complete program. I have
no source, object,
specifications, file layouts or anything else useful to implementing this
project. Everything I have to say to help you with this project is written below.
I am
not prepared to help you implement it; I have too many other
projects of my own.
I do contract work for a living, which could include writing a program such as
this. However, I don’t do people’s homework
for them. That just robs them of an education.
You have my full permission to implement this project any way you please.
PUT is not a acronym. It comes from the phrase "put tab A in slot B"
Most computer languages are designed to give instructions to a computer. PUT
language is for specifying instructions intended for an fellow human being.
Consider a set of instructions to set
up an IV , assemble a swing set, copy a file, set up a new ink-jet printer,
make Alice B. Toklas brownies or take a pregnancy test. Such sets of
instructions are often:
- logically inconsistent, e.g. they tell you to close a stop cock that is already
closed.
- ambiguous.
- Don’t define terminology.
- Have to be maintained in several languages.
The idea is you specify the instructions in a formal language to avoid these
problems. That language can then be used to generate:
- Printed instructions in various languages.
- HTML. You can click to see more detailed instructions as needed.
- Customised instructions, e.g. IV instructions with the patient’s name,
drug, flow rate etc built-in wherever they are needed.
- incomplete.
- An interactive CD-ROM. It asks questions and configures itself as it goes on the
fly. So instead of saying to the end user "If the strip turned blue, do X,
but if the strip is pink, do "Y", it would ask , "Did the strip
turn pink or blue?" and when it received an answer it would issue the
corresponding next step . this simplifies the instructions for the user since
there is no mention of cases that don’t apply.
How does the language work. You first have to define your nouns, including a
photograph or illustration. You then have to define your verbs and prepositions.
There would presumably be a large library so that in most cases the PUT
programmer could avoid this tedious step. You must define your rules as what you
can do with each noun. E.g. for a sheath that goes over a needle, you can remove
it, discard it, replace it, put it somewhere, pick
it up from somewhere.
You then create your list of instructions in PUT language. You compile it to
check for consistency and lack of ambiguity. You can put both hidden and end
user visible asserts e.g. "The stopcock should be closed at this point."
The PUT compiler would complain if you said "beat two eggs", when you
had not mentioned eggs in the ingredients list (noun definition section) of your
brownies.
How might to implement this? Have a look at my IV
Instructions . Try inventing a subset of PUT language to solve IV setup
problems. A statement in put might look like this:
Close primary part:clamp.
Attach cap color:red to:(primary part:end)
Then implement a special version of the PUT language to teach people to make
bread with various recipes using a bread marker. Then the generalisation
patterns needed for a PUT language syntax will begin to emerge. Have your parser
spit out the compiled instructions as Java code. The Java code can then be
compiled and combined with some classes to generate printed instructions.
Then work at allowing new nouns, verbs and rules to be added elegantly rather
than by tweaking tables or Java code.