overlay.library 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: overlay.library
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Overlay Language standard library — built-in definitions for the Overlay Language
|
|
5
|
+
Author: Yang, Bo
|
|
6
|
+
Author-email: Yang, Bo <yang-bo@yang-bo.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Requires-Dist: overlay-language
|
|
9
|
+
Requires-Python: >=3.13
|
|
10
|
+
Project-URL: Repository, https://github.com/Atry/overlay
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["uv_build>=0.10.2,<0.11"]
|
|
3
|
+
build-backend = "uv_build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "overlay.library"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Overlay Language standard library — built-in definitions for the Overlay Language"
|
|
9
|
+
license = "MIT"
|
|
10
|
+
requires-python = ">=3.13"
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "Yang, Bo", email = "yang-bo@yang-bo.com"},
|
|
13
|
+
]
|
|
14
|
+
dependencies = [
|
|
15
|
+
"overlay.language",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[tool.uv]
|
|
19
|
+
sources = {overlay-language = {workspace = true}}
|
|
20
|
+
|
|
21
|
+
[tool.uv.build-backend]
|
|
22
|
+
module-name = "overlay.library"
|
|
23
|
+
|
|
24
|
+
[project.urls]
|
|
25
|
+
Repository = "https://github.com/Atry/overlay"
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
Nat:
|
|
2
|
+
Nat: []
|
|
3
|
+
Zero:
|
|
4
|
+
- [Nat]
|
|
5
|
+
Successor:
|
|
6
|
+
- [Nat]
|
|
7
|
+
- predecessor: [Nat]
|
|
8
|
+
|
|
9
|
+
NatVisitor:
|
|
10
|
+
- [Nat]
|
|
11
|
+
- Nat:
|
|
12
|
+
Visitor:
|
|
13
|
+
Visit: []
|
|
14
|
+
Zero:
|
|
15
|
+
Visitor:
|
|
16
|
+
- VisitZero: []
|
|
17
|
+
Visit: [VisitZero]
|
|
18
|
+
|
|
19
|
+
Successor:
|
|
20
|
+
predecessor: [Nat]
|
|
21
|
+
|
|
22
|
+
Visitor:
|
|
23
|
+
- VisitSuccessor: []
|
|
24
|
+
Visit: [VisitSuccessor]
|
|
25
|
+
|
|
26
|
+
NatPlus:
|
|
27
|
+
- [Nat]
|
|
28
|
+
- Nat:
|
|
29
|
+
Plus:
|
|
30
|
+
sum: [Nat]
|
|
31
|
+
Zero:
|
|
32
|
+
Plus:
|
|
33
|
+
addend: [Nat]
|
|
34
|
+
sum: [addend]
|
|
35
|
+
Successor:
|
|
36
|
+
predecessor:
|
|
37
|
+
Plus:
|
|
38
|
+
sum: [Nat]
|
|
39
|
+
Plus:
|
|
40
|
+
addend: [Nat]
|
|
41
|
+
_increasedAddend:
|
|
42
|
+
- [Successor]
|
|
43
|
+
- predecessor: [addend]
|
|
44
|
+
_recursiveAddition:
|
|
45
|
+
- [Successor, ~, predecessor, Plus]
|
|
46
|
+
- addend: [_increasedAddend]
|
|
47
|
+
sum: [_recursiveAddition, sum]
|
|
48
|
+
|
|
49
|
+
NatEquality:
|
|
50
|
+
- [NatVisitor]
|
|
51
|
+
- [Boolean]
|
|
52
|
+
- Nat:
|
|
53
|
+
Equal:
|
|
54
|
+
other: [Nat]
|
|
55
|
+
equal: [Boolean]
|
|
56
|
+
Zero:
|
|
57
|
+
Equal:
|
|
58
|
+
other: [Nat]
|
|
59
|
+
_OtherVisitor:
|
|
60
|
+
- [other, Visitor]
|
|
61
|
+
- VisitZero:
|
|
62
|
+
equal: [NatEquality, ~, "True"]
|
|
63
|
+
VisitSuccessor:
|
|
64
|
+
equal: [NatEquality, ~, "False"]
|
|
65
|
+
Visit:
|
|
66
|
+
equal: [NatEquality, ~, Boolean]
|
|
67
|
+
equal: [_OtherVisitor, Visit, equal]
|
|
68
|
+
Successor:
|
|
69
|
+
predecessor:
|
|
70
|
+
Equal:
|
|
71
|
+
equal: [Boolean]
|
|
72
|
+
Equal:
|
|
73
|
+
other:
|
|
74
|
+
- [Nat]
|
|
75
|
+
- predecessor: [Nat]
|
|
76
|
+
_recursiveEquality:
|
|
77
|
+
- [Successor, ~, predecessor, Equal]
|
|
78
|
+
- other: [Equal, ~, other, predecessor]
|
|
79
|
+
_OtherVisitor:
|
|
80
|
+
- [other, Visitor]
|
|
81
|
+
- VisitZero:
|
|
82
|
+
equal: [NatEquality, ~, "False"]
|
|
83
|
+
VisitSuccessor:
|
|
84
|
+
equal: [_recursiveEquality, equal]
|
|
85
|
+
Visit:
|
|
86
|
+
equal: [Boolean]
|
|
87
|
+
equal: [_OtherVisitor, Visit, equal]
|
|
88
|
+
|
|
89
|
+
Boolean:
|
|
90
|
+
Boolean: []
|
|
91
|
+
"True": [Boolean]
|
|
92
|
+
"False": [Boolean]
|
|
93
|
+
|
|
94
|
+
BooleanVisitor:
|
|
95
|
+
- [Boolean]
|
|
96
|
+
- Boolean:
|
|
97
|
+
Visitor:
|
|
98
|
+
Visit: []
|
|
99
|
+
"True":
|
|
100
|
+
Visitor:
|
|
101
|
+
- VisitTrue: []
|
|
102
|
+
Visit: [VisitTrue]
|
|
103
|
+
|
|
104
|
+
"False":
|
|
105
|
+
Visitor:
|
|
106
|
+
- VisitFalse: []
|
|
107
|
+
Visit: [VisitFalse]
|
|
108
|
+
|
|
109
|
+
BooleanNegation:
|
|
110
|
+
- [Boolean]
|
|
111
|
+
- Boolean:
|
|
112
|
+
not: [Boolean]
|
|
113
|
+
"True":
|
|
114
|
+
not: ["False"]
|
|
115
|
+
"False":
|
|
116
|
+
not: ["True"]
|
|
117
|
+
|
|
118
|
+
BooleanEquality:
|
|
119
|
+
- [BooleanNegation]
|
|
120
|
+
- Boolean:
|
|
121
|
+
Equal:
|
|
122
|
+
other: [Boolean]
|
|
123
|
+
equal: [Boolean]
|
|
124
|
+
"True":
|
|
125
|
+
Equal:
|
|
126
|
+
other: [Boolean]
|
|
127
|
+
equal: [other]
|
|
128
|
+
|
|
129
|
+
"False":
|
|
130
|
+
Equal:
|
|
131
|
+
other: [Boolean]
|
|
132
|
+
equal: [other, not]
|
|
133
|
+
|
|
134
|
+
BooleanAnd:
|
|
135
|
+
- [Boolean]
|
|
136
|
+
- Boolean:
|
|
137
|
+
And:
|
|
138
|
+
other: [Boolean]
|
|
139
|
+
and: [Boolean]
|
|
140
|
+
"True":
|
|
141
|
+
And:
|
|
142
|
+
other: [Boolean]
|
|
143
|
+
and: [other]
|
|
144
|
+
|
|
145
|
+
"False":
|
|
146
|
+
And:
|
|
147
|
+
other: [Boolean]
|
|
148
|
+
and: ["False"]
|
|
149
|
+
|
|
150
|
+
BooleanOr:
|
|
151
|
+
- [Boolean]
|
|
152
|
+
- Boolean:
|
|
153
|
+
Or:
|
|
154
|
+
other: [Boolean]
|
|
155
|
+
or: [Boolean]
|
|
156
|
+
"True":
|
|
157
|
+
Or:
|
|
158
|
+
other: [Boolean]
|
|
159
|
+
or: ["True"]
|
|
160
|
+
|
|
161
|
+
"False":
|
|
162
|
+
Or:
|
|
163
|
+
other: [Boolean]
|
|
164
|
+
or: [other]
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
from overlay.language import (
|
|
2
|
+
LexicalReference,
|
|
3
|
+
MappingScopeDefinition,
|
|
4
|
+
extend,
|
|
5
|
+
extern,
|
|
6
|
+
public,
|
|
7
|
+
resource,
|
|
8
|
+
scope,
|
|
9
|
+
)
|
|
10
|
+
from overlay.language.runtime import Scope
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@public
|
|
14
|
+
@extend(LexicalReference(path=("Nat",)))
|
|
15
|
+
@scope
|
|
16
|
+
class NatToPython:
|
|
17
|
+
@public
|
|
18
|
+
@scope
|
|
19
|
+
class Nat:
|
|
20
|
+
@public
|
|
21
|
+
@scope
|
|
22
|
+
class ToPython:
|
|
23
|
+
@public
|
|
24
|
+
@extern
|
|
25
|
+
@staticmethod
|
|
26
|
+
def pythonValue() -> int: ...
|
|
27
|
+
|
|
28
|
+
@public
|
|
29
|
+
@scope
|
|
30
|
+
class Zero:
|
|
31
|
+
@public
|
|
32
|
+
@scope
|
|
33
|
+
class ToPython:
|
|
34
|
+
@public
|
|
35
|
+
@resource
|
|
36
|
+
@staticmethod
|
|
37
|
+
def pythonValue() -> int:
|
|
38
|
+
return 0
|
|
39
|
+
|
|
40
|
+
@public
|
|
41
|
+
@scope
|
|
42
|
+
class Successor:
|
|
43
|
+
@public
|
|
44
|
+
@scope
|
|
45
|
+
class ToPython:
|
|
46
|
+
@public
|
|
47
|
+
@resource
|
|
48
|
+
@staticmethod
|
|
49
|
+
def pythonValue(predecessor: Scope) -> int:
|
|
50
|
+
return predecessor.ToPython.pythonValue + 1
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@scope
|
|
54
|
+
class _BooleanApi:
|
|
55
|
+
@public
|
|
56
|
+
@scope
|
|
57
|
+
class ToPython:
|
|
58
|
+
@public
|
|
59
|
+
@extern
|
|
60
|
+
@staticmethod
|
|
61
|
+
def pythonValue() -> bool: ...
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@public
|
|
65
|
+
@scope
|
|
66
|
+
class _TrueToPython:
|
|
67
|
+
@public
|
|
68
|
+
@scope
|
|
69
|
+
class ToPython:
|
|
70
|
+
@public
|
|
71
|
+
@resource
|
|
72
|
+
@staticmethod
|
|
73
|
+
def pythonValue() -> bool:
|
|
74
|
+
return True
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@public
|
|
78
|
+
@scope
|
|
79
|
+
class _FalseToPython:
|
|
80
|
+
@public
|
|
81
|
+
@scope
|
|
82
|
+
class ToPython:
|
|
83
|
+
@public
|
|
84
|
+
@resource
|
|
85
|
+
@staticmethod
|
|
86
|
+
def pythonValue() -> bool:
|
|
87
|
+
return False
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
BooleanToPython = MappingScopeDefinition(
|
|
91
|
+
bases=(),
|
|
92
|
+
is_public=True,
|
|
93
|
+
underlying={
|
|
94
|
+
"Boolean": _BooleanApi,
|
|
95
|
+
"True": _TrueToPython,
|
|
96
|
+
"False": _FalseToPython,
|
|
97
|
+
},
|
|
98
|
+
)
|
|
File without changes
|