Skip to content
Snippets Groups Projects
  • Erwan Jahier's avatar
    65b93560
    Add support to be able to use iterators in node aliases. · 65b93560
    Erwan Jahier authored
    Also, node aliased to other nodes were handled poorly: I was replacing
    in the syntax tree the node by its alias. Now, I really define
    the alias node using the aliases one.
    
    For instance,
    
        node toto(x:t) returns (y:t);
        let
          ...
         tel
         node titi = toto;
         node tutu(...) returns(...);
         let
            ...
    	z = titi(a);
         tel
    
    was compiled into
    
        node toto(x:t) returns (y:t);
        let
          ...
         tel
    
         node tutu(...) returns(...);
         let
            ...
    	z = toto(a);
         tel
    
    Now, I generate
    
         node toto(x:t) returns (y:t);
         let
           ...
         tel
         node titi(i1:t) returns (o1:t);
         let
           o1 =toto(i1);
         tel
         node tutu(...) returns(...);
         let
            ...
    	z = titi(a);
         tel
    
    which is equivalent, but closer to the original program.
    65b93560
    History
    Add support to be able to use iterators in node aliases.
    Erwan Jahier authored
    Also, node aliased to other nodes were handled poorly: I was replacing
    in the syntax tree the node by its alias. Now, I really define
    the alias node using the aliases one.
    
    For instance,
    
        node toto(x:t) returns (y:t);
        let
          ...
         tel
         node titi = toto;
         node tutu(...) returns(...);
         let
            ...
    	z = titi(a);
         tel
    
    was compiled into
    
        node toto(x:t) returns (y:t);
        let
          ...
         tel
    
         node tutu(...) returns(...);
         let
            ...
    	z = toto(a);
         tel
    
    Now, I generate
    
         node toto(x:t) returns (y:t);
         let
           ...
         tel
         node titi(i1:t) returns (o1:t);
         let
           o1 =toto(i1);
         tel
         node tutu(...) returns(...);
         let
            ...
    	z = titi(a);
         tel
    
    which is equivalent, but closer to the original program.
ident.mli 1.43 KiB
(** Time-stamp: <modified the 21/05/2008 (at 14:37) by Erwan Jahier> *)


type t

type pack_name

type long


val to_string : t -> string
val of_string : string -> t

val of_long : long -> t
val pack_name_of_string : string -> pack_name
val to_pack_name : t -> pack_name
val pack_name_to_string : pack_name -> string
val pack_of_long : long -> pack_name

val short_string_of_long : long -> string
val string_of_long : long -> string
val long_to_string : long -> string
val long_of_string : string -> long

val make_long : pack_name -> t -> long


val set_dft_pack_name : pack_name -> unit




(* TODO: a renommer et a abstraire  ??  
   a mettre dans syntaxe.ml ???

   During parsing, we don't know yet what default name we should
   give to the package. Once we know it, we manipulate Ident.t rather than idref

   idref is used to denote user ident, that migth be prefixed
   by the module name or not. One of the first stage of the compiling 
   will consist in transforming those idref (should be called user_id?)
   into Ident.long

*)
type idref = 
    {
      id_pack : string option;
      id_id  : string
    }

val idref_of_string : string -> idref


val string_of_idref : idref -> string
val of_idref : idref -> t
val to_idref : t -> idref

val name_of_idref : idref -> t
val pack_of_idref : idref -> pack_name option

(** [long_of_idref default_pack_name id_ref] builds a long ident from a 
    SyntaxTree.idref *)
val long_of_idref : idref -> long