Commit 9a63d151 authored by Martin Wierich's avatar Martin Wierich
Browse files

making compiler self compilable (this doesn't say anything about the

quality of the generated executable)
parent 4c99826f
......@@ -1042,7 +1042,7 @@ checkDclModules imports_of_icl_mod dcl_modules icl_functions heaps cs=:{cs_symbo
checkDclComponent :: !{![Int]} !{![Int]} ![[(Index, Position, [ImportNrAndIdents])]] ![Int]
!(!Int, !*ExplImpInfos, !*{# DclModule}, !*{# FunDef}, !*Heaps,!*CheckState)
-> (!Int, !.ExplImpInfos, !.{# DclModule}, !.{# FunDef}, !.Heaps,!.CheckState)
-> (!Int, !*ExplImpInfos, !.{# DclModule}, !.{# FunDef}, !.Heaps,!.CheckState)
checkDclComponent components_array super_components expl_imp_indices mod_indices
(component_nr, expl_imp_infos, dcl_modules, icl_functions, heaps, cs=:{cs_x})
| not cs.cs_error.ea_ok || hd mod_indices==size dcl_modules // the icl module!
......@@ -1924,6 +1924,9 @@ add_declaration_to_symbol_table opt_dcl_macro_range {dcl_kind=STE_FunctionOrMacr
add_declaration_to_symbol_table yes_for_icl_module {dcl_kind=dcl_kind=:STE_Imported def_kind def_mod, dcl_ident, dcl_index, dcl_pos} importing_mod cs
= addSymbol yes_for_icl_module dcl_ident dcl_pos dcl_kind def_kind dcl_index def_mod importing_mod cs
updateExplImpInfo :: [Int] Index {!Declaration} {!Declaration} u:{#DclModule}
{!{!*ExplImpInfo}} *SymbolTable
-> (u:{#DclModule},!{!{!.ExplImpInfo}},.SymbolTable)
updateExplImpInfo super_components mod_index dcls_import dcls_local_for_import
dcl_modules expl_imp_infos cs_symbol_table
# (changed_symbols, (expl_imp_infos, cs_symbol_table))
......
......@@ -63,7 +63,7 @@ cConversionTableSize :== 8
, dcls_local_for_import ::!{!Declaration}
}
:: ExplImpInfos :== {!{!.ExplImpInfo}}
:: *ExplImpInfos :== *{!*{!*ExplImpInfo}}
:: ExplImpInfo
= ExplImpInfo Ident !.DeclaringModulesSet
......
......@@ -75,7 +75,7 @@ where
, dcls_local_for_import ::!{!Declaration}
}
:: ExplImpInfos :== {!{!.ExplImpInfo}}
:: *ExplImpInfos :== *{!*{!*ExplImpInfo}}
:: ExplImpInfo
= ExplImpInfo Ident !.DeclaringModulesSet
......
......@@ -1562,10 +1562,6 @@ instance <<< (Ptr a)
where
(<<<) file ptr = file <<< ptrToInt ptr
instance <<< BoundVar
where
(<<<) file {var_name,var_info_ptr} = file <<< var_name <<< '[' <<< var_info_ptr <<< ']'
instance <<< FunctionBody
where
(<<<) file (TransformedBody {tb_rhs}) = file <<< tb_rhs
......
......@@ -20,14 +20,6 @@ Start world
= fclose ms_out world
CommandLoop proj ms=:{ms_io}
# answer = "c t5\n"
(command, argument) = SplitAtLayoutChar (dropWhile isSpace (fromString answer))
| command == []
= CommandLoop proj { ms & ms_io = ms_io}
# (ready, proj, ms) = DoCommand command argument proj { ms & ms_io = ms_io}
= ms
/*
CommandLoop proj ms=:{ms_io}
# (answer, ms_io) = freadline (ms_io <<< "> ")
(command, argument) = SplitAtLayoutChar (dropWhile isSpace (fromString answer))
......@@ -37,7 +29,6 @@ CommandLoop proj ms=:{ms_io}
| ready
= ms
= CommandLoop proj ms
*/
:: MainStateDefs funs funtypes types conses classes instances members selectors =
{ msd_funs :: !funs
......
......@@ -2,16 +2,6 @@ definition module portToNewSyntax
// see the file readme.txt in the portToNewSyntax folder about
// this module
from StdMisc import abort
//1.3
from StdFile import Files
from StdString import String
from scanner import SearchPaths
//3.1
/*2.0
from StdFile import :: Files
from scanner import :: SearchPaths
0.2*/
import checksupport
switch_port_to_new_syntax port dont_port :== dont_port
......
......@@ -1253,15 +1253,18 @@ instance expand Expression
where
expand (App app=:{app_symb = symb=:{symb_arity, symb_kind = SK_Macro {glob_object,glob_module}}, app_args}) ei
# (app_args, (calls, es)) = expand app_args ei
# (macro, es) = es!es_fun_defs.[glob_object]
(macro, es) = es!es_fun_defs.[glob_object]
| macro.fun_arity == symb_arity
= unfoldMacro macro app_args (calls, es)
# (calls, es_symbol_table) = examineFunctionCall macro.fun_symb {fc_index = glob_object, fc_level = NotALevel} (calls, es.es_symbol_table)
| macro.fun_info.fi_group_index<NoIndex
# macro = {macro & fun_info.fi_group_index= -2-macro.fun_info.fi_group_index}
# es= {es & es_fun_defs.[glob_object]=macro}
= (App { app & app_symb = { symb & symb_kind = SK_Function {glob_object = glob_object, glob_module = glob_module} }, app_args = app_args },(calls, { es & es_symbol_table = es_symbol_table }))
= (App { app & app_symb = { symb & symb_kind = SK_Function {glob_object = glob_object, glob_module = glob_module} }, app_args = app_args },(calls, { es & es_symbol_table = es_symbol_table }))
# (calls, es_symbol_table)
= examineFunctionCall macro.fun_symb {fc_index = glob_object, fc_level = NotALevel}
(calls, es.es_symbol_table)
es = { es & es_symbol_table = es_symbol_table }
| macro.fun_info.fi_group_index<NoIndex
# macro = {macro & fun_info.fi_group_index= -2-macro.fun_info.fi_group_index}
es= {es & es_fun_defs.[glob_object]=macro}
= (App { app & app_symb = { symb & symb_kind = SK_Function {glob_object = glob_object, glob_module = glob_module} }, app_args = app_args },(calls, es))
= (App { app & app_symb = { symb & symb_kind = SK_Function {glob_object = glob_object, glob_module = glob_module} }, app_args = app_args },(calls, es))
expand (App app=:{app_args}) ei
# (app_args, ei) = expand app_args ei
= (App { app & app_args = app_args }, ei)
......
......@@ -845,7 +845,7 @@ freshAttribute ts=:{ts_attr_store}
}
attribute_error type_attr No
= abort ("sanity check nr 723 failed in module type"--->("type_attr", type_attr))
= No // XXX abort ("sanity check nr 723 failed in module type"--->("type_attr", type_attr))
attribute_error type_attr (Yes err)
# err = errorHeading "Type error" err
= Yes { err & ea_file = err.ea_file <<< "* attribute expected instead of " <<< type_attr <<< '\n' }
......@@ -869,6 +869,7 @@ addPropagationAttributesToAType modules type=:{at_type = TA cons_id=:{type_index
= unsafeFold2St (check_kind type_name modules) tdi_kinds cons_args (1, error_admin)
-> Yes error_admin
= ({ type & at_type = TA cons_id cons_args, at_attribute = at_attribute }, prop_class, { ps & prop_attr_vars = prop_attr_vars,
// MW probably = ({ type & at_type = TA cons_id cons_args, at_attribute = at_attribute, at_annotation = AN_None }, prop_class, { ps & prop_attr_vars = prop_attr_vars,
prop_td_infos = prop_td_infos, prop_attr_env = prop_attr_env,
prop_type_heaps = { prop_type_heaps & th_vars = th_vars, th_attrs = th_attrs}, prop_error = prop_error })
where
......@@ -965,6 +966,7 @@ addPropagationAttributesToAType modules type=:{at_type = TA cons_id=:{type_index
addPropagationAttributesToAType modules type=:{at_type} ps
# (at_type, ps) = addPropagationAttributesToType modules at_type ps
= ({ type & at_type = at_type }, NoPropClass, ps)
// MW probably = ({ type & at_type = at_type, at_annotation = AN_None }, NoPropClass, ps)
addPropagationAttributesToType modules (arg_type --> res_type) ps
# (arg_type, prop_class, ps) = addPropagationAttributesToAType modules arg_type ps
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment