;; Container = "(" ;; List(Item) int ")" . ;; Item : Container | Simple. ;; List(S) ~ {S}. ;; Simple = Ident int. ;; test case ;; ( //begin container 1: weight 6: over weight ;; apple 1 //item ;; ( //begin container 2; weight 2: over weight ;; pencil 1 //item ;; ( //begin container 3: weight 1 ;; apple 1 //item ;; 1) //capacity ;; orange 1 ;; 1) //capacity ;; orange 1 ;; kiwi 1 ;; 5) //capacity (define-struct Container (contents capacity)) (define-struct Simple (name weight))