wen-lang 0.2.0a1__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.
- wen_lang-0.2.0a1/LICENSE +21 -0
- wen_lang-0.2.0a1/PKG-INFO +206 -0
- wen_lang-0.2.0a1/README.md +175 -0
- wen_lang-0.2.0a1/pyproject.toml +20 -0
- wen_lang-0.2.0a1/setup.cfg +4 -0
- wen_lang-0.2.0a1/src/__init__.py +0 -0
- wen_lang-0.2.0a1/src/compiler/__init__.py +0 -0
- wen_lang-0.2.0a1/src/compiler/codegen.py +446 -0
- wen_lang-0.2.0a1/src/compiler/semantic.py +315 -0
- wen_lang-0.2.0a1/src/lexer/__init__.py +0 -0
- wen_lang-0.2.0a1/src/lexer/lexer.py +195 -0
- wen_lang-0.2.0a1/src/main.py +102 -0
- wen_lang-0.2.0a1/src/parser/__init__.py +0 -0
- wen_lang-0.2.0a1/src/parser/parser.py +406 -0
- wen_lang-0.2.0a1/src/runtime/__init__.py +0 -0
- wen_lang-0.2.0a1/src/runtime/runtime.py +0 -0
- wen_lang-0.2.0a1/tests/test_lexer.py +0 -0
- wen_lang-0.2.0a1/tests/test_wen.py +178 -0
- wen_lang-0.2.0a1/wen_lang.egg-info/PKG-INFO +206 -0
- wen_lang-0.2.0a1/wen_lang.egg-info/SOURCES.txt +21 -0
- wen_lang-0.2.0a1/wen_lang.egg-info/dependency_links.txt +1 -0
- wen_lang-0.2.0a1/wen_lang.egg-info/entry_points.txt +2 -0
- wen_lang-0.2.0a1/wen_lang.egg-info/top_level.txt +1 -0
wen_lang-0.2.0a1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Leknox1189
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wen-lang
|
|
3
|
+
Version: 0.2.0a1
|
|
4
|
+
Summary: Wen programming language compiler with LLVM native code generation
|
|
5
|
+
License: MIT License
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2026 Leknox1189
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
26
|
+
|
|
27
|
+
Requires-Python: >=3.10
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# Wen Programming Language
|
|
33
|
+
|
|
34
|
+
**Wen** is an experimental, Python-inspired programming language that compiles source code into native executables using LLVM.
|
|
35
|
+
|
|
36
|
+
The initial release, **v0.1**, targets Apple Silicon (ARM64) on macOS.
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- Variable declarations using `let`
|
|
41
|
+
- Integer and string values
|
|
42
|
+
- Boolean values
|
|
43
|
+
- Arithmetic operations: `+`, `-`, `*`, `/`, `%`
|
|
44
|
+
- Comparisons: `==`, `!=`, `<`, `>`, `<=`, `>=`
|
|
45
|
+
- Output using `print()`
|
|
46
|
+
- Conditional statements: `if` and `else`
|
|
47
|
+
- Loops using `while`
|
|
48
|
+
- Variable assignment
|
|
49
|
+
- Semantic analysis
|
|
50
|
+
- LLVM intermediate representation generation
|
|
51
|
+
- Native executable compilation
|
|
52
|
+
|
|
53
|
+
## Requirements
|
|
54
|
+
|
|
55
|
+
- macOS on Apple Silicon (ARM64)
|
|
56
|
+
- Python 3
|
|
57
|
+
- LLVM and Clang
|
|
58
|
+
- Homebrew (recommended for installing LLVM)
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
Install LLVM using Homebrew:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
brew install llvm
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Clone the repository:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
git clone https://github.com/lampard1189-hub/Wen-Script.git
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Enter the project directory:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
cd Wen-Script
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Running Wen
|
|
81
|
+
|
|
82
|
+
Create a source file with the `.wen` extension.
|
|
83
|
+
|
|
84
|
+
Example:
|
|
85
|
+
|
|
86
|
+
```wen
|
|
87
|
+
let name = "Wen"
|
|
88
|
+
let version = 1
|
|
89
|
+
|
|
90
|
+
print(name)
|
|
91
|
+
print(version)
|
|
92
|
+
print("Welcome to Wen!")
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Compile the program:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
python3 src/main.py examples/hello.wen
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Run the generated executable:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
./build/hello
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Control Flow Example
|
|
108
|
+
|
|
109
|
+
```wen
|
|
110
|
+
let age = 20
|
|
111
|
+
|
|
112
|
+
if age >= 18 {
|
|
113
|
+
print("Adult")
|
|
114
|
+
} else {
|
|
115
|
+
print("Under 18")
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
let count = 1
|
|
119
|
+
|
|
120
|
+
while count <= 5 {
|
|
121
|
+
print(count)
|
|
122
|
+
count = count + 1
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Project Structure
|
|
127
|
+
|
|
128
|
+
```text
|
|
129
|
+
Wen/
|
|
130
|
+
├── examples/
|
|
131
|
+
│ ├── hello.wen
|
|
132
|
+
│ ├── arithmetic.wen
|
|
133
|
+
│ └── control.wen
|
|
134
|
+
├── src/
|
|
135
|
+
│ ├── lexer/
|
|
136
|
+
│ │ └── lexer.py
|
|
137
|
+
│ ├── parser/
|
|
138
|
+
│ │ └── parser.py
|
|
139
|
+
│ ├── compiler/
|
|
140
|
+
│ │ ├── codegen.py
|
|
141
|
+
│ │ └── semantic.py
|
|
142
|
+
│ ├── runtime/
|
|
143
|
+
│ │ └── runtime.py
|
|
144
|
+
│ └── main.py
|
|
145
|
+
├── tests/
|
|
146
|
+
│ └── test_wen.py
|
|
147
|
+
├── build/
|
|
148
|
+
└── README.md
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Testing
|
|
152
|
+
|
|
153
|
+
Run the automated test suite:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
python3 -m unittest discover -s tests -v
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Compilation Pipeline
|
|
160
|
+
|
|
161
|
+
Wen currently follows this compilation process:
|
|
162
|
+
|
|
163
|
+
```text
|
|
164
|
+
Wen Source Code
|
|
165
|
+
|
|
|
166
|
+
v
|
|
167
|
+
Lexer
|
|
168
|
+
|
|
|
169
|
+
v
|
|
170
|
+
Parser
|
|
171
|
+
|
|
|
172
|
+
v
|
|
173
|
+
Semantic Analysis
|
|
174
|
+
|
|
|
175
|
+
v
|
|
176
|
+
LLVM Codegen
|
|
177
|
+
|
|
|
178
|
+
v
|
|
179
|
+
LLVM IR
|
|
180
|
+
|
|
|
181
|
+
v
|
|
182
|
+
Native Executable
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Current Development Status
|
|
186
|
+
|
|
187
|
+
**Version:** 0.1.0
|
|
188
|
+
|
|
189
|
+
**Status:** Experimental initial release.
|
|
190
|
+
|
|
191
|
+
The current implementation is focused on integer operations, strings, variables, comparisons and basic control flow.
|
|
192
|
+
|
|
193
|
+
Future development may include:
|
|
194
|
+
|
|
195
|
+
- Functions
|
|
196
|
+
- User-defined types
|
|
197
|
+
- Better error messages
|
|
198
|
+
- Floating-point arithmetic
|
|
199
|
+
- Additional target architectures
|
|
200
|
+
- More advanced memory management
|
|
201
|
+
- Expanded standard library
|
|
202
|
+
|
|
203
|
+
## License
|
|
204
|
+
|
|
205
|
+
See the `LICENSE` file for licensing information.
|
|
206
|
+
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Wen Programming Language
|
|
2
|
+
|
|
3
|
+
**Wen** is an experimental, Python-inspired programming language that compiles source code into native executables using LLVM.
|
|
4
|
+
|
|
5
|
+
The initial release, **v0.1**, targets Apple Silicon (ARM64) on macOS.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- Variable declarations using `let`
|
|
10
|
+
- Integer and string values
|
|
11
|
+
- Boolean values
|
|
12
|
+
- Arithmetic operations: `+`, `-`, `*`, `/`, `%`
|
|
13
|
+
- Comparisons: `==`, `!=`, `<`, `>`, `<=`, `>=`
|
|
14
|
+
- Output using `print()`
|
|
15
|
+
- Conditional statements: `if` and `else`
|
|
16
|
+
- Loops using `while`
|
|
17
|
+
- Variable assignment
|
|
18
|
+
- Semantic analysis
|
|
19
|
+
- LLVM intermediate representation generation
|
|
20
|
+
- Native executable compilation
|
|
21
|
+
|
|
22
|
+
## Requirements
|
|
23
|
+
|
|
24
|
+
- macOS on Apple Silicon (ARM64)
|
|
25
|
+
- Python 3
|
|
26
|
+
- LLVM and Clang
|
|
27
|
+
- Homebrew (recommended for installing LLVM)
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
Install LLVM using Homebrew:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
brew install llvm
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Clone the repository:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
git clone https://github.com/lampard1189-hub/Wen-Script.git
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Enter the project directory:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
cd Wen-Script
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Running Wen
|
|
50
|
+
|
|
51
|
+
Create a source file with the `.wen` extension.
|
|
52
|
+
|
|
53
|
+
Example:
|
|
54
|
+
|
|
55
|
+
```wen
|
|
56
|
+
let name = "Wen"
|
|
57
|
+
let version = 1
|
|
58
|
+
|
|
59
|
+
print(name)
|
|
60
|
+
print(version)
|
|
61
|
+
print("Welcome to Wen!")
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Compile the program:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
python3 src/main.py examples/hello.wen
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Run the generated executable:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
./build/hello
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Control Flow Example
|
|
77
|
+
|
|
78
|
+
```wen
|
|
79
|
+
let age = 20
|
|
80
|
+
|
|
81
|
+
if age >= 18 {
|
|
82
|
+
print("Adult")
|
|
83
|
+
} else {
|
|
84
|
+
print("Under 18")
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
let count = 1
|
|
88
|
+
|
|
89
|
+
while count <= 5 {
|
|
90
|
+
print(count)
|
|
91
|
+
count = count + 1
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Project Structure
|
|
96
|
+
|
|
97
|
+
```text
|
|
98
|
+
Wen/
|
|
99
|
+
├── examples/
|
|
100
|
+
│ ├── hello.wen
|
|
101
|
+
│ ├── arithmetic.wen
|
|
102
|
+
│ └── control.wen
|
|
103
|
+
├── src/
|
|
104
|
+
│ ├── lexer/
|
|
105
|
+
│ │ └── lexer.py
|
|
106
|
+
│ ├── parser/
|
|
107
|
+
│ │ └── parser.py
|
|
108
|
+
│ ├── compiler/
|
|
109
|
+
│ │ ├── codegen.py
|
|
110
|
+
│ │ └── semantic.py
|
|
111
|
+
│ ├── runtime/
|
|
112
|
+
│ │ └── runtime.py
|
|
113
|
+
│ └── main.py
|
|
114
|
+
├── tests/
|
|
115
|
+
│ └── test_wen.py
|
|
116
|
+
├── build/
|
|
117
|
+
└── README.md
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Testing
|
|
121
|
+
|
|
122
|
+
Run the automated test suite:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
python3 -m unittest discover -s tests -v
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Compilation Pipeline
|
|
129
|
+
|
|
130
|
+
Wen currently follows this compilation process:
|
|
131
|
+
|
|
132
|
+
```text
|
|
133
|
+
Wen Source Code
|
|
134
|
+
|
|
|
135
|
+
v
|
|
136
|
+
Lexer
|
|
137
|
+
|
|
|
138
|
+
v
|
|
139
|
+
Parser
|
|
140
|
+
|
|
|
141
|
+
v
|
|
142
|
+
Semantic Analysis
|
|
143
|
+
|
|
|
144
|
+
v
|
|
145
|
+
LLVM Codegen
|
|
146
|
+
|
|
|
147
|
+
v
|
|
148
|
+
LLVM IR
|
|
149
|
+
|
|
|
150
|
+
v
|
|
151
|
+
Native Executable
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Current Development Status
|
|
155
|
+
|
|
156
|
+
**Version:** 0.1.0
|
|
157
|
+
|
|
158
|
+
**Status:** Experimental initial release.
|
|
159
|
+
|
|
160
|
+
The current implementation is focused on integer operations, strings, variables, comparisons and basic control flow.
|
|
161
|
+
|
|
162
|
+
Future development may include:
|
|
163
|
+
|
|
164
|
+
- Functions
|
|
165
|
+
- User-defined types
|
|
166
|
+
- Better error messages
|
|
167
|
+
- Floating-point arithmetic
|
|
168
|
+
- Additional target architectures
|
|
169
|
+
- More advanced memory management
|
|
170
|
+
- Expanded standard library
|
|
171
|
+
|
|
172
|
+
## License
|
|
173
|
+
|
|
174
|
+
See the `LICENSE` file for licensing information.
|
|
175
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "wen-lang"
|
|
7
|
+
version = "0.2.0a1"
|
|
8
|
+
description = "Wen programming language compiler with LLVM native code generation"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {file = "LICENSE"}
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
dependencies = []
|
|
13
|
+
|
|
14
|
+
[project.scripts]
|
|
15
|
+
wen = "src.main:main"
|
|
16
|
+
|
|
17
|
+
[tool.setuptools.packages.find]
|
|
18
|
+
where = ["."]
|
|
19
|
+
include = ["src*"]
|
|
20
|
+
namespaces = false
|
|
File without changes
|
|
File without changes
|