ARL Master Index


ARL Coding Conventions

The Able Rule Language is entirely free-form, but there are some conventions you must follow when writing ARL statements. This section describes various components of the rule language and how to code them.

On this page...


Comments

A comment may appear in only two places: on a line by itself or at the end of a line containing a rule language statement. Comments may be delimited by a beginning // (slash-slash) or a beginning ; (semicolon). There is no terminating delimiter. The following lines all demonstrate valid comments:


    //------------------------------------
    // These comments are on lines by
    // themselves.
    //------------------------------------
    ;Comment using semicolon.

    a = b    ; Comment at end of line
    c Is d  // Comment at end of line
     
Return to top

White space

White space (blanks, tabs, newlines, etc.) may be sprinkled freely throughout a source file. They are all ignored. The following two rule statements are parsed identically:


    rule_001: if Temperature is slightly elevated then Pressure is positively moderate

    rule_002
      :
      if
        Temperature is slightly elevated
      then
        Pressure is positively moderate
     
Return to top

Keywords

Rule language keywords are not case sensitive. For example, the keyword true may be entered as any of true, True, tRue, TRUE, and so on. You may not use any keyword as an identifier.

Some of the longer keywords have alternate forms. The following table identifies those keywords along with their alternate forms:

Keywords and their Alternate Forms
Complement Comp
InputVariables InputVars, InputVar, Input
OutputVariables OutputVars, OutputVar, Output
SetDefinitions SetDefs, SetDef
UserDefinedFunctions UserFunctions, UserFunction, Udfs, Udf
UserDefinedTypes UserDataTypes, UserTypes, UserType, Types, Type

In addition to the above reserved keywords, the following tables identify other, reserved, keywords (all case insensitive):

Reserved Keywords
Options related
AlphaCut
CorrelationMethod
DefuzzifyMethod
InferenceMethod
Predicates
GoalPredicates
Import
Correlation methods
Product
Minimum
Defuzzify methods
Centroid
MaxHeight
Inference methods
Backward
Forward
Forward2
Forward3
Mixed
Predicate
Script
 
FuzzyAdd
MinMax
ProductOr
Variable related
Boolean
Categorical
Continuous
Discrete
Fuzzy
List
Numeric
Object
String
 
Static
Fuzzy set related
Beta
Gaussian
Linear
Pi
Segments
Shoulder
Sigmoid
Trapezoid
Triangle
 
Down
Left
Right
Up
Hedges
About
Above
Below
CloseTo
Extremely
Generally
InVicinityOf
Not
Positively
Slightly
Somewhat
Very
Rule related
And
Do
Else
If
Is
Then
When
Miscellaneous
False
GoalVariable
Rules
RuleSet
True
Variables
 
Idle
Init
Main
Return to top

Identifiers

Identifiers are the names of things that you define; for example, variables names, fuzzy set names, and rule labels that you create are all identifers.

Identifiers are case sensitive. For example, if you define a continuous variable with the name of myVar you cannot later refer to that variable as MYvar as the latter name is taken to refer to a completely different variable that might be of a different type (if it exists at all).

Identifiers are composed of alphabetics (a-zA-Z), numerics (0-9), and the characters _ (underscore) and $ (dollar). Numeric characters cannot be used to begin an identifier.

Note: Prior to release 1.2c identifers could contain the character . (dot). This is no longer true as the dot character is used to separate two identifiers making up a variable-reference / field-reference pair, as in foo.bar.

The following are all valid identifiers:


    thisIsVar1
    this_Is_var_2
    foo$
    $foo
     

The following are examples of illegal identifiers:


    IsVar.1     // Contains a dot
    9foo        // Begins with a number
     
Return to top

Boolean Literals

Boolean literals are simply the keywords true and false, case insensitive.


    someVariable Boolean(True)
    if someVariable == true ...
     
Return to top

Numbers

Numbers may be entered with a leading + (plus) or - (minus) sign. Numbers between -1 and +1 must be entered with a leading zero before the decimal point. The following are all valid:


    0.55         -0.55         +0.55
    100          -100          +100
    +100.00       0.001        -36.99
     

The following are examples of illegal numbers:


    .56     // No zero before the decimal point
    -.05    // No zero before the decimal point
     
Return to top

Lists

Most lists can be entered with each element separated by any amount of whitespace, a comma, or both. The following are all valid:


    myFuzzyVar is positively very very Hot
    myFuzzyVar is positively very, very Hot
    myFuzzyVar is positively very,very Hot
    myFuzzyVar is positively, very, very, Hot

    myCatVar Categorical("a" "9" "d" "4.7" "F")
    myCatVar Categorical("a","9","d","4.7","F")

    myCatVar Categorical("a",   "9",   "d",   "4.7",   "F")

    myCatVar Categorical(     // List on multiple lines    
                         "a",
                         "9",
                         "d",
                         "4.7",
                         "F"
                        )
     
Return to top

Strings

Strings are delimited by double quotes ("") and may contain certain whitespace characters. Strings are always case sensitive. The following lines all demonstrate valid strings:


    myCatVar    Categorical( "Abc",  "Def ghi" )
    myStringVar String("This is a string variable with a long initial value.")

    R01:  myStringVar = "This is another string value"
     
Return to top
Able Rule Language master index.
Able RuleSet Editor master index.
Rule package table of contents.

Last modified: Fri Sep 21 14:21:18 Central Daylight Time 2001