PmCompilerOptions.icl 2.1 KB
Newer Older
Diederik van Arkel's avatar
Diederik van Arkel committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
implementation module PmCompilerOptions

import StdClass, StdBool
import StdFile

Unexpected message defaultValue
	:== UnexpectedEvalBefore defaultValue (UnexpectedReport message)

UnexpectedEvalBefore :: !.a !.b -> .a
UnexpectedEvalBefore defaultValue _
	=	defaultValue

Don`tCareValue :== 0

UnexpectedReport :: !{#Char} -> Int
UnexpectedReport message
	=	UnexpectedEvalBefore Don`tCareValue (fwrites message stderr)

//--	ListTypes: Options for the listing of derived types

::	ListTypes	= NoTypes | InferredTypes | StrictExportTypes | AllTypes

instance == ListTypes
where
	(==) :: ListTypes ListTypes -> Bool
	(==) NoTypes NoTypes
		=	True
	(==) InferredTypes InferredTypes
		=	True
	(==) StrictExportTypes StrictExportTypes
		=	True
	(==) AllTypes AllTypes
		=	True
	(==) _ _
		=	False

instance toString ListTypes
where
	toString :: !ListTypes -> {#Char}
	toString NoTypes
		=	"NoTypes"
	toString InferredTypes
		=	"InferredTypes"
	toString StrictExportTypes
		=	"StrictExportTypes";
	toString AllTypes
		=	"AllTypes"

instance fromString ListTypes
where
51
	fromString :: {#Char} -> ListTypes
Diederik van Arkel's avatar
Diederik van Arkel committed
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
	fromString "NoTypes"
		=	NoTypes
	fromString "InferredTypes"
		=	 InferredTypes
	fromString "StrictExportTypes"
		=	StrictExportTypes
	fromString "AllTypes"
		=	AllTypes
	fromString _
		=	Unexpected "fromString (Types): unknown Type" NoTypes

//--	CompilerOptions: default settings for the compiler.

::	CompilerOptions	=
	{	neverMemoryProfile	:: !Bool		// memory profiling
	,	neverTimeProfile	:: !Bool		// time profiling
	,	sa					:: !Bool		// strictness analysis
	,	listTypes			:: !ListTypes	// derived type reporting
	,	attr				:: !Bool		// show attributes
	,	gw					:: !Bool		// give warnings
	,	bv					:: !Bool		// be verbose
	,	gc					:: !Bool		// generate comments
	,	reuseUniqueNodes	:: !Bool 		// reuse unique nodes
75
	,	fusion				:: !Bool
Diederik van Arkel's avatar
Diederik van Arkel committed
76
77
78
79
80
81
82
83
84
85
86
87
	}

DefaultCompilerOptions :: CompilerOptions
DefaultCompilerOptions =
	{ neverMemoryProfile	= False
	, neverTimeProfile		= False
	, sa					= True
	, listTypes				= StrictExportTypes
	, attr					= True
	, gw					= True
	, bv					= True
	, gc					= False
88
89
	, reuseUniqueNodes		= True
	, fusion				= False
Diederik van Arkel's avatar
Diederik van Arkel committed
90
91
	}