Lessons/Projects

From wiki.visual-prolog.com

Revision as of 08:40, 11 October 2024 by Adam Rose (talk | contribs) (small spelling mistakes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A Visual Prolog project represents an executable or DLL programmed in Visual Prolog. You can open a project in the IDE (Integrated Development Environment) and work on that project (i.e. executable/DLL).

The IDE will remember a list of the projects it has opened, so that you can easily reopen one of your projects. You can open several projects in each their IDE and work on them in parallel (should you want to).

When you have a project open in the IDE you can navigate to the source files that the target (i.e. executable/DLL) is built from, and you can edit them. In the IDE you can also build, execute and debug the target.

So your main interaction with the project will be through the IDE. The top-level information about the project is described in a project file (with extension vipprj). The IDE will maintain the project file, and you will not need to look into the file. But actually the project file is relatively easy to understand when you are familiar with the concepts of a project.

When you create a new project you give it a name and decide which directory that should contain the project. The project file and several other files will be created in this directory (and optionally sub-directories). You can choose among project templates for GUI programs, command line programs, etc.

Exercise Create a console project in the IDE.

After the project has been created it is automatically built (compiled, linked, etc). This will produce an initial version of your target. Since the project is just created the target is not really interesting at this point, but a side effect of building a project is that the compiler will gather a lot of browse information about the entities in the program.

The browse information enables the IDE to provide a lot of ways to navigate around in your code. In the project tree there will be a lot of nodes corresponding to the entities in your program (including what is included from PFC (Prolog Foundation Classes). And in the Go to menu you will find lots of navigation means most of which are based on the browse information.

Browse information becomes inaccurate when you edit files, because editing changed the positions where things are located. But upon a successful build of the project the browse information will again be accurate. Unsuccessful builds may however make some useful browse information disappear until the build is again successful. Therefore it is advisable to try to keep code as compilable as possible and build regularly.

Exercise Even though you currently does not know much about Visual Prolog examine the project tree in the project you created above, and try navigating around in it using the different entries in the Go to menu. Try to figure out what the different things do. And notice that many things have short-cut keys.
Exercise Watch the Hello World! video tutorial, which demonstrates the basic IDE features. The IDE in the video is from the older Visual Prolog version 7.3, so there are deviations from the current IDE, but the basics is the same and most of the details are also the same.
Exercise Read the tutorial Ide/Environment Overview which contains much more detailed information about the IDE. You may not get the full benefit from this tutorial now. So it may be a good idea to read it again at some later point.