Interrogative Programming - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Interrogative Programming

Description:

Platform-independent (written in Python) Can be customized to generate code in any target programming language. (Demonstration #1) ... – PowerPoint PPT presentation

Number of Views:233
Avg rating:3.0/5.0
Slides: 23
Provided by: alexq
Category:

less

Transcript and Presenter's Notes

Title: Interrogative Programming


1
Interrogative Programming
Alex Quinn aquinn_at_cs.washington.edu http//www.cs.
washington.edu/homes/aquinn/ips/ April 10, 2002
2
Outline
  • Background
  • Basic idea, motivation, related work, etc.
  • Details and the sample implementation
  • Demonstration, file formats, process, etc.
  • Evaluation
  • Cognitive aspects, usability tests, etc.
  • Conclusion

3
Basic Idea
  • Allow non-programmers to create programs by
    answering a series of closed-ended questions.
  • Non-programmer is someone who has never
    programmed in a language with loops or control
    flow.

4
Motivation
  • "Make a computer that can program itself."
  • Put computer in the role of a consultant.
  • Empower end-users (non-programmers) to create
    useful programs
  • Bridge the gap between the user's concept of a
    solution and the computer's required method of
    specification (e.g. a programming language).

5
Related Approaches
  • Visual languages
  • Prograph/CPX, ToonTalk, Visual Basic (maybe)
    (Steve? better examples?)
  • Scripting languages
  • Mathematica, AppleTalk, VBA, various macro
    languages
  • Programming by Example...

6
Programming by Example
  • Another way of bridging the gap between user's
    problem and the computer's solution.
  • Examples SmartEdit (below), LAPIS, StageCast
    Creator, some macro recorders

7
Visual Programming
  • Intended to make programming easier but doesn't
    necessarily reduce the gap between user's concept
    and computer's required description of solution.
  • Example Prograph

8
"Interrogative Programming" approach
  • Computer infers user's intent through a series of
    closed ended questions.
  • Based on a context-free grammar
  • Computer derives the program through a top-down
    recursive decent parse using the user's answers
    to questions in place of a source code file.

9
IPS A prototype
  • Console based interaction.
  • Platform-independent (written in Python)
  • Can be customized to generate code in any target
    programming language.
  • (Demonstration 1)

10
Demonstration 1
  • Look for the structure of the questioning by
    noticing repeated questions.
  • Try to consider these questions from the
    perspective of a non-programmer.

11
Domain Files
  • Grammar is specified in external "domain file".
  • Domain file specifies a context free grammar.
  • Also, english verb phrases for building
    questions.
  • Also, explanatory text for help features.
  • Can be written by any programmer to allow
    creation of certain kinds of programs.
  • Similar to a grammar file for yacc.
  • System uses this grammar to "parse" user's
    responses and infer the user's intent.

12
Domain File Format
  • A domain file contains a list of rules
    (non-termianls), each of which contain the
    following information.
  • name e.g. "statement", "draw-circle"
  • productions list of other rule names which
    components of this item.
  • options english phrases to describe each choice
  • code skeleton code for this rule
  • help extended explanatory text

13
Domain Example
name statement_list productions string("give a
name to the group of instructions you are about
to specify") statement("specify instructions
for 1") options "specify some instructions for
the computer" code include ltstdio.hgt / Begin
"1" / 2 name statement productions
print_stmt("display some text")
assignment("change the value of a variable")
input_stmt("get some input from the user")
loop("repeat some actions") options code
1 help 1. The first option is to print
something to the screen. 2. Changing a the value
of a variable requires that you create a
variable first. You can also use this to do
calculations. 3. Getting input from the user
will print a message you specify and then let
the user enter something to be stored in one
of your variables. 4. You can use this to repeat
one or many instructions. name
print_stmt productions string("enter the text
you want to display") options "enter the text to
be printed" code printf("1\n")
14
"Parse" Example
To specify some actions you have 4 choices.
Please pick one. 1. Print something to the
screen. 2. Create or change a variable. 3. Get
some input from the user. 4. Repeat some
action(s) a certain number of times. 6. EXIT
name statement productions print_stmt("display
some text") assignment("change the value of a
variable") input_stmt("get some input from
the user") loop("repeat some
actions") options "display some text" "change
the value of a variable" "get some input from
the user" "repeat some actions" code
1 help .....
15
IPS Flow
User interacts with IPS
IPS works with the domain file
IPS generates executable
16
Code Generation
  • During conversation, IPS builds an abstract
    syntax tree
  • The AST is evaluated just like a compiler would
    do and if necessary, the code is compiled by and
    outside compiler to generate the executable

17
Cognitive Aspects
  • Programming experts are distinguished by three
    types of knowledge
  • syntactive knowledge
  • semantic knowledge
  • schematic knowledge

18
Usability Tests
  • (Demonstration 2 Diamonds)
  • Successes
  • General approach works
  • Users are able to grasp programming concepts very
    quickly when they are seperated from a language.
  • Pitfalls
  • Language issues need more work
  • Users need feedback
  • Users need to know what they are trying to do.

19
Possible Applications
  • People with disabilities
  • Internet programming
  • Text processing
  • Programming instruction (well, maybe)

20
Domains as Ontologies
  • Ontology "an explicit specification of a
    conceptualization"
  • Basically, it's a body of knowledge to be shared.
  • Clarity
  • Coherence
  • Extendibility
  • Minimal encoding bias
  • Minimal ontological commitment

21
Future Work
  • Improve context and flow of conversation.
  • Wrap the dialog in some more friendly interface.
  • Speech?
  • Try mixing the dialog with some sort of GUI to
    allow better editing and feedback.
  • Write some domain files for creating more useful
    programs.

22
What to take with you
  • As people's demands on computers increase, some
    form of programming can help them do more and
    meet those needs.
  • The lexical structure of a language does not
    necessarily need to be expressed with a source
    language.
  • My thanks for coming....
Write a Comment
User Comments (0)
About PowerShow.com