HELP REVISEPOP A.Sloman May 1997 Last updated Fri May 23 17:39:21 BST 1997 CONTENTS -- Introduction -- Use of the editor -- Revising Pop-11 -- -- The primer -- -- Things you should already know -- -- List processing and recursion -- -- Graphics -- -- Object oriented programming -- -- Rule based programming -- -- Sim_agent toolkit -- Debugging and profiling tools -- Programming style -- Getting help via the poplog-users email list -- Using Poplog at home on your PC -- Introduction ------------------------------------------------------- This file is for students who have learnt some Pop-11 and are thinking of using it for an AI project, either for an MSc summer project or a third year undergraduate project. For some suggestions regarding AI projects see TEACH PROJECTS and other files referred to therein. The possibilities are endless. For guidance on thinking about how to design your project in the early stages see TEACH PROPOSALS. For guidance on how to write up an a project see TEACH REPORTS and TEACH PSTYLE. You may get different advice from different tutors. Pay attention to your supervisor! Why use Pop-11? Pop-11 is a very powerful and flexible language with many facilities that can enable you to develop a complex program far more quickly than if you use C or C++ (except for projects where the design requirements are totally clear in advance and Pop-11's flexibility and incremental compilation features are not required). The only other language I know of that is comparable in power and flexibility is Common Lisp, which some people find a bit harder to learn. We have a common lisp system implemented in the Poplog environment, if that's the language you want to use. See HELP CLISP The rest of this file is about using Pop-11. Most of our students have learnt only a small subset of Pop-11 and will need to do some revision and extension of their understanding in order to use the language effectively for project work. Learning more of the language may also help you develop a better understanding of the design options for your project, so you are advised to do some revision and "bottom up" learning at an early stage, instead of first designing your project and then finding out what language features you need to implement your design. Students who have done a one or two term course on Pop-11 and are thinking of using it as the language for their project work may find the following suggestions useful. Usually after the initial course students have grasped only a small subset of the language. Some students will also have learnt other languages and have a lot of programming experience, and their main requirement is to learn what Pop-11 has to offer, some of which they will have met in other forms. Students who had not previously done any programming before starting Pop-11 will probably need practice extending their general grasp of programming concepts and techniques as well as learning more about the specifics of Pop-11. The suggestions below are offered primarily for the students who had not previously learnt any programming before starting Pop-11, but they may also be useful for those who have additional programming experience. -- Use of the editor -------------------------------------------------- It is very important to be fluent at using the editor either as VED or XVED, so that you can take full advantage of its hypertext facilities for following up cross references and the interactions between editor and compiler. If you know how to read and send mail in VED you can also more easily report programming problems and try out examples sent to you by email without laborious cutting and pasting between another editor and Pop-11. To revise the editor read TEACH VEDNOTES (you should have a printed version of that), and if necessary also HELP MARK, HELP LMR, HELP VED_GETMAIL, HELP VED_REPLY, HELP VED_RESPOND, HELP SEND See also HELP VED_PROCHEADER, HELP VED_FILEHEADER If there is any editor function or key-mapping that you don't like it may be possible to change it, since VED is programmable in Pop-11. Ask for help. (Or look in REF VEDPROCS, REF VEDVARS, REF VEDCOMMS, REF VEDTERMINALS) If you are a fluent Emacs user it is possible to use Pop-11 via Emacs, though the interface is not so smooth and the online documentation does not work so well. Ask for help if you wish to do that. -- Revising Pop-11 ---------------------------------------------------- -- -- The primer Re-read the Pop-11 primer (available in the school office), including the preface. The primer gives an overview of many of the core ideas of the language and you will probably understand a lot more of it now than when you were previously learning Pop-11. However it is important to remember that the primer does not give a complete overview of Pop-11. In particular it does not include most of the more sophisticated facilities such as o the external language interface, o interface to the operating system and file system, o Pop-11 processes o sockets and pipes for communicating with other processes, o Active variables o The use of dlocal to specify "exit" actions o the interface to the X window system, o object oriented programming facilities, o facilities for developing compilers or extending Pop-11 (macros and syntax words) o profiling and debugging tools o rc_graphic and the new graphical facilities built on top of that (LIB RCLIB) o Poprulebase o The sim_agent toolkit and many of the utilities and tools in the libraries. The primer does provide an overview of the core of the language which provides the basis for everything else. -- -- Things you should already know From your previous work (and re-reading the primer) you should already have learnt about: defining procedures use of global and local variables, including input and output variables conditional expressions, including multi-branch conditionals use of both IF and UNLESS various kinds of looping constructs repeat for x in list do... for x from start by increment to finish do ... until foreach forevery and possibly others. See HELP LOOPS how procedure calls are executed using the Pop-11 stack see TEACH STACK use of readline to interact with the user (See TEACH READLINE) (There are additional mechanisms if readline proves too restrictive, e.g. using character based input or item based input.) the basic syntax for constructing lists, and something about what lists are: see TEACH LISTS, TEACH BOXES use of the pattern matcher to operate on lists See HELP MATCHES, HELP READPATTERN (on use of "!") some of the Pop-11 database facilities some of you will also have had an introduction to poprulebase (See below) some of you will have started on objectclass (See below) The following work will help you revise your grasp of the above as well as extending your knowledge and skill. -- -- List processing and recursion Brush up your list processing and grasp of recursion. This is very important. There is a collection of teach files which give you lots of practice on techniques for constructing, comparing and searching in lists as well as learning how to write various kinds of recursive programs, which can sometimes be more powerful than looping programs. These techniques can be extremely useful in AI projects where you are creating lots of structures of different "shape" and comparing and analysing them, for instance parse trees, logical formulas, proofs, plans, etc. Try working through as many of these as you can find time for, but ask for help if you get stuck. Ask other students, and if necessary send messages to the poplog-users email list (see below). TEACH RECURSION TEACH SETS TEACH SETS2 Some of the later exercises are very difficult, so don't be surprised if you find them hard. There are files with answers. When you have completed a set of exercises and want to know where the answer files are so that you can check out your work, email a.sloman. -- -- Graphics It can be very useful to produce graphical output or to use a graphical interface to a complex program. For introductions to Pop-11's graphical facilities see TEACH GSTART basic graphics TEACH RCLIB_DEMO.P using buttons, menus, control panels, etc. TEACH RC_GRAPHPLOT Introduces a Pop-11 library for drawing graphs of functions and data, with axes and annotations. See HELP*RC_GRAPHPLOT for a summary. HELP RCLIB A more general overview -- -- Object oriented programming For many purposes an object oriented programming style can be a great help. TEACH OOP Basic introductory overview TEACH OBJECTCLASS_EXAMPLE a gentle introduction to OOP with simple examples TEACH ADVENT_OBJECTCLASS ideas for an adventure game using OOP -- -- Rule based programming TEACH RULEBASE And more details in HELP POPRULEBASE and other files HELP PRB_DATABASE Gives warnings and advice about differences between poprulebase and the Pop-11 database -- -- Sim_agent toolkit TEACH SIM_AGENT Introductory overview TEACH SIM_DEMO Detailed example showing how to use the toolkit facilities -- Debugging and profiling tools -------------------------------------- Later you may find it useful to know about facilities for tracing, debugging and profiling (finding out how much time is spent in various parts of your program). These are described in TEACH TRACE HELP TRACE Introduces the simplest tracing tool. Probably useful for everyone to know about HELP DEBUGGER For more sophisticated debugging. Find out about this when you start getting very obscure bugs and you cannot track them down easily. HELP PROFILE Shows how to find out how much time is being spent in different procedures. You may get some surprises. See also HELP EFFICIENCY -- Programming style -------------------------------------------------- There are usually many different ways of writing programs and people have different views on what counts as good programming style. There is a file HELP PROGSTYLE which includes a lot of recommendations which may be helpful. At least if you don't like them you can think about why not, and thereby learn something. This may be worth reading after you have produced a first draft version of most of your program. It could give you ideas regarding where you could improve your design. If you read it before starting it may not make much sense to you. -- Getting help via the poplog-users email list ----------------------- There is an email list for people using Pop-11 or other Poplog facilities, and if you have a problem that you cannot solve you can ask for help via the email list. Send your message to poplog-users Try to be very precise about what the problem is including, if possible the exact Pop-11 commands you used that caused the problem and the program's output include error messages. If necessary give a pointer to the file containing your program. If you are luck someone on the list will know the answer and send a reply to the list and to you. By joining the list you can read the questions and the replies, and that can be a useful form of learning. To join the list, send a message addressed to majordomo containing one line saying subscribe poplog-users -- Using Poplog at home on your PC ------------------------------------ If you have a PC with at least 16 Mbytes of memory and if you have installed a version of the linux operating system then you can get a version of Poplog that will run under linux. However there will be a charge of about 50 pounds for the Poplog licence, though I am not sure. In addition, if you wish to use the graphical facilities in Poplog you will need to get a motif licence for linux, which unfortunately also costs money. There is an older free version of Poplog for linux. see HELP LINUX for details. [to be continued - perhaps] --- $poplocal/local/help/revisepop --- Copyright University of Birmingham 1997. All rights reserved. ------