13.2. Building Blocks

The fundamental elements of Logikus are structures and variables. As a logic programmer, you will learn to weave structures and variables together into rules and then to combine rules to form logic programs.

13.2.1. Structures

A structure is the basic data repository in a logic language. A structure is a functor associated with a group of terms. A functor can be a lowercase string, a quoted string, or a number. Some acceptable functors are

jamesCagney 

starred

"Yankee Doodle Dandy"

1942

In addition to having a functor, each structure possesses a collection of zero or more terms. A structure with no terms is an atom. When a structure has terms, they must be structures and variables, separated by commas and enclosed in parentheses. ...

Get Building Parsers with Java™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.