Translating Pascal ==> C: nested procedures

Anton Rang rang at cpsin3.cps.msu.edu
Sun Jun 4 13:10:27 AEST 1989


I'm curious.  This is not intended to start a flame war, by the way
(which is why it's not X-posted to comp.lang.pascal :-).  I've heard
of several "Pascal to C" translators.  How do they handle nested
procedures?  For instance, suppose I have:

		procedure insert_in_symtab(what : node);
		  function conflict(n1, n2 : node) : boolean;
		  ...
		  function check_if_full : boolean;
		  ...
		...

		procedure insert_in_strtab(what : string);
		  function check_if_full : boolean;
		    { this code uses "what" }
		  ...
		...

Do they just rename the nested procedures to unique names and make
them "static"?  If so, how do they handle accesses to variables which
are declared in enclosing blocks?
  (If you don't think this is interesting to C people, please E-mail
responses to me.)

  Thanks,

	Anton

+---------------------------+------------------------+
| Anton Rang (grad student) | "VMS Forever!"         |
| Michigan State University | rang at cpswh.cps.msu.edu |
+---------------------------+------------------------+



More information about the Comp.lang.c mailing list