Parrot-0.0.1

markh at usai.asiainfo.com markh at usai.asiainfo.com
Tue Aug 31 05:31:04 EDT 1999


Phil Hunt <philh at vision25.demon.co.uk> wrote:
: In article <7ps4ma$n06$1 at wagner.wagner.home>
:            vitus at wagner.rinet.ru "Victor Wagner" writes:

:> Really it is very simple to define parrot interpreter on tcl - just
:> define commands such as window, columnLayout, rowLayout as tcl procedures 
:> which substitute
:> something by default.

: Would anyone want to do this in Tcl as opposed to Python? (Not
: wishing to get into another language war :-)).

Interestingly, your parrot specifications follow Tcl's syntax,
so it's very simple to make a complete parrot parser in tcl.
Stick these lines in  front of your parrot file and run it
through tclsh.  Modify the "puts" commands appropriately
and you will have the front end you need.

-------------- cut here ----------------
# parrot parser
proc window {name title cmds} {
    puts "window: $name"
    eval $cmds
}
proc menubar {cmds} {
    puts "menubar"
    eval $cmds
}
proc menu {name cmds} {
    puts "menu: $name"
    eval $cmds
}
proc menuBar {cmds} {
    puts "menuBar"
    eval $cmds
}
proc menuItem {name label} {
    puts "menuItem: $name"
}
proc colLayout {cmds} {
    puts "colLayout"
    eval $cmds
}
proc rowLayout {cmds} {
    puts "rowLayout"
    eval $cmds
}
proc label {label} {
    puts "label: $label"
}
proc button {name label} {
    puts "button: $name"
}
proc radioButton {name label} {
    puts "radioButton: $name"
}
-------------- cut here ----------------

-- 
Mark Harrison                       "Open the floppy disk door, Hal."
AsiaInfo Computer Networks          http://usai.asiainfo.com:8080/
Beijing, China / Santa Clara, CA    markh at usai.asiainfo.com




More information about the Python-list mailing list