Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-compiler-and-rts
compiler
Commits
35709c98
Commit
35709c98
authored
Mar 15, 2001
by
Martijn Vervoort
Browse files
compiler frontend without writing tcl-files
parent
484c43f9
Changes
5
Hide whitespace changes
Inline
Side-by-side
frontend/convertDynamics.dcl
View file @
35709c98
...
...
@@ -3,8 +3,8 @@ definition module convertDynamics
import
syntax
,
transform
,
convertcases
convertDynamicPatternsIntoUnifyAppls
::
{!
GlobalTCType
}
!{#
CommonDefs
}
!
Int
!*{!
Group
}
!*{#
FunDef
}
!*
PredefinedSymbols
!*
VarHeap
!*
TypeHeaps
!*
ExpressionHeap
!*
File
{#
DclModule
}
!
IclModule
/* TD */
[
String
]
->
(!*{!
Group
},
!*{#
FunDef
},
!*
PredefinedSymbols
,
!*{#{#
CheckedTypeDef
}},
!
ImportedConstructors
,
!*
VarHeap
,
!*
TypeHeaps
,
!*
ExpressionHeap
,
!*
File
)
convertDynamicPatternsIntoUnifyAppls
::
{!
GlobalTCType
}
!{#
CommonDefs
}
!
Int
!*{!
Group
}
!*{#
FunDef
}
!*
PredefinedSymbols
!*
VarHeap
!*
TypeHeaps
!*
ExpressionHeap
(
Optional
!*
File
)
{#
DclModule
}
!
IclModule
/* TD */
[
String
]
->
(!*{!
Group
},
!*{#
FunDef
},
!*
PredefinedSymbols
,
!*{#{#
CheckedTypeDef
}},
!
ImportedConstructors
,
!*
VarHeap
,
!*
TypeHeaps
,
!*
ExpressionHeap
,
Optional
!*
File
)
/*
convertDynamicPatternsIntoUnifyAppls :: {! GlobalTCType} !{# CommonDefs} !*{! Group} !*{#FunDef} !*PredefinedSymbols
...
...
frontend/convertDynamics.icl
View file @
35709c98
...
...
@@ -65,14 +65,23 @@ write_tcl_file main_dcl_module_n dcl_mods=:{[main_dcl_module_n] = main_dcl_modul
=
(
True
,
tcl_file
)
//---> ("dcl",size main_dcl_module.dcl_common.com_type_defs, "icl", size common_defs.com_type_defs);
convertDynamicPatternsIntoUnifyAppls
::
{!
GlobalTCType
}
!{#
CommonDefs
}
!
Int
!*{!
Group
}
!*{#
FunDef
}
!*
PredefinedSymbols
!*
VarHeap
!*
TypeHeaps
!*
ExpressionHeap
/* TD */
!*
File
{#
DclModule
}
!
IclModule
/* TD */
[
String
]
->
(!*{!
Group
},
!*{#
FunDef
},
!*
PredefinedSymbols
,
!*{#{#
CheckedTypeDef
}},
!
ImportedConstructors
,
!*
VarHeap
,
!*
TypeHeaps
,
!*
ExpressionHeap
,
/* TD */
!*
File
)
convertDynamicPatternsIntoUnifyAppls
::
{!
GlobalTCType
}
!{#
CommonDefs
}
!
Int
!*{!
Group
}
!*{#
FunDef
}
!*
PredefinedSymbols
!*
VarHeap
!*
TypeHeaps
!*
ExpressionHeap
/* TD */
(
Optional
!*
File
)
{#
DclModule
}
!
IclModule
/* TD */
[
String
]
->
(!*{!
Group
},
!*{#
FunDef
},
!*
PredefinedSymbols
,
!*{#{#
CheckedTypeDef
}},
!
ImportedConstructors
,
!*
VarHeap
,
!*
TypeHeaps
,
!*
ExpressionHeap
,
/* TD */
(
Optional
!*
File
)
)
convertDynamicPatternsIntoUnifyAppls
global_type_instances
common_defs
main_dcl_module_n
groups
fun_defs
predefined_symbols
var_heap
type_heaps
expr_heap
/* TD */
tcl_file
dcl_mods
icl_mod
/* TD */
directly_imported_dcl_modules
// TD ...
#
(
ok
,
tcl_file
)
=
write_tcl_file
main_dcl_module_n
dcl_mods
icl_mod
.
icl_common
tcl_file
/* TD */
directly_imported_dcl_modules
|
not
ok
=
abort
"convertDynamicPatternsIntoUnifyAppls: error writing tcl file"
#
tcl_file
=
case
tcl_file
of
No
->
No
(
Yes
tcl_file
)
#
(
ok
,
tcl_file
)
=
write_tcl_file
main_dcl_module_n
dcl_mods
icl_mod
.
icl_common
tcl_file
/* TD */
directly_imported_dcl_modules
|
not
ok
->
abort
"convertDynamicPatternsIntoUnifyAppls: error writing tcl file"
->
Yes
tcl_file
// ... TD
#
({
pds_module
,
pds_def
}
,
predefined_symbols
)
=
predefined_symbols
![
PD_StdDynamics
]
...
...
frontend/frontend.dcl
View file @
35709c98
...
...
@@ -22,5 +22,5 @@ import checksupport, transform, overloading
|
FrontEndPhaseConvertModules
|
FrontEndPhaseAll
frontEndInterface
::
!
FrontEndPhase
!
Ident
!
SearchPaths
!{#
DclModule
}
!{#
FunDef
}
!(
Optional
Bool
)
!*
PredefinedSymbols
!*
HashTable
!*
Files
!*
File
!*
File
!*
File
!*
File
!*
Heaps
->
(
!
Optional
*
FrontEndSyntaxTree
,!.{#
FunDef
},!
Int
,!
Int
,!*
PredefinedSymbols
,
!*
HashTable
,
!*
Files
,
!*
File
,
!*
File
,
!*
File
,
!*
File
,
!*
Heaps
)
frontEndInterface
::
!
FrontEndPhase
!
Ident
!
SearchPaths
!{#
DclModule
}
!{#
FunDef
}
!(
Optional
Bool
)
!*
PredefinedSymbols
!*
HashTable
!*
Files
!*
File
!*
File
!*
File
(!
Optional
!*
File
)
!*
Heaps
->
(
!
Optional
*
FrontEndSyntaxTree
,!.{#
FunDef
},!
Int
,!
Int
,!*
PredefinedSymbols
,
!*
HashTable
,
!*
Files
,
!*
File
,
!*
File
,
!*
File
,
!
Optional
!*
File
,
!*
Heaps
)
frontend/frontend.icl
View file @
35709c98
...
...
@@ -73,8 +73,8 @@ frontSyntaxTree cached_functions_and_macros n_functions_and_macros_in_dcl_module
)
//frontEndInterface :: !FrontEndPhase !Ident !SearchPaths !{#DclModule} !{#FunDef} !(Optional Bool) !*PredefinedSymbols !*HashTable !*Files !*File !*File !*File !*File !*Heaps -> ( !Optional *FrontEndSyntaxTree,!.{# FunDef },!Int,!Int,!*PredefinedSymbols, !*HashTable, !*Files, !*File !*File, !*File, !*File, !*Heaps)
frontEndInterface
::
!
FrontEndPhase
!
Ident
!
SearchPaths
!{#
DclModule
}
!{#
FunDef
}
!(
Optional
Bool
)
!*
PredefinedSymbols
!*
HashTable
!*
Files
!*
File
!*
File
!*
File
!*
File
!*
Heaps
->
(
!
Optional
*
FrontEndSyntaxTree
,!.{#
FunDef
},!
Int
,!
Int
,!*
PredefinedSymbols
,
!*
HashTable
,
!*
Files
,
!*
File
,
!*
File
,
!*
File
,
!*
File
,
!*
Heaps
)
frontEndInterface
::
!
FrontEndPhase
!
Ident
!
SearchPaths
!{#
DclModule
}
!{#
FunDef
}
!(
Optional
Bool
)
!*
PredefinedSymbols
!*
HashTable
!*
Files
!*
File
!*
File
!*
File
(!
Optional
!*
File
)
!*
Heaps
->
(
!
Optional
*
FrontEndSyntaxTree
,!.{#
FunDef
},!
Int
,!
Int
,!*
PredefinedSymbols
,
!*
HashTable
,
!*
Files
,
!*
File
,
!*
File
,
!*
File
,
!
Optional
!*
File
,
!*
Heaps
)
frontEndInterface
upToPhase
mod_ident
search_paths
dcl_modules
functions_and_macros
list_inferred_types
predef_symbols
hash_table
files
error
io
out
tcl_file
heaps
#
(
ok
,
mod
,
hash_table
,
error
,
predef_symbols
,
files
)
...
...
frontend/main.icl
View file @
35709c98
...
...
@@ -148,7 +148,7 @@ compileModule mod_name ms
loadModule
mod_ident
predef_symbols
hash_table
ms
=:{
ms_files
,
ms_error
,
ms_io
,
ms_out
,
ms_paths
}
#
heaps
=
{
hp_var_heap
=
newHeap
,
hp_expression_heap
=
newHeap
,
hp_type_heaps
=
{
th_vars
=
newHeap
,
th_attrs
=
newHeap
}}
#
(
optional_syntax_tree
,_,_,_,
predef_symbols
,
hash_table
,
ms_files
,
ms_error
,
ms_io
,
ms_out
,_,_)
=
frontEndInterface
FrontEndPhaseAll
mod_ident
{
sp_locations
=
[],
sp_paths
=
ms_paths
}
{}
{}
No
predef_symbols
hash_table
ms_files
ms_error
ms_io
ms_out
stderr
heaps
=
frontEndInterface
FrontEndPhaseAll
mod_ident
{
sp_locations
=
[],
sp_paths
=
ms_paths
}
{}
{}
No
predef_symbols
hash_table
ms_files
ms_error
ms_io
ms_out
No
heaps
#
ms
=
{
ms
&
ms_files
=
ms_files
,
ms_error
=
ms_error
,
ms_io
=
ms_io
,
ms_out
=
ms_out
}
=
case
optional_syntax_tree
of
Yes
{
fe_icl
={
icl_functions
},
fe_dcls
,
fe_dclIclConversions
,
fe_iclDclConversions
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment