


## corehack.pkg
## (C) 2000 Lucent Technologies, Bell Laboratories
## Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)
# Compiled by:
# src/app/make7/Make7.make6# Re-write top-level namings of a given symbol with corresponding namings
# of core_symbol::core_symbol (i.e., "package _Core").
### "The longest journal begins with a single word."
###
### -- Allucquere Rosanne Stone
stipulate
package raw
=
raw_syntax;
# raw_syntax is from src/lib/compiler/front/parse/raw-syntax/raw-syntax.pkg # core_symbol is from src/lib/compiler/front/typecheck-stuff/basics/core-symbol.pkgherein
package core_hack: (weak)
api {
rewrite: (raw::Declaration, symbol::Symbol)
->
raw::Declaration;
}
{
fun rewrite (decl, symbol_to_replace)
=
do_declaration decl
where
fun do_named_package (named_package as raw::NAMED_PACKAGE { name_symbol, definition, constraint, kind } )
=>
if (symbol::eq (name_symbol, symbol_to_replace))
raw::NAMED_PACKAGE {
name_symbol => core_symbol::core_symbol,
definition,
constraint,
kind
};
else
named_package;
fi;
do_named_package
(raw::SOURCE_CODE_REGION_FOR_NAMED_PACKAGE (named_package, src_region))
=>
raw::SOURCE_CODE_REGION_FOR_NAMED_PACKAGE (do_named_package named_package, src_region);
end;
fun do_declaration (raw::PACKAGE_DECLARATIONS named_packages) => raw::PACKAGE_DECLARATIONS (map do_named_package named_packages);
do_declaration (raw::LOCAL_DECLARATIONS (decl1, decl2)) => raw::LOCAL_DECLARATIONS (decl1, do_declaration decl2);
do_declaration (raw::SEQUENTIAL_DECLARATIONS declarations) => raw::SEQUENTIAL_DECLARATIONS (map do_declaration declarations);
do_declaration (raw::SOURCE_CODE_REGION_FOR_DECLARATION (decl, src_region)) => raw::SOURCE_CODE_REGION_FOR_DECLARATION (do_declaration decl, src_region);
do_declaration other => other;
end;
end;
};
end;


