ATN Written in Lisp

Using a few simple functions and conventions, it is easy to write ATN-like programs directly in Lisp. Each grammar rule becomes a Lisp function.

(DEFUN < phrase-name>  ()
  (LET (< local variables> )

    (SAVEPTR)   ; always the first action

    (IF (AND (CAT < category> )
          ; to test parts of speech
             (NEXT)  ; move to next word
             ... )
        (PROGN (SUCCESS)  ; it worked
               < semantics>  )
        (FAIL)) ))  ; parsing failed

Results may be either returned or stored in global registers or database as a side effect.

Contents    Page-10    Prev    Next    Page+10    Index