SMALL-X(ID:7644/)References: DOI Extract: The small-X Language The small-X Language The small-X programming language has only 1 kind of statement. The statement is called a rule and consists of 2 parts. The first part, called the IF-part consists of a conditional expression. The second part consists of actions that are carried out when the conditional expression of the first part is evaluated to be true. The second part is called the THEN-part. The conditional expression of the IF-part tests the contents of a global memory that is used to store data objects such as integers, real numbers, strings, and lists. The actions of the THEN-part manipulate this global memory by adding data objects, performing computations, or doing input/output operations. Tests that can be carried out in an IF-part include the arithmetic tests(=, <=, <, >=, >, <>), a test to see if a data object is contained in global memory, list comparison, string comparison, and list membership. In addition, small-X has a special matching feature for list type data objects. A small-X action can be used to add or remove a data object from global memory. Another action provided allows variables to be assigned values from simple computations. The kinds of computations that can be performed include arithmetic operations(+,-,*,/), string concatenation, list concatenation, deletion, and element selection. In addition to computation, there are actions that will request data and actions that will display data. These actions allow small-X to fill variable values as an expert system is running. in SIGPLAN Notices 20(10) October 1985 view details Goals for Small-X What are the underlying goals for implementing the Small-X language and its environment ? Why implement the Small-X language when other language processor implementations exist do what Small-X is intended to do? Currently there is no system that can be obtained easily or inexpensively that would allow microcomputer programmers or experimenters to prototype small expert systems. Systems do exist for expert system development, for example EMYCIN, OPSS, KAS, EXPERT, RLL, and M.l, but most are not readily available to experimenters because they are either very costly, are not generally distributed, or require hardware that is too large or too costly to obtain. Small-X is a system that is being designed with the microcomputer user in mind to fill the need for a means of experimenting with these systems on a small scale. It is a language specifically designed to implement prototype expert systems. The language has been kept simple so that expert programmers as well as novice programmers may easily learn it to explore the capabilities of expert systems. When completed it will be ported to various personal computers. Current target machjnes include the IBM PC and the DEC Rainbow. The interpreter and its environment will be kept as small and as simple as possible with no sacrifice to the expressiveness of the language. The Small-X language consists of 9 commands, a rule statement, and 8 actions[...]. The kinds of rules that can be written in systems such as OPS5 and EMYCIN can also be expressed in Small-X. In order to make Small-X easy to use and learn, an editor is being provided as part of the Small-X environment. It is invoked directly from the Small-X interpreter and is used by the Small-X programmer to create Small-X rule programs. Built into the editor is a syntax checking mechanism that allows the user to write Small-X rules and then syntax check them. The editor will provide correct syntax in the event of a syntax error. Extract: The Small-X Language The Small-X Language Elements of the Small-X language can be classified into three categories. There are commands, rules, and actions. Commands are used to control the interpreter. Most of the commands consist of one word or one word and an argument. They include: 4.1 Small-X Commands RULES - sends the interpreter into a state to accept rules. As rules are entered they are syntax checked and entered into rule memory. STM - causes the interpreter to go into short term memory state. This state allows the user to modify or examine the contents of the short term memory. EXIT - terminates the Small-X interpretor. ENGINE - starts the Small-X inference engine. (runs a Small-X program) EDIT - invokes the Small-X editor. SAVE filename - saves the rules in currently rule memory in a named file. READ filename - restores the contents of rule memory from a previously saved or edited rule file. REMEMBER filename - restores the contents of the short term memory from a file. MEMORIZE filename - saves the current contents of short term memory in a file. The SAVE, READ, REMEMBER, and MEMORIZE commands are used to create f ilrs of the current rule or global memory and to retrieve these files and restore them to working memory. This will allow a Small-X programmer to save a Small-X session at a particular point and restart it from that point at a later time. The files produced are ASCII text files so they may be listed and edited if necessary. 4.2 Small-X Rules The rule of Small-X has the following syntax: IF A The Data types that can be manipulated in rules and actions include symbols (in the LISP sense), real numbers, integers, strings, lists, and sets. When a rule is entered into the Small-X interpreter it is translated, given a unique rule name and saved in rule memory. It can be edited in memory with the Small-X editor. 4.3 Small-X Actions Small-X actions manipulate short term memory or variables. Variables are named areas of short term memory. Actions include: ADD operand - adds the object specified by operand to short term memory REMOVE operand - deletes the object specified from short term memory READ variable - reads a value into a variable from the terminal READ string variable - displays the string, then reads a value into a variable from the terminal WRITE operand - writes the value from a variable to the terminal WRITE-NEW-LINE - writes a new line on the terminal COMPUTE expression - computes the value of an expression BIND variable operand - gives a variable a specified value UNBIND variable - leaves the variable in short term memory but marks it as having no value HALT - stops the inference engine and returns to Small-X command mode in SIGPLAN Notices 20(10) October 1985 view details in SIGPLAN Notices 20(10) October 1985 view details |