;;;; mother modular generic compiler project
; (c)2001,2002/GPL Oskar Schirmer <oskar@scara.com>
; see file COPYING for GPL license details

; finite automaton scanner description for pl0
; according to N. Wirth, "Compilerbau", ISBN 3-519-32338-9

(finite-automaton
  '(
    (initial
      ((#\space #\newline #\tab #\return #\page)
                    #f get  #f initial #f)
      ((#\A . #\Z) #t  get pos word    #f)
      ((#\a . #\z) #t  get pos word    #f)
      ((#\0 . #\9) #t  get pos number  #f)
      (#\.          #f get pos initial period)
      (#\,          #f get pos initial comma)
      (#\;          #f get pos initial semicolon)
      (#\:          #f get pos colon   #f)
      (#\?          #f get pos initial question)
      (#\!          #f get pos initial exclamation)
      ((#\= #\#)   #t  get pos initial compare)
      ((#\< #\>)   #t  get pos compare #f)
      ((#\+ #\-)   #t  get pos initial add)
      ((#\* #\/)   #t  get pos initial mul)
      (#\(          #f get pos lparen  #f)
      (#\)          #f get pos initial rparen)
      (else         #f  #f  #f #f      #f)
    )
    (word
      ((#\A . #\Z) #t  get  #f word    #f)
      ((#\a . #\z) #t  get  #f word    #f)
      ((#\0 . #\9) #t  get  #f word    #f)
      (else         #f  #f  #f initial word)
    )
    (number
      ((#\0 . #\9) #t  get  #f number  #f)
      (else         #f  #f  #f initial number)
    )
    (colon
      (#\=          #f get  #f initial be)
      (else         #f  #f  #f initial colon)
    )
    (compare
      (#\=         #t  get  #f initial compare)
      (else         #f  #f  #f initial compare)
    )
    (lparen
      (#\*          #f get  #f comment #f)
      (else         #f  #f  #f initial lparen)
    )
    (comment
      (#\*          #f get  #f commen2 #f)
      (else         #f get  #f comment #f)
    )
    (commen2
      (#\)          #f get  #f initial #f)
      (#\*          #f get  #f commen2 #f)
      (else         #f get  #f comment #f)
    )
  )
)
