In any language with compound tag types, you will need to implement an expand function. Once written, assign it to this variable.
Languages with compound definitions should use this function to expand from one compound symbol into several. For example, in C or Java the following definition is easily parsed into one tag:
int a, b;
This function should take this compound tag and turn it into two tags, one for A, and the other for B.
Additionally, you can use the expand function in conjunction with your language for other types of compound statements. For example, in Common Lisp Object System, you can have a definition:
(defclass classname nil (slots ...) ...)
This will create both the datatype
classname and the functional
classname. Each slot may have a
method as well.
You can create a special compounded tag in your rule, for example:
classdef: LPAREN DEFCLASS name semantic-list semantic-list RPAREN (TAG "custom" 'compound-class :value (list (TYPE-TAG $3 "class" ...) (FUNCTION-TAG $3 ...) )) ;
and in your expand function, you would write:
(defun my-tag-expand (tag) "Expand tags for my language." (when (semantic-tag-of-class-p tag 'compound-class) (remq nil (semantic-tag-get-attribute tag :value))))
This will cause the custom tag to be replaced by the tags created in the :value attribute of the specially constructed tag.