*       COSC3308 Example Program-6              10/29/2002
*       1. Unevaluated expression (Unary *)
*       2. Functions returning a value.
*       3. BREAK() function which fails iff none of the given break
*          characters appears in the Subject string.
*            Subject = "Beautiful  Morning"
*            Subject Break(" :;")  .  output
*            Subject Break("?;:")  .  output
*            In the first pattern matching above, "Beautiful" will be printed.
*            In the second, pattern matching fails since none of the three break
*            characters appears in the subject string.
*       4. Conditional assignment operator (Binary .)
*       5. Tracing facility: To get diagnostic information about the execution
*          of the program without interfering with its logic or structure
*          the tracing mode is turned on by assigning a positive integer to the
*          keyword &Trace.
        &Trace = 20
*          When this mode is in effect, certain types of program actions can be
*          sensed, causing corresponding messges to be printed out.
*          &Trace is decremented by one each time trace action is done
*          (except when &Ftrace > 0 and a function is being traced at which
*           time, only &Ftrace is decremented instead) and tracing (possibly
*           other than the function tracing) stops when it becomes zero.
*       6. Types of actions sensed are:
*            a. change in the value of a variable: Default
                Trace('Head','Value')   ;* same as: Trace('Head')
                Trace('Char')           ;* same as Trace('Char','value')
                Trace('Ch')
*            b. call of a user-defined function
*               Trace('inter','Call')
*               trace('inter','function')       //Both calls and returns
*               &Ftrace = 100   //calls and returns of all user-defined
*                   functions as long as &Ftrace>0 and even when &trace=0
        &Ftrace = 10
*            c. return from a user-defined function
*               Trace('inter','return')
*               Trace('inter','Function')
*            d. transfer to a label
*               Trace('Loop','Label')
*                 a trace printout is made whenever a transfer is made to
*                 the label 'Loop' but not when the statement with that label
*                 is flowed into. Neither when the given label is a function
*                 entry point.
*            e. change in the value of certain keywords such as
*                 &errtype(Runtime Error code), &fnclevel(User-defined function
*                 call level, initially zero), &stcount(number of statements
*                 executed), &stfcount(Number of times statements have failed)
*                 Trace('stfcount','Keyword')
-Case 1         ;* Default:Case-folding (insensitive) 0 -> case-sensitive
        Universe = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
        Universe = 'abcdefghijklmnopqrstuvwxyz'  universe
        &TRIM = 1     ;* trim all trailing blanks off input strings
        &Dump = 1     ;* Values of variables(Natural) and unprotected keywords
*                        are listed at the end of program printout.
        define('inter(X,Y)')       
        define('NEG(X)')       
        Char =  Len(1) .  CH
*         Prefix =  Break(CH) .  Head  Len(1)
*         Above causes a syntax error: Null String in illegal context due to
*         CH being the Null string.
        prefix = *Break(ch)  .  Head  len(1)
*          same as: Prefix =  break(*Ch)  .  Head  len(1)
        Vowels = "aeiouAEIOU"
        Cons =   NEG(Vowels)
        Output = "Vowels are: " Vowels
        Output = "Consonants are: " Cons
Inputs  Word  =   Input                    :F(Done)
        Output =
        Output = "INPUT WORD IS: " Word
        Output = "VOWELS IN " Word " ARE: "  Inter(Word,Vowels)
        Output = "CONSONANTS IN " Word " ARE: "  Inter(Word,Cons)
+                                       :(Inputs)
*******************************************************
*	Function bodies follow	***
*         Function 'Inter(X,Y)'
Inter   X  Char =                       :F(RETURN)
        Y  CH                           :F(Inter)  ;* Y does not have it
        inter =  inter  CH              :(Inter)   ;* Y has it
*******************************************************
*         Function 'NEG(X)'
NEG     NEG = Universe
Loop    X  Char =                       :F(RETURN)
        Neg Prefix = Head               :(Loop)
Done    output =
        output = "NUMBER OF TIMES STATEMENTS FAILED::: " &StfCount
End
THISWORLDISFUN
THESUNRISESEVERYMORNING
!!!WhatAboutthisOne?????