vanta-lang 0.28.0__py3-none-any.whl

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.
Files changed (46) hide show
  1. compiler/__init__.py +2 -0
  2. compiler/ast_nodes.py +241 -0
  3. compiler/codegen_cpp.py +995 -0
  4. compiler/driver.py +741 -0
  5. compiler/formats.py +53 -0
  6. compiler/lexer.py +184 -0
  7. compiler/loader.py +98 -0
  8. compiler/parser.py +532 -0
  9. compiler/runtime/vanta_runtime.hpp +818 -0
  10. compiler/templates/assets/ball.png +0 -0
  11. compiler/templates/assets/ball_spin.png +0 -0
  12. compiler/templates/assets/blip.wav +0 -0
  13. compiler/templates/assets/boom.wav +0 -0
  14. compiler/templates/assets/brick.png +0 -0
  15. compiler/templates/assets/brick.wav +0 -0
  16. compiler/templates/assets/enemy.png +0 -0
  17. compiler/templates/assets/gen_assets.py +221 -0
  18. compiler/templates/assets/hit.wav +0 -0
  19. compiler/templates/assets/laser.png +0 -0
  20. compiler/templates/assets/laser.wav +0 -0
  21. compiler/templates/assets/lose.wav +0 -0
  22. compiler/templates/assets/paddle.bmp +0 -0
  23. compiler/templates/assets/ship_anim.png +0 -0
  24. compiler/templates/assets/tiles.png +0 -0
  25. compiler/templates/gamekit/README.md +304 -0
  26. compiler/templates/gamekit/anim.vnt +62 -0
  27. compiler/templates/gamekit/audio.vnt +214 -0
  28. compiler/templates/gamekit/collide.vnt +46 -0
  29. compiler/templates/gamekit/fonts/LICENSE.md +13 -0
  30. compiler/templates/gamekit/fonts/tom-thumb.ttf +0 -0
  31. compiler/templates/gamekit/gamepad.vnt +115 -0
  32. compiler/templates/gamekit/gfx.vnt +37 -0
  33. compiler/templates/gamekit/image.vnt +98 -0
  34. compiler/templates/gamekit/input.vnt +21 -0
  35. compiler/templates/gamekit/rng.vnt +19 -0
  36. compiler/templates/gamekit/sdl.vnt +98 -0
  37. compiler/templates/gamekit/text.vnt +160 -0
  38. compiler/tokens.py +47 -0
  39. compiler/type_checker.py +1446 -0
  40. compiler/typesys.py +130 -0
  41. vanta_lang-0.28.0.dist-info/METADATA +306 -0
  42. vanta_lang-0.28.0.dist-info/RECORD +46 -0
  43. vanta_lang-0.28.0.dist-info/WHEEL +5 -0
  44. vanta_lang-0.28.0.dist-info/entry_points.txt +2 -0
  45. vanta_lang-0.28.0.dist-info/licenses/LICENSE +21 -0
  46. vanta_lang-0.28.0.dist-info/top_level.txt +1 -0
compiler/__init__.py ADDED
@@ -0,0 +1,2 @@
1
+ """Vanta compiler frontend (Python)."""
2
+ VERSION = "0.28.0"
compiler/ast_nodes.py ADDED
@@ -0,0 +1,241 @@
1
+ from dataclasses import dataclass
2
+ from typing import Optional, List, Any
3
+
4
+
5
+ @dataclass
6
+ class Pos:
7
+ line: int
8
+ col: int
9
+ file: Optional[str] = None
10
+
11
+
12
+ @dataclass
13
+ class Program:
14
+ decls: List[Any]
15
+
16
+
17
+ @dataclass
18
+ class TypeExpr:
19
+ kind: str
20
+ name: Optional[str] = None
21
+ inner: Optional['TypeExpr'] = None
22
+ size: Optional[int] = None
23
+ pos: Optional[Pos] = None
24
+ # For kind == 'func': the parameter type expressions. `inner` holds the
25
+ # return type, or None for void.
26
+ params: Optional[List['TypeExpr']] = None
27
+
28
+
29
+ @dataclass
30
+ class Param:
31
+ name: str
32
+ type: TypeExpr
33
+ pos: Pos
34
+
35
+
36
+ @dataclass
37
+ class FuncDecl:
38
+ name: str
39
+ params: List[Param]
40
+ ret: Optional[TypeExpr]
41
+ body: List[Any]
42
+ is_system: bool
43
+ pos: Pos
44
+
45
+
46
+ @dataclass
47
+ class StructDecl:
48
+ name: str
49
+ fields: List[Any]
50
+ is_component: bool
51
+ pos: Pos
52
+
53
+
54
+ @dataclass
55
+ class EnumDecl:
56
+ name: str
57
+ members: List[Any]
58
+ pos: Pos
59
+
60
+
61
+ @dataclass
62
+ class ExternDecl:
63
+ lib_name: str
64
+ funcs: List['FuncDecl']
65
+ pos: Pos
66
+
67
+
68
+ @dataclass
69
+ class ImportDecl:
70
+ path: str
71
+ pos: Pos
72
+
73
+
74
+ @dataclass
75
+ class ConstDecl:
76
+ name: str
77
+ type_ann: Optional[TypeExpr]
78
+ value: Any
79
+ pos: Pos
80
+
81
+
82
+ @dataclass
83
+ class VarDecl:
84
+ name: str
85
+ type_ann: Optional[TypeExpr]
86
+ mutable: bool
87
+ value: Any
88
+ pos: Pos
89
+
90
+
91
+ @dataclass
92
+ class AssignStmt:
93
+ target: Any
94
+ value: Any
95
+ pos: Pos
96
+
97
+
98
+ @dataclass
99
+ class ReturnStmt:
100
+ value: Optional[Any]
101
+ pos: Pos
102
+
103
+
104
+ @dataclass
105
+ class BreakStmt:
106
+ pos: Pos
107
+
108
+
109
+ @dataclass
110
+ class ContinueStmt:
111
+ pos: Pos
112
+
113
+
114
+ @dataclass
115
+ class IfStmt:
116
+ cond: Any
117
+ then_body: List[Any]
118
+ elif_branches: List[Any]
119
+ else_body: Optional[List[Any]]
120
+ pos: Pos
121
+
122
+
123
+ @dataclass
124
+ class MatchArm:
125
+ # One (enum name, member name, pos) triple per pattern; empty for else.
126
+ patterns: List[Any]
127
+ is_else: bool
128
+ body: List[Any]
129
+ pos: Pos
130
+
131
+
132
+ @dataclass
133
+ class MatchStmt:
134
+ value: Any
135
+ arms: List[Any]
136
+ pos: Pos
137
+
138
+
139
+ @dataclass
140
+ class WhileStmt:
141
+ cond: Any
142
+ body: List[Any]
143
+ pos: Pos
144
+
145
+
146
+ @dataclass
147
+ class ForRangeStmt:
148
+ var: str
149
+ start: Any
150
+ end: Any
151
+ step: Optional[Any]
152
+ body: List[Any]
153
+ pos: Pos
154
+
155
+
156
+ @dataclass
157
+ class ForEachStmt:
158
+ var: str
159
+ iterable: Any
160
+ body: List[Any]
161
+ pos: Pos
162
+
163
+
164
+ @dataclass
165
+ class ExprStmt:
166
+ expr: Any
167
+ pos: Pos
168
+
169
+
170
+ @dataclass
171
+ class IntLit:
172
+ value: int
173
+ pos: Pos
174
+
175
+
176
+ @dataclass
177
+ class FloatLit:
178
+ value: float
179
+ pos: Pos
180
+
181
+
182
+ @dataclass
183
+ class BoolLit:
184
+ value: bool
185
+ pos: Pos
186
+
187
+
188
+ @dataclass
189
+ class StringLit:
190
+ value: str
191
+ pos: Pos
192
+
193
+
194
+ @dataclass
195
+ class ArrayLit:
196
+ elements: List[Any]
197
+ pos: Pos
198
+
199
+
200
+ @dataclass
201
+ class Name:
202
+ name: str
203
+ pos: Pos
204
+
205
+
206
+ @dataclass
207
+ class BinOp:
208
+ op: str
209
+ left: Any
210
+ right: Any
211
+ pos: Pos
212
+
213
+
214
+ @dataclass
215
+ class UnaryOp:
216
+ op: str
217
+ operand: Any
218
+ pos: Pos
219
+
220
+
221
+ @dataclass
222
+ class Call:
223
+ func: Any
224
+ args: List[Any]
225
+ arg_names: Optional[List[Optional[str]]] = None
226
+ type_args: Optional[List[TypeExpr]] = None
227
+ pos: Optional[Pos] = None
228
+
229
+
230
+ @dataclass
231
+ class Member:
232
+ obj: Any
233
+ field: str
234
+ pos: Pos
235
+
236
+
237
+ @dataclass
238
+ class Index:
239
+ obj: Any
240
+ index: Any
241
+ pos: Pos