PyoLogo: Difference between revisions
m (Protected "PyoLogo" [edit=autoconfirmed:move=autoconfirmed] (expires 04:09, 9 May 2009 (UTC))) |
|||
(38 intermediate revisions by 21 users not shown) | |||
Line 1: | Line 1: | ||
{{Translations}} |
|||
'''PyoLogo''' [pie-o-logo] or '''PYthon Open Logo''' is an implementation of the Logo programing language created on top of Python. It grew out of [http://www.media.mit.edu/~arnans/ Arnan (Roger) Sipitakiat's] thesis project at the MIT Media Laboratory. PyoLogo consists of a casual Logo interpreter and a simple IDE. |
'''PyoLogo''' [pie-o-logo] or '''PYthon Open Logo''' is an implementation of the Logo programing language created on top of Python. It grew out of [http://www.media.mit.edu/~arnans/ Arnan (Roger) Sipitakiat's] thesis project at the MIT Media Laboratory. PyoLogo consists of a casual Logo interpreter and a simple IDE. |
||
Line 9: | Line 10: | ||
===Available features === |
===Available features === |
||
* '''Logo Primitives'''. Supports a subset of Logo primitives. [[ |
* '''Logo Primitives'''. Supports a subset of Logo primitives. [[PyoLogo#LOGO_words_supported|See the command list below]]. More commands will be added as development progresses. |
||
** Most of the Turtle Geometry (drawing) primitives are available. |
** Most of the Turtle Geometry (drawing) primitives are available. |
||
** List and list manipulation commands |
** List and list manipulation commands |
||
Line 40: | Line 41: | ||
The author is currently preparing the source code to be uploaded into OLPC's code repository. Once this is done, a public release of the software will become available. |
The author is currently preparing the source code to be uploaded into OLPC's code repository. Once this is done, a public release of the software will become available. |
||
== Technical Info == |
|||
Please take a look at the [[PyoLogoTechInfo| technical info page]] for information about how PyoLogo was built |
|||
== The Logo Interpreter == |
== The Logo Interpreter == |
||
Line 46: | Line 51: | ||
Although PyoLogo tries to conform with other Logo implementations, it contains some rather unconventional properties. |
Although PyoLogo tries to conform with other Logo implementations, it contains some rather unconventional properties. |
||
* Not space delimited. 'Show 1 |
* Not space delimited. 'Show 1 1' works in PyoLogo whereas most other Logo interpreters do not accept this. Logo normally requires spaces between every token. So, only 'Show 1 1' would work. Although the uniformity of the Logo language is broken when space becomes optional, the author believes it is a worthwhile trade off. Kids too often becomes frustrated or annoyed by the strict requirement for space. |
||
**This, of course, comes at a cost. There are some cases where the interpreter will not be able to decide what to do. For example, if we have a procedure called sum that takes two integers as an input. So, <tt>sum 2 3</tt> returns 5. A problem occurs when we try to call <tt>sum 2 -3</tt>. The interpreter has no way of knowing if the user wants to do a sum of 2 and -3 or a sum of (2-3) and another value which is missing (and thus should complain to the user.) The user will have to tell the compiler what to do. I.e. in this case the user can call <tt>sum 2 (-3)</tt>. |
|||
* Multiple ways to manipulate variables. The author finds Logo's 'make' primitive unnecessarily complicated for children. The 'set' method is perhaps a better way to go. PyoLogo supports both. For example: |
* Multiple ways to manipulate variables. The author finds Logo's 'make' primitive unnecessarily complicated for children. The 'set' method is perhaps a better way to go. PyoLogo supports both. For example: |
||
make "counter 0 |
make "counter 0 |
||
make "counter :counter |
make "counter :counter 1 |
||
show :counter |
show :counter |
||
Line 58: | Line 66: | ||
setcounter 0 |
setcounter 0 |
||
setcounter counter |
setcounter counter 1 |
||
show counter |
show counter |
||
Line 71: | Line 79: | ||
Both the traditional and shortened approaches are supported in PyoLogo. |
Both the traditional and shortened approaches are supported in PyoLogo. |
||
== LOGO words supported == |
|||
{| border="1" cellpadding="3" style="border:5px" |
|||
| LOGO keyword list |
|||
{| border="1" style="background:#D0FFD0; border:1px; border-collapse:collapse" cellpadding="3" |
|||
! Letter |
|||
|+ LOGO Word List |
|||
! style="background:green" | Implemented |
|||
! Word |
|||
! style="background:yellow" | Partially |
|||
! Implemented? |
|||
! style="background:red" | Missing |
|||
|- |
|||
|abs||Yes |
|||
|- |
|||
|and||Yes |
|||
|- |
|||
|announce|| |
|||
|- |
|||
|answer|| |
|||
|- |
|||
|arccos||Yes |
|||
|- |
|||
|arcsin||Yes |
|||
|- |
|||
|arctan||Yes |
|||
|- |
|||
|ascii||Yes |
|||
|- |
|||
|ask||PARTIAL |
|||
|- |
|||
|bf (butfirst)||Yes |
|||
|- |
|||
|bg|| |
|||
|- |
|||
|bk (back)||Yes |
|||
|- |
|||
|bl (butlast)||Yes |
|||
|- |
|||
|bottom|| |
|||
|- |
|||
|cancel|| |
|||
|- |
|||
|carefully|| |
|||
|- |
|||
|cc||Yes |
|||
|- |
|||
|cg||Yes |
|||
|- |
|||
|char||Yes |
|||
|- |
|||
|chdir|| |
|||
|- |
|||
|clean|| |
|||
|- |
|||
|clearname|| |
|||
|- |
|||
|clearnames|| |
|||
|- |
|||
|clickoff|| |
|||
|- |
|||
|clickon|| |
|||
|- |
|||
|color|| |
|||
|- |
|||
|colorunder|| |
|||
|- |
|||
|cos||Yes |
|||
|- |
|||
|count||Yes |
|||
|- |
|||
|createprojectvar|| |
|||
|- |
|||
|currentdir|| |
|||
|- |
|||
|difference|| |
|||
|- |
|||
|directories|| |
|||
|- |
|||
|distance||Yes |
|||
|- |
|||
|dolist|| |
|||
|- |
|||
|done?|| |
|||
|- |
|||
|dotimes|| |
|||
|- |
|||
|empty?|| |
|||
|- |
|||
|equal?|| |
|||
|- |
|||
|erfile|| |
|||
|- |
|||
|errormessage|| |
|||
|- |
|||
|everyone|| |
|||
|- |
|||
|exp||Yes |
|||
|- |
|||
|exporttext|| |
|||
|- |
|||
|fd (forward)||Yes |
|||
|- |
|||
|files|| |
|||
|- |
|||
|fill|| |
|||
|- |
|||
|first||Yes |
|||
|- |
|||
|fontsize|| |
|||
|- |
|||
|forever||Yes |
|||
|- |
|||
|fput|| |
|||
|- |
|||
|freeze|| |
|||
|- |
|||
|freezebg|| |
|||
|- |
|||
|get|| |
|||
|- |
|||
|getpage|| |
|||
|- |
|||
|getproject|| |
|||
|- |
|||
|glide|| |
|||
|- |
|||
|greater?|| |
|||
|- |
|||
|heading||Yes |
|||
|- |
|||
|home|| |
|||
|- |
|||
|ht||Yes |
|||
|- |
|||
|identical?|| |
|||
|- |
|||
|if||Yes |
|||
|- |
|||
|ifelse||Yes |
|||
|- |
|||
|importtext|| |
|||
|- |
|||
|infront|| |
|||
|- |
|||
|int||Yes |
|||
|- |
|||
|item|| |
|||
|- |
|||
|key?||Yes |
|||
|- |
|||
|last||Yes |
|||
|- |
|||
|launch||Yes |
|||
|- |
|||
|less?|| |
|||
|- |
|||
|let|| |
|||
|- |
|||
|list||Yes |
|||
|- |
|||
|list?|| |
|||
|- |
|||
|listen|| |
|||
|- |
|||
|ln||Yes |
|||
|- |
|||
|loadpict|| |
|||
|- |
|||
|loadshape|| |
|||
|- |
|||
|loadtext|| |
|||
|- |
|||
|local|| |
|||
|- |
|||
|log||Yes |
|||
|- |
|||
|lput|| |
|||
|- |
|||
|lt (left)||Yes |
|||
|- |
|||
|make||Yes |
|||
|- |
|||
|member?|| |
|||
|- |
|||
|minus|| |
|||
|- |
|||
|mousepos||Yes |
|||
|- |
|||
|name|| |
|||
|- |
|||
|name?|| |
|||
|- |
|||
|names|| |
|||
|- |
|||
|newbutton|| |
|||
|- |
|||
|newpage|| |
|||
|- |
|||
|newprojectsize|| |
|||
|- |
|||
|newturtle|| |
|||
|- |
|||
|not||Yes |
|||
|- |
|||
|note|| |
|||
|- |
|||
|np (namepage)|| |
|||
|- |
|||
|number?|| |
|||
|- |
|||
|op (output)||Yes |
|||
|- |
|||
|opaque|| |
|||
|- |
|||
|or||Yes |
|||
|- |
|||
|pagelist|| |
|||
|- |
|||
|parse|| |
|||
|- |
|||
|pd||Yes |
|||
|- |
|||
|pensize||Yes |
|||
|- |
|||
|pi||Yes |
|||
|- |
|||
|pick|| |
|||
|- |
|||
|pos||Yes |
|||
|- |
|||
|power|| |
|||
|- |
|||
|pr (print)|| |
|||
|- |
|||
|presentationmode|| |
|||
|- |
|||
|product|| |
|||
|- |
|||
|projectlist|| |
|||
|- |
|||
|projectsize|| |
|||
|- |
|||
|projectvars|| |
|||
|- |
|||
|pu||Yes |
|||
|- |
|||
|question|| |
|||
|- |
|||
|quotient|| |
|||
|- |
|||
|random||Yes |
|||
|- |
|||
|readchar||Yes |
|||
|- |
|||
|remainder|| |
|||
|- |
|||
|remove|| |
|||
|- |
|||
|repeat||Yes |
|||
|- |
|||
|rerandom|| |
|||
|- |
|||
|resett||Yes |
|||
|- |
|||
|rest|| |
|||
|- |
|||
|restore|| |
|||
|- |
|||
|round||Yes |
|||
|- |
|||
|rt (right)||Yes |
|||
|- |
|||
|run|| |
|||
|- |
|||
|savepict|| |
|||
|- |
|||
|saveproject|| |
|||
|- |
|||
|saveshape|| |
|||
|- |
|||
|savetext|| |
|||
|- |
|||
|se (sentence)|| |
|||
|- |
|||
|set|| |
|||
|- |
|||
|setbg|| |
|||
|- |
|||
|setc (setcolor)||Yes |
|||
|- |
|||
|seth (setheading)||Yes |
|||
|- |
|||
|setinstruction|| |
|||
|- |
|||
|setinstrument|| |
|||
|- |
|||
|setpensize||Yes |
|||
|- |
|||
|setpos||Yes |
|||
|- |
|||
|setsh (setshape)|| |
|||
|- |
|||
|setsize|| |
|||
|- |
|||
|setx||Yes |
|||
|- |
|||
|sety||Yes |
|||
|- |
|||
|shape|| |
|||
|- |
|||
|show||Yes |
|||
|- |
|||
|sin||Yes |
|||
|- |
|||
|size|| |
|||
|- |
|||
|sqrt||Yes |
|||
|- |
|- |
||
! A |
|||
|st||Yes |
|||
| style="background:#D0FFD0" | abs, and, announce, answer, arccos, arcsin, arctan, ascii |
|||
| style="background:#FFFFAA" | ask |
|||
| style="background:#FF8888" | |
|||
|- |
|- |
||
! B |
|||
|stamp||Yes |
|||
| style="background:#D0FFD0" | bf (butfirst), bk (back), bl (butlast) |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | bg, bottom |
|||
|- |
|- |
||
! C |
|||
|startup|| |
|||
| style="background:#D0FFD0" | cc, cg, char, chdir, clean, color, cos, count, currentdir |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | cancel, carefully, clearname, clearnames, clickoff, clickon, colorunder, creatprojectvar |
|||
|- |
|- |
||
! D |
|||
|stop|| |
|||
| style="background:#D0FFD0" | distance |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | difference, directories, dolist, done?, dotimes |
|||
|- |
|- |
||
! E |
|||
|stopall||Yes |
|||
| style="background:#D0FFD0" | empty?, exp |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | equal?, erfile, errormessage, everyone, exporttext |
|||
|- |
|- |
||
! F |
|||
|stopme|| |
|||
| style="background:#D0FFD0" | fd (forward), first, forever |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | files, fill, fontsize, fput, freeze, freezebg |
|||
|- |
|- |
||
! G |
|||
|sum|| |
|||
| style="background:#D0FFD0" | getproject |
|||
| style="background:#FFFFAA" | get |
|||
| style="background:#FF8888" | getpage, glide, greater? |
|||
|- |
|- |
||
! H |
|||
|tan||Yes |
|||
| style="background:#D0FFD0" | heading, ht |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | home |
|||
|- |
|- |
||
! I |
|||
|thing|| |
|||
| style="background:#D0FFD0" | if, ifelse, int, item |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | identical?, importtext, infront |
|||
|- |
|- |
||
! K |
|||
|timer||Yes |
|||
| style="background:#D0FFD0" | key? |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | |
|||
|- |
|- |
||
! L |
|||
|touching?||Yes |
|||
| style="background:#D0FFD0" | last, launch, list, list?, ln, log, lt (left) |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | less?, let, listen, loadpict, loadshape, loadtext, local, lput |
|||
|- |
|- |
||
! M |
|||
|towards||Yes |
|||
| style="background:#D0FFD0" | make, mousepos |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | member?, minus |
|||
|- |
|- |
||
! N |
|||
|tto (talkto)|| |
|||
| style="background:#D0FFD0" | name?, newturtle, not, number? |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | name, names, newbutton, newpage, note, np (namepage) |
|||
|- |
|- |
||
! O |
|||
|turtlesown|| |
|||
| style="background:#D0FFD0" | op (output), or |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | opaque |
|||
|- |
|- |
||
! P |
|||
|unfreeze|| |
|||
| style="background:#D0FFD0" | parse, pd, pensize, pi, pos, pu |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | pagelist, pick, power, pr (print), presentationmode, product, projectlist, projectvars |
|||
|- |
|- |
||
! Q |
|||
|unfreezebg|| |
|||
| style="background:#D0FFD0" | question |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | quotient |
|||
|- |
|- |
||
! R |
|||
|wait||Yes |
|||
| style="background:#D0FFD0" | random, readchar, remove, repeat, resett, round, rt (right), run |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | remainder, rerandom, rest, restore |
|||
|- |
|- |
||
! S |
|||
|waituntil||Yes |
|||
| style="background:#D0FFD0" | setc (setcolor), seth (setheading), se (sentence),setpensize, setpos, setsh (setshape), setsize, setx, sety, shape, show, sin, size, sqrt, st, stamp, stop, stopall |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | savepict, saveproject, saveshape, savetext, set, setbg, setinstruction, setinstrument, startup, stopme, sum |
|||
|- |
|- |
||
! T |
|||
|when|| |
|||
| style="background:#D0FFD0" | tan, thing, timer, touching?, towards |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | tto (talkto), turtlesown |
|||
|- |
|- |
||
! U |
|||
|who|| |
|||
| style="background:#D0FFD0" | |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | unfreeze, unfreezebg |
|||
|- |
|- |
||
! W |
|||
|word|| |
|||
| style="background:#D0FFD0" | wait, waituntil, who, word, word? |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | when |
|||
|- |
|- |
||
! X |
|||
|word?|| |
|||
| style="background:#D0FFD0" | xcor |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | |
|||
|- |
|- |
||
! Y |
|||
|xcor||Yes |
|||
| style="background:#D0FFD0" | ycor |
|||
| style="background:#FFFFAA" | |
|||
| style="background:#FF8888" | |
|||
|- |
|- |
||
|ycor||Yes |
|||
|} |
|} |
||
Line 436: | Line 207: | ||
[[Category:Software development]] |
[[Category:Software development]] |
||
[[Category:Programming language]] |
[[Category:Programming language]] |
||
[[Category: |
[[Category:LOGO]] |
Latest revision as of 05:09, 9 February 2009
PyoLogo [pie-o-logo] or PYthon Open Logo is an implementation of the Logo programing language created on top of Python. It grew out of Arnan (Roger) Sipitakiat's thesis project at the MIT Media Laboratory. PyoLogo consists of a casual Logo interpreter and a simple IDE.
Current Status
Since PyoLogo is currently thesis software, it is far from being a complete product. Here is a list of things it can and cannot do.
Available features
- Logo Primitives. Supports a subset of Logo primitives. See the command list below. More commands will be added as development progresses.
- Most of the Turtle Geometry (drawing) primitives are available.
- List and list manipulation commands
- Common control flow. If, ifelse, repeat, etc
- Variables. Using the 'make' command and some other alternatives
- Mathematical operations. sin, cos, tan, sqrt, etc
- Supports multiple procedures with parameter passing and procedure output
- Multi-threaded. I.e. the 'launch' and 'forever' commands creates a new background process
- Support turtle shapes
Thesis Features
There are some non-traditional features built into PyoLogo for the thesis work form which it was created. Here are some that could perhaps be useful.
- Robotics. PyoLogo can receive sensor input and control actuators via the GoGo Board. Since OLPC will have a sensor input through its microphone jack, this feature can be adapted to make use of this possibility.
- Line objects. These are slider-like objects that can be used to track a turtle's position or visualize a sensor value.
- Variable history. Every variable keeps a record of its previous values. It can be used to calculate the rate of a variable (i.e. position -> speed) or for debugging purposes.
Issues and missing items
- Performance. PyoLogo currently runs very slowly on OLPC machines. This is based on the A test boards
- Still some UI issues under Linux
- Bugs are plentiful. It still needs extensive testing.
- Error reporting. Errors in the Logo programs are not well reported. This makes it difficult for the user to debug their Logo program
- No multimedia support. No sound, no video, no text box, no drawing tools
- No UI widgets for the user program. No buttons, checkboxes
- No multiple page support
Download
The author is currently preparing the source code to be uploaded into OLPC's code repository. Once this is done, a public release of the software will become available.
Technical Info
Please take a look at the technical info page for information about how PyoLogo was built
The Logo Interpreter
Casual Logo
Although PyoLogo tries to conform with other Logo implementations, it contains some rather unconventional properties.
- Not space delimited. 'Show 1 1' works in PyoLogo whereas most other Logo interpreters do not accept this. Logo normally requires spaces between every token. So, only 'Show 1 1' would work. Although the uniformity of the Logo language is broken when space becomes optional, the author believes it is a worthwhile trade off. Kids too often becomes frustrated or annoyed by the strict requirement for space.
- This, of course, comes at a cost. There are some cases where the interpreter will not be able to decide what to do. For example, if we have a procedure called sum that takes two integers as an input. So, sum 2 3 returns 5. A problem occurs when we try to call sum 2 -3. The interpreter has no way of knowing if the user wants to do a sum of 2 and -3 or a sum of (2-3) and another value which is missing (and thus should complain to the user.) The user will have to tell the compiler what to do. I.e. in this case the user can call sum 2 (-3).
- Multiple ways to manipulate variables. The author finds Logo's 'make' primitive unnecessarily complicated for children. The 'set' method is perhaps a better way to go. PyoLogo supports both. For example:
make "counter 0 make "counter :counter 1 show :counter
The following alternative is also available
global [counter] setcounter 0 setcounter counter 1 show counter
- Object oriented properties as a shortcut for 'ask.' For example, a typical logo command to vertically align one turtle to another would be:
t1, setx ask "t2 "xcor
PyoLogo allows a dot format for accessing a turtle's property.
t1, setx t2.xcor
Both the traditional and shortened approaches are supported in PyoLogo.
LOGO words supported
LOGO keyword list | Letter | Implemented | Partially | Missing |
---|---|---|---|---|
A | abs, and, announce, answer, arccos, arcsin, arctan, ascii | ask | ||
B | bf (butfirst), bk (back), bl (butlast) | bg, bottom | ||
C | cc, cg, char, chdir, clean, color, cos, count, currentdir | cancel, carefully, clearname, clearnames, clickoff, clickon, colorunder, creatprojectvar | ||
D | distance | difference, directories, dolist, done?, dotimes | ||
E | empty?, exp | equal?, erfile, errormessage, everyone, exporttext | ||
F | fd (forward), first, forever | files, fill, fontsize, fput, freeze, freezebg | ||
G | getproject | get | getpage, glide, greater? | |
H | heading, ht | home | ||
I | if, ifelse, int, item | identical?, importtext, infront | ||
K | key? | |||
L | last, launch, list, list?, ln, log, lt (left) | less?, let, listen, loadpict, loadshape, loadtext, local, lput | ||
M | make, mousepos | member?, minus | ||
N | name?, newturtle, not, number? | name, names, newbutton, newpage, note, np (namepage) | ||
O | op (output), or | opaque | ||
P | parse, pd, pensize, pi, pos, pu | pagelist, pick, power, pr (print), presentationmode, product, projectlist, projectvars | ||
Q | question | quotient | ||
R | random, readchar, remove, repeat, resett, round, rt (right), run | remainder, rerandom, rest, restore | ||
S | setc (setcolor), seth (setheading), se (sentence),setpensize, setpos, setsh (setshape), setsize, setx, sety, shape, show, sin, size, sqrt, st, stamp, stop, stopall | savepict, saveproject, saveshape, savetext, set, setbg, setinstruction, setinstrument, startup, stopme, sum | ||
T | tan, thing, timer, touching?, towards | tto (talkto), turtlesown | ||
U | unfreeze, unfreezebg | |||
W | wait, waituntil, who, word, word? | when | ||
X | xcor | |||
Y | ycor |