Contents    Page-10    Prev    Next    Page+10    Index   

Physics Problems[file physgram.lsp]


(def lexicon
 '((propname (radius diameter circumference area
	      volume height velocity time
	      weight power height work speed mass))
   (a/an     (a an))
   (the/its  (the its))
   (objname  (circle sphere fall lift))   ))

(def grammar '(
  (param     -> ((the/its)? (propname)) $2)
  (quantity  -> ((number)) $1)
  (object    -> ((a/an)? (objname) with (objprops))
                   (cons 'object (cons $2 $4)))
  (objprop   -> ((a/an)? (propname) of ? (quantity))
                   (list $2 $4))
  (objprop   -> ((propname) = (quantity))
                   (list $1 $3))
  (objprops  -> ((objprop) and (objprops))
                   (cons $1 $3))
  (objprops  -> ((objprop))  (list $1))
  (s         -> (what is (param) of (object))
                   (list 'calculate $3 $5))   ))