AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Visual Prolog Download4/16/2021
Each fact is declared with the name used to signify the fact and the arguments that are used for the respective facts along with the domains that those arguments belong to.The essential algorithms of the tutorial are the same as those that were developed in Fundamental Prolog Part 2.
Visual Prolog How To Mark OutIt essentially comprises of understanding how to mark out the declarations from the definitions, and to indicate the main Goal that the program has to seek using specific keywords. For example, in the earlier tutorial the grandFather predicates clause was directly written using the traditional Prolog predicate head and body construction. Visual Prolog Code That SuchWe did not bother to inform the engine in the code that such a predicate construction is to be expected later. Similarly, before using any domains, they need to be declared. The reason such forewarnings are required in Visual Prolog is to ensure that runtime exceptions are converted into compile time errors as far as possible. For example, if you had intended to use an integer as the argument of a functor, and instead of the integer you had erroneously used a real number, it would become a runtime error in programs written using most other Prolog compilers and the program would fail there. When you declare the predicates and domains in advance, this kind of positional grammar (which argument belongs to which domain), etc. Therefore, when Visual Prolog performs a compilation, it checks the program quite thoroughly to weed out such grammatical and other mistakes. The programmer does not have to wait till the program is actually executed to detect a bug. In fact, those of you who are experienced in programming would understand what a life-saver this can be; often, the particular sequence of events that causes a runtime exception to happen may be so elusive that the bug may only turn up after several years, or it may manifest itself in some critical or other embarrassing situations. For example, there are keywords that differentiate the declarations from the definitions of predicates and domains. There is normally no keyword which signifies the ending of a particular section. The presence of another keyword indicates the ending of the previous section, and the starting of the next one. The code contained between these two keywords indicates the code to be used for a particular class. Those of you who do not understand the concept of a class can, for now, think of it as a module or a section of the overall program code. We are also giving the purpose behind these keywords, and the actual syntax can be easily learnt from the documentation. There are other keywords also in Visual Prolog, and those can easily be picked up in later tutorials and the documentation. Visual Prolog treats the code written between these two keywords as the code that belongs to one class. The name of the class MUST be given after the implement keyword. For example, if the string literal PDC Prolog is to be used in multiple locations throughout the code, then you can define a mnemonic (a short-form, easily remembered word) for the same thus. There are many variations for the syntax of such domain declarations, and they cater to the all the possible kinds of domains that would be used later on in the code. As this tutorial is a basic one, we shall not get into the finer details of the domain declarations that can be possible.
0 Comments
Read More
Leave a Reply. |