import java.util.*; import java.io.*; LibrarySystem = BookList UserList OpList StaffList. Book = "book:" Title "by" Author Publisher Year Subject "ISBN" ISBN CopyList. BookList = List(Book). Title = String . Author = String . Publisher =

String . Year = Integer . Subject = String . ISBN = Integer . COPYNO = Integer. UID = Integer. OpCode = int. PassWord = String. Copy = "copy" COPYNO [ User ] . CopyList = List(Copy). User = "user:" UID Status . Name = String String. UserList = List(User). Staff = "staff:" StaffCode. StaffList = List(Staff). StaffCode = Integer. Person : Staff | User *common* Name Address Phones. Address = "address:" Integer String ["#" Integer] "city:" String "state:" String Integer . Phones = "phones:" [ HomePhone ] [ WorkPhone ] [ Fax ] . Phone : HomePhone | WorkPhone | Fax *common* Integer "-" Integer . HomePhone = "home" . WorkPhone = "work" . Fax = "fax" . Status = "status:" Integer [ ItemList]. ItemList = List(Item). Item = Book Copy . Operation : Exit | ShowBooks | SearchBook | PrivOperation | Invalid *common* OpCode String. PrivOperation = PrivOperationWrapper. PrivOperationWrapper : ShowUsers | SearchUser | CheckBook | ActiveUsers. OpList = List(Operation). CheckBook : CheckOut | CheckIn . Invalid = "Invalid". ShowBooks = "ShowBooks". SearchBook = "SearchBook". ShowUsers = "ShowUsers". SearchUser = "SearchUser". CheckOut = "CheckOut". CheckIn = "CheckIn". Exit = "Exit". ActiveUsers = "ActiveUsers" . // Generic List(S) ~ "(" { S } ")" . //*visitors* // Visitors TAOVisitor : PrintUserV. PrintUserV = . PrintBooksV =.