;; *****************************************************************************************
;; This file contains all syntax definitions used in the lisp debugger ,
;; to automatical generate code to transform lisp code in debugged lisp code
;; 
;; Be very carefull to edit or modify this file , if you generate code form a modified 
;; file via (process-definition-file "lispsyntax") and load then the generated 
;; compiled file in the lisp debugger the working of the debugger is changed.
;; ****************************************************************************************
;;
;; Defintions used throughout this file 
;;
;; *****************************************************************************************
;; Body's used in different definitions
;; *****************************************************************************************

body-1 = {{(declare {_declaration}*) {"string" @ | @} |
           "string" {(declare {_declaration}*) @ | @} |
           @}
          {#form}*}

body-2 = {{(declare {_declaration}*) | @} {#form}*}

body-3 = {{(declare {_declaration}*) | #form} {#form}*}

;; *****************************************************************************************
;; Lambda list definitions
;; *****************************************************************************************

lambda-list = ({~var}*
               [&optional {~var | (~var [#initform [~svar]])}*]
               [&rest ~var]
               [&key {~var | ({~var | (_keyword ~var)} [#initform [~svar]])}*
                     [&allow-other-keys]]
               [&aux {~var | (~var [#initform])}*])

specialized-lambda-list = ({~var | (~var _parameter)}*
                           [&optional {~var | (~var [#initform [~svar]])}*]
                           [&rest ~var]
                           [&key {~var | ({~var | (_keyword ~var)} [#initform [~svar]])}*
                                 [&allow-other-keys]]
                           [&aux {~var | (~var [#initform])}*])

;; ****************************************************************************************
;; Option used in CLOS definitions
;; ****************************************************************************************

option = {(:method {_method-qualifier}* specialized-lambda-list  body-1) |
          _other}

;;*****************************************************************************************
;; slot-entry , used in CLOS definitions
;; ****************************************************************************************


slot-entry = {~slot-name | (~var _slotname)}



;; *****************************************************************************************
;;
;; This file contains syntax definitions for
;;
;; and
;; assert
;; block
;; case
;; catch
;; ccase
;; compiler-let
;; cond
;; ctypecase
;; decf
;; defclass
;; defgeneric
;; define-method-combination (deactivated , from my humble knowledge of lisp this like defmacro so it shouldn't be debugged)
;; defmethod
;; defun
;; destructuring-bind
;; do
;; do-symbols
;; do-external-symbols
;; do-all-symbols
;; do*
;; dolist
;; dotimes
;; etypecase
;; eval-when
;; flet
;; generic-flet
;; generic-function
;; generic-labels
;; if
;; incf
;; ignore-errors
;; handler-case
;; handler-bind
;; labels
;; lambda
;; let
;; let*
;; locally
;; loop
;; macrolet
;; mapping (defined but not yet tested because of no implementation of series)
;; multiple-value-bind
;; multiple-value-call
;; multiple-value-list
;; multiple-value-prog1
;; multiple-value-setq
;; nth-value
;; or
;; pprint-logical-block (defined but not yet tested because of no knowledge of how to use)
;; prog
;; prog*
;; prog1
;; prog2
;; progn
;; progv
;; psetf
;; psetq
;; push
;; pushnew
;; return
;; return-from
;; setf
;; setq
;; symbol-macrolet
;; tagbody
;; the
;; throw
;; unless
;; unwind-protect
;; when
;; with-accessors
;; with=added-mehtods (defined but not tested because not implemented in the lisps I know)
;; with-compilation-unit
;; with-hash-table
;; with-input-from-string
;; with-open-file
;; with-open-stream
;; with-output-to-string
;; with-package-iterator
;; with-simple-restart
;; with-slots
;; **************************************************************************************************************

;; **************************************************************************************************************
;; and (and {form}*)
;; **************************************************************************************************************

(and {#form}*)

;; **************************************************************************************************************
;; assert ,  assert test-form [({place}*) [string {arg}*]]
;; **************************************************************************************************************

(assert #form [_place [#string {#arg}*]])

;; **************************************************************************************************************
;; block (block name {form}*)
;; **************************************************************************************************************

(block _name {#form}*)

;; **************************************************************************************************************
;; case  case keyform {({({key}*) | key} {form}*)}*
;; **************************************************************************************************************


(case #keyform {({({_key}*) | _key} {#form}*)}*)

;; **************************************************************************************************************
;; catch  catch tag {form}*
;; **************************************************************************************************************

(catch _tag {#form}*)

;; **************************************************************************************************************
;; ccase keyplace {({({key}*) | key} {form}*)}*
;; **************************************************************************************************************

(ccase _keyplace {({({_key}*) | _key} {#form}*)}*)

;; **************************************************************************************************************
;; compiler-let   compiler-let ({var | (var [value])}*) {form}* 
;; **************************************************************************************************************

(compiler-let ({_var | (_var [_value])}*) {#form}*)

;; **************************************************************************************************************
;; cond  cond {(test {form}*)}*
;; **************************************************************************************************************

(cond {(#test {#form}*)}*)

;; **************************************************************************************************************
;; decf place [delta]
;; **************************************************************************************************************

(decf _place [#delta])

;; **************************************************************************************************************
;; defclass
;; defclass class-name ({superclass-name}*)
;;          ({slot-specifier}*) [[?class-option]]
;;
;;
;; class-name ::= symbol
;; superclass-name ::= symbol
;; slot-specifier ::= slot-name | (slot-name [[?slot-option]])
;; slot-name ::= symbol
;; slot-option ::= {:reader reader-function-name}*
;;                 | {:writer writer-function-name}*
;;                 | {:accessor reader-function-name}*
;;                 | {:allocation allocation-type}*
;;                 | {:initarg initarg-name}*
;;                 | {:initform form}*
;;                 | {:type type-specifier}*
;;                 | {:documentation string}*
;; reader-function-name ::= symbol
;; writer-function-name ::= function-name/
;; function-name ::= {symbol | (setf symbol)}
;; initarg-name ::= symbol
;; allocation-type ::= :instance | :class
;; class-option ::= (:default-initargs initarg-list)
;;                 | (:documentation string)
;;                 | (:metaclass class-name)
;; initarg-list ::= {initarg-name default-initial-value-form}*
;; **************************************************************************************************************

(defclass _class-name _superclass
          ({slot-specifier}*)
          [class-option]*)

slot-specifier = {(_name {slot-option}*)|_name}
slot-option = {:initform #form |
               _other _other}
class-option = {(:default-initargs {_initarg #form}*) | _other}

;; **************************************************************************************************************
;; defgeneric 
;;
;;defgeneric function-name lambda-list 
;;              [[?option | {method-description}*]]
;;function-name ::= {symbol | (setf symbol)}
;;lambda-list ::= ({var}* 
;;                 [&optional {var | (var)}*]
;;                 [&rest var] 
;;                 [&key {keyword-parameter}* 
;;                       [&allow-other-keys]])
;;keyword-parameter ::= var | ({var | (keyword var)}) 
;;option ::= (:argument-precedence-order {parameter-name}+)
;;                 | (declare {declaration}+) 
;;                 | (:documentation string)
;;                 | (:method-combination symbol {arg}*)
;;                 | (:generic-function-class class-name)
;;                 | (:method-class class-name)
;;method-description ::= (:method {method-qualifier}*
;;                         specialized-lambda-list
;;                         [[ {declaration}* | documentation ]]
;;                         {form}*)
;;method-qualifier ::= non-nil-atom 
;;specialized-lambda-list ::=      ({var | (var parameter-specializer-name)}*
;;                                  [&optional {var | (var [initform [supplied-p-parameter]])}*]
;;                                  [&rest var]
;;                                  [&key {specialized-keyword-parameter}*
;;                                        [&allow-other-keys]]
;;                                  [&aux {var | (var [initform])}*])
;;specialized-keyword-parameter ::=   var | ({var | (keyword var)} [initform [supplied-p-parameter]])
;; parameter-specializer-name ::= symbol | (eql eql-specializer-form)
;; **************************************************************************************************************

(defgeneric _name _lambda-list {option}*)

;; **************************************************************************************************************
;; define-method-combination
;; define-method-combination name [[?short-form-option]]
;; define-method-combination name lambda-list
;;                           ({method-group-specifier}*)
;;                           [(:arguments . lambda-list)]
;;                           [(:generic-function generic-fn-symbol)]
;;                           [[{declaration}* | doc-string]]
;;                           {form}*
;; short-form-option ::= :documentation string
;;                     | :identity-with-one-argument boolean
;;                     | :operator operator
;; method-group-specifier ::= (variable {{qualifier-pattern}+ | predicate}
;;                             [[?long-form-option]])
;; long-form-option ::= :description format-string
;;                    | :order order
;;                    | :required boolean
;; **************************************************************************************************************
;; Deactivated , could not find usefull example to test this (I am not a specialist of CLOS
;; (define-method-combination _name {:documentation _string |
;;                                  :identify-with-one-argument _boolen |
;;                                  :operator _operator |
;;                                  lambda-list ({method-group-specifier}*)
;;                                              {argument-lambda-list (:generic-function _fn) body-1 |
;;                                               (:generic-function _fn) body-1 |
;;                                               body-1}}) 
;;
;;
;; method-group-specifier = (~var {_rest}*)
;; argument-lambda-list = (:arguments {~var}*
;;                                   [&optional {~var | (~var [#initform [~svar]])}*]
;;	                           [&rest ~var]
;;	                           [&key {~var | ~var ({~var | (_keyword ~var)} [#initform [~svar]])}* [&allow-other-keys]]
;;	                           [&aux {~var | (~var [#initform])}*])
;;				   

;; **************************************************************************************************************
;; defmethod
;; defmethod function-name {method-qualifier}*
;;           specialized-lambda-list
;;           [[ {declaration}* | doc-string]]
;;           {form}*
;; function-name ::= {symbol | (setf symbol)}
;; method-qualifier ::= non-nil-atom 
;; parameter-specializer-name ::= symbol | (eql eql-specializer-form)
;; **************************************************************************************************************


(defmethod _function-name 
           {_method-qualifier}* 
           specialized-lambda-list 
	   body-1)

;; **************************************************************************************************************
;; defun
;;  defun name lambda-list [[ {declaration}* | doc-string ]] {form}*
;; ({var}*
;;  [&optional {var | (var [initform [svar]])}*]
;;  [&rest var]
;;  [&key {var | ({var | (keyword var)} [initform [svar]])}* [&allow-other-keys]]
;;  [&aux {var | (var [initform])}*])
;; **************************************************************************************************************

(defun _name lambda-list body-1)

;; **************************************************************************************************************
;;  destructuring-bind lambda-list expression {declaration}* {form}*
;; **************************************************************************************************************

var-list = {~var | ({var-list}*)}
macro-lambda-list = ({&whole ~var
                      [var-list]*
                      [&optional {~var | (~var [#initform [~svar]])}*]
	              [{&rest ~var | &body ~var}]
	              [&key {~var | ({~var | (_keyword ~var)} [#initform [~svar]])}* [&allow-other-keys]]
	              [&aux {~var | (~var [#initform])}*] 
                     |
                      [var-list]*	
                      [&optional {~var | (~var [#initform [~svar]])}*]
	              [{&rest ~var | &body ~var}]
	              [&key {~var | ({~var | (_keyword ~var)} [#initform [~svar]])}* [&allow-other-keys]]
	              [&aux {~var | (~var [#initform])}*]
                     }
                    )

(destructuring-bind macro-lambda-list #expression body-2)

;; **************************************************************************************************************
;; do 
;; do ({(var [init [step]])}*)
;;    (end-test {result}*)
;;    {declaration}* {tag | statement}*
;;
;; **************************************************************************************************************

(do ({(~var [#init [#step]])}*)
    (#end-test {#result}*)
    body-2)

;; **************************************************************************************************************
;; do*
;; do* ({(var [init [step]])}*)
;;     (end-test {result}*)
;;     {declaration}* {tag | statement}* 
;; **************************************************************************************************************


(do* ({(^var [#init [#step]])}*)
     (#end-test {#result}*)
     body-3)

;; **************************************************************************************************************
;; do-all-symbols 
;; do-all-symbols (var [package [result-form]])
;;                {declaration}* {tag | statement}*
;; **************************************************************************************************************

(do-all-symbols (~var [#package [#resultform]]) body-2)

;; **************************************************************************************************************
;; do-external-symbols 
;; do-external-symbols (var [package [result-form]])
;;                     {declaration}* {tag | statement}*
;; **************************************************************************************************************

(do-external-symbols (~var [#package [#resultform]]) body-2)

;; **************************************************************************************************************
;; dolist
;; dolist (var listform [resultform])
;;        {declaration}* {tag | statement}*
;; **************************************************************************************************************

(dolist (~var #listform [#resultform]) body-2)

;; **************************************************************************************************************
;; dotimes
;; dotimes (var countform [resultform])
;;         {declaration}* {tag | statement}*
;; **************************************************************************************************************

(dotimes (~var #countform [#resultform]) body-2)

;; **************************************************************************************************************
;; do-symbols 
;; do-symbols (var [package [result-form]])
;;            {declaration}* {tag | statement}*
;; **************************************************************************************************************

(do-symbols (~var [#package [#resultform]]) body-2)


;; **************************************************************************************************************
;; ecase keyform {({({key}*) | key} {form}*)}*
;; **************************************************************************************************************

(ecase #keyform {({({_key}*) | _key} {#form}*)}*)

;; **************************************************************************************************************
;;  etypecase keyform {(type {form}*)}*
;; **************************************************************************************************************

(etypecase #keyform {(_type {#form}*)}*)

;; **************************************************************************************************************
;; ctypecase keyplace {(type {form}*)}*
;; **************************************************************************************************************

(ctypecase _keyplace {(_type {#form}*)}*)

;; **************************************************************************************************************
;;  eval-when ({situation}*) {form}*
;; **************************************************************************************************************

(eval-when _situation {#form}*)

;; **************************************************************************************************************
;; flet
;; flet ({(name lambda-list
;;              [[ {declaration}* | doc-string ]] {form}*)}*)
;;       {form}* 
;; **************************************************************************************************************

(flet ({(_name lambda-list body-1)}*) {#form}*)

;; **************************************************************************************************************
;; if 
;;  if test then [else] 
;; **************************************************************************************************************

(if #test #then [#else])

;; **************************************************************************************************************
;; generic-flet ({(function-name lambda-list
;;                 [[?option | {method-description}* ]])}*)
;;              {form}*
;; **************************************************************************************************************

(generic-flet ({(_name _lambda-list $ {option}*)}*) {#form}*)

;; **************************************************************************************************************
;; generic-function lambda-list [[?option | {method-description}*]]
;; option ::= (:argument-precedence-order {parameter-name}+)
;;                 | (declare {declaration}+)
;;                 | (:documentation string)
;;                 | (:method-combination symbol {arg}*)
;;                 | (:generic-function-class class-name)
;;                 | (:method-class class-name)
;; method-description ::= (:method {method-qualifier}*
;;                                 specialized-lambda-list
;;                                 {declaration | documentation}*
;;                                 {form}*)
;; **************************************************************************************************************

(generic-function _lambda-list $ {option}*)

;; **************************************************************************************************************
;; generic-labels ((function-name lambda-list
;;                  [[?option | {method-description}*]])}*)
;;                {form}*
;; **************************************************************************************************************

(generic-labels ({(_name _lambda-list $ {option}*)}*) {#form}*)

;; **************************************************************************************************************
;;  handler-bind ({(typespec handler)}*) {form}*
;; **************************************************************************************************************

(handler-bind ({(_typespec #handler)}*) {#form}*)

;; **************************************************************************************************************
;;  handler-case expression {(typespec ([var]) {form}*)}*
;; **************************************************************************************************************

(handler-case #expression {(_typespec ([~var]) @ {#form}*)}*)

;; **************************************************************************************************************
;;  ignore-errors {form}*
;; **************************************************************************************************************

(ignore-errors {#forms}*)

;; **************************************************************************************************************
;; incf
;;  incf place [delta] 
;; **************************************************************************************************************

(incf _place [#delta])

;; **************************************************************************************************************
;; labels
;; labels ({(name lambda-list
;;          [[ {declaration}* | doc-string ]] {form}*)}*)
;;        {declaration}* {form}*
;; **************************************************************************************************************

(labels ({(_name lambda-list body-1)}*)
        body-2)

;; **************************************************************************************************************
;; lambda 
;; (lambda lambda-list [[{declaration}* | doc-string]] {form}*)
;; **************************************************************************************************************

(lambda lambda-list body-1)

;; **************************************************************************************************************
;; let
;; let ({var | (var [value])}*) {declaration}* {form}* 
;; **************************************************************************************************************

(let ({~var | (~var [#value])}*) body-2)

;; **************************************************************************************************************
;; let*
;;  let* ({var | (var value)}*) {declaration}* {form}* 
;; **************************************************************************************************************

(let* ({^var | (^var [#value])}*) body-3)

;; **************************************************************************************************************
;; locally
;; locally {declaration}* {form}
;; **************************************************************************************************************

(locally body-3)

;; **************************************************************************************************************
;; loop
;; loop {form}*
;; **************************************************************************************************************

(loop {#form}*)

;; **************************************************************************************************************
;; macrolet
;; macrolet ({(name varlist
;;          [[ {declaration}* | doc-string ]] {form}*)}*)
;;       {form}* 
;; **************************************************************************************************************

(macrolet _macrolist
          {#form}*)

;; **************************************************************************************************************
;;  mapping ({({var | ({var}*)} value)}*) {declaration}* {form}*
;; **************************************************************************************************************

(mapping ({({~var | ({~var}*)} #value)}*) body-2)

;; **************************************************************************************************************
;; multiple-value-bind
;; multiple-value-bind ({var}*) values-form
;;                       {declaration}* {form}*
;; ************************************************************************************************************** 

(multiple-value-bind ({~var}*) #values-form body-2)

;; **************************************************************************************************************
;; multiple-value-call
;;  multiple-value-call function {form}*
;; **************************************************************************************************************

(multiple-value-call #function {#form}*)

;; **************************************************************************************************************
;; multiple-value-list 
;; multiple-value-list form
;; **************************************************************************************************************

(multiple-value-list #form)

;; **************************************************************************************************************
;; multiple-value-prog1
;; multiple-value-prog1 form {form}*
;; **************************************************************************************************************

(multiple-value-prog1 {#form}*)

;; **************************************************************************************************************
;; multiple-value-setq 
;; multiple-value-setq variables form
;; **************************************************************************************************************

(multiple-value-setq _variables #form)

;; **************************************************************************************************************
;; nth-value
;; nth-value n form
;; **************************************************************************************************************

(nth-value #n #form)

;; **************************************************************************************************************
;; or
;; or {form}* 
;; **************************************************************************************************************

(or {#form}*)

;; **************************************************************************************************************
;; pprint-logical-block
;; pprint-logical-block (stream-symbol list [[ { :prefix | :per-line-prefix} p | :suffix s ]])
;;                      {form}*
;; **************************************************************************************************************

(pprint-logical-block ~list {#form}*)

;; **************************************************************************************************************
;; prog
;; prog ({var | (var [init])}*) {declaration}* {tag | statement}*
;; **************************************************************************************************************

(prog ({~var | (~var [#init])}*) body-2)

;; **************************************************************************************************************
;; prog*
;; prog* ({var | (var [init])}*) {declaration}* {tag | statement}*
;; **************************************************************************************************************


(prog* ({^var | (^var [#init])}*) body-3)

;; **************************************************************************************************************
;; prog1
;;  prog1 first {form}*
;; **************************************************************************************************************

(prog1 {#form}*)

;; **************************************************************************************************************
;; prog2
;;  prog2 first second {form}* 
;; **************************************************************************************************************

(prog2 {#form}*)

;; **************************************************************************************************************
;; progn
;;  progn {form}*
;; **************************************************************************************************************

(progn {#form}*)

;; **************************************************************************************************************
;; progv
;;  progv symbols values {form}*
;; **************************************************************************************************************

(progv {#form}*)

;; **************************************************************************************************************
;; psetf
;; psetf {_place form}*
;; **************************************************************************************************************

(psetf {_place #form}*)

;; **************************************************************************************************************
;; psetq 
;; psetq {symbol form}*
;; **************************************************************************************************************

(psetq {_symbol #form}*)

;; **************************************************************************************************************
;; push
;;  push item place
;; **************************************************************************************************************

(push #form _place)

;; **************************************************************************************************************
;; pushnew
;; pushnew item place &key :test :test-not :key
;; **************************************************************************************************************

(pushnew #form _place [_key]*)

;; **************************************************************************************************************
;; return
;;  return [result]
;; **************************************************************************************************************

(return [#form])

;; **************************************************************************************************************
;; return-from
;;  return-from name [result]
;; **************************************************************************************************************

(return-from _name [#result])

;; **************************************************************************************************************
;; setf
;;  setf {place newvalue}*
;; **************************************************************************************************************

(setf {_place #value}*)

;; **************************************************************************************************************
;; setq
;; setq {var form}*
;; **************************************************************************************************************

(setq {_var #form}*)

;; **************************************************************************************************************
;; symbol-macrolet
;; symbol-macrolet ({(var expansion)}*)                  {declaration}* {form}*
;; **************************************************************************************************************

(symbol-macrolet ({(~var _expansion)}*) body-2)

;; **************************************************************************************************************
;; tagbody
;;  tagbody {tag | statement}*
;; **************************************************************************************************************

(tagbody {#form}*)

;; **************************************************************************************************************
;; the
;; the value-type form
;; **************************************************************************************************************

(the _value-type #form)

;; **************************************************************************************************************
;; throw
;; throw tag result
;; **************************************************************************************************************

(throw _tag #result)

;; **************************************************************************************************************
;; unless
;;  unless test {form}*
;; **************************************************************************************************************

(unless {#form}*)

;; **************************************************************************************************************
;; unwind-protect
;; unwind-protect protected-form {cleanup-form}*
;; **************************************************************************************************************

(unwind-protect {#form}*)

;; **************************************************************************************************************
;; when
;; when test {form}*
;; **************************************************************************************************************

(when {#form}*)

;; **************************************************************************************************************
;; with-accessors
;; with-accessors ({slot-entry}*) instance-form
;;                {declaration}* {form}*
;; **************************************************************************************************************

(with-accessors ({slot-entry}*) #instance-form body-2)

;; **************************************************************************************************************
;; with-added-methods (function-name lambda-list
;;                    [[?option | {method-description}*]])
;;                    {form}*
;; **************************************************************************************************************

(with-added-methods (_name lambda-list $ {option}*) {#form}*)

;; **************************************************************************************************************
;;  with-compilation-unit ({option-name option-value}*) {form}*
;; **************************************************************************************************************

(with-compilation-unit ({_option #option-value}*) {#form}*)

;; **************************************************************************************************************
;;  with-hash-table-iterator (mname hash-table) {form}*
;; **************************************************************************************************************

(with-hash-table-iterator (_mname #hash-table) {#form}*)

;; **************************************************************************************************************
;; with-input-from-string
;; with-input-from-string (var string keyword {value}*)         {declaration}* {#form}*
;; **************************************************************************************************************

(with-input-from-string (~var #string {_keyword}*) body-2)

;; **************************************************************************************************************
;; with-open-file
;; with-open-file (stream filename {options}*)       {declaration}* {#form}*
;; **************************************************************************************************************

(with-open-file (~stream #filename {_options}*) body-2)

;; **************************************************************************************************************
;; with-open-stream 
;; with-open-stream (var stream) {declaration}* {form}*
;; **************************************************************************************************************

(with-open-stream (~var #stream) body-2)

;; **************************************************************************************************************
;; with-output-to-string
;; with-output-to-string (var [string [:element-type type]])       {declaration}* {#form}*
;; **************************************************************************************************************

(with-output-to-string (~var [#string [:element-type _type]]) body-2)

;; **************************************************************************************************************
;; with-simple-restart (name format-string {format-argument}*)
;;            {form}*
;; **************************************************************************************************************

(with-simple-restart (_name _string {_arg}*) {#form}*)

;; **************************************************************************************************************
;; with-slots
;; with-slots ({slot-entry}*) instance-form       {declaration}* {form}*
;; **************************************************************************************************************

(with-slots ({slot-entry}*) #instance-form body-2)


;; End of definitions



























