[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

extending a formalism



Hello,

I needed an everey_list operator in my formalism in order to edit a list
of any kind of trees of my language. For this purpose, I wrote the
following  function that extends an arbitrary formalism: 

(de :extend-formalism (formalism)
  ;; extent FORMALISM by the phylum EVERY_LIST and the operators
  ;; every_list and <L>-root.
  
  (let* ((every-phy			; Exists in each formalism
	  ({name}:phylum 'EVERY formalism))

	 (every-list-op			; every_list -> EVERY * ;
	  ({operator}:get-or-make 'every_list formalism '* every-phy))

	 (every-list-phy		; EVERY_LIST ::= every_list ;
	  ({phylum}:insert 
	   ({phylum}:get-or-make 'EVERY_LIST formalism)
	   every-list-op))
	 
	 (root-op			; <L>-root -> EVERY EVERY_LIST ;
	  ({operator}:get-or-make
	   (concat ({formalism}:name formalism) "_" 'root)
	   formalism
	   2 every-phy every-list-phy))))

  ;; completes the extension 
  ({formalism}:complete formalism)
  formalism)

This seems to  work fine, and I can create an every_list tree. But
when putting it as root into the variable of my ctedit, I get an
error: 

? (setq every-list-op ({name}:operator 'every_list formalism))
= #<operator every_list>
? (setq ctedit (ct))
= #<ctedit>
? (setq variable ({ctedit}:variable ctedit))
= #<variable 147-30704>
? (setq old-root ({variable}:root variable))
= ()
? (setq new-root 
   ({tree}:make
     every-list-op
     ({formalism}:tree formalism 'EVERY {sublist})))
? ? ? = #<Glider every_list>
? ({variable}:change variable old-root new-root)
** vref : argument out of bounds : 68
? ({variable}:root variable)
= #<Glider every_list>
? ;;;Button execution:
#<Glider every_list> is a #:tree:Glider:every_list
  name: fragment-Glider-every_list
  operator: #<operator every_list>
  sons: (#<Glider metavariable EVERY>)
  father: ()
= ()
? ;;;Button execution:
#<operator every_list> is a #:operator:Glider:every_list
  name: every_list
  structure: (* #<phylum EVERY>)
  language: #<formalism Glider>
  code: 68
= ()
? 

The variable root has been replaced correctly, but redrawing the tree
produces the error. (I had the same behavior without using VTP++ and
my object browser). 

Did I forgot sth. when extending the formalism? 
Does I have to extend the ppretty printer as well?

Thanks for any hints

	Guido