varphi-devkit 1.0.0__tar.gz → 1.1.4__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.
- {varphi_devkit-1.0.0 → varphi_devkit-1.1.4}/LICENSE +27 -27
- {varphi_devkit-1.0.0 → varphi_devkit-1.1.4}/PKG-INFO +1 -1
- {varphi_devkit-1.0.0 → varphi_devkit-1.1.4}/README.md +178 -178
- {varphi_devkit-1.0.0 → varphi_devkit-1.1.4}/pyproject.toml +110 -110
- {varphi_devkit-1.0.0 → varphi_devkit-1.1.4}/src/varphi_devkit/__init__.py +33 -33
- {varphi_devkit-1.0.0 → varphi_devkit-1.1.4}/src/varphi_devkit/compilation.py +119 -119
- {varphi_devkit-1.0.0 → varphi_devkit-1.1.4}/src/varphi_devkit/model.py +53 -53
- {varphi_devkit-1.0.0 → varphi_devkit-1.1.4}/src/varphi_devkit/syntax/Varphi.g4 +23 -23
- {varphi_devkit-1.0.0 → varphi_devkit-1.1.4}/src/varphi_devkit/syntax/__init__.py +28 -28
- {varphi_devkit-1.0.0 → varphi_devkit-1.1.4}/src/varphi_devkit/syntax/antlr/VarphiLexer.py +76 -76
- {varphi_devkit-1.0.0 → varphi_devkit-1.1.4}/src/varphi_devkit/syntax/antlr/VarphiListener.py +29 -29
- {varphi_devkit-1.0.0 → varphi_devkit-1.1.4}/src/varphi_devkit/syntax/antlr/VarphiParser.py +180 -180
- {varphi_devkit-1.0.0 → varphi_devkit-1.1.4}/src/varphi_devkit/syntax/antlr/__init__.py +21 -21
- {varphi_devkit-1.0.0 → varphi_devkit-1.1.4}/src/varphi_devkit/syntax/error_listener.py +79 -79
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
BSD 3-Clause License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025, Hassan El-Sheikha
|
|
4
|
-
|
|
5
|
-
Redistribution and use in source and binary forms, with or without
|
|
6
|
-
modification, are permitted provided that the following conditions are met:
|
|
7
|
-
|
|
8
|
-
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
-
list of conditions and the following disclaimer.
|
|
10
|
-
|
|
11
|
-
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
-
this list of conditions and the following disclaimer in the documentation
|
|
13
|
-
and/or other materials provided with the distribution.
|
|
14
|
-
|
|
15
|
-
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
-
contributors may be used to endorse or promote products derived from
|
|
17
|
-
this software without specific prior written permission.
|
|
18
|
-
|
|
19
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Hassan El-Sheikha
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
28
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1,178 +1,178 @@
|
|
|
1
|
-
# Varphi Development Kit
|
|
2
|
-
|
|
3
|
-
A Python framework for creating compilers that target the Varphi language - a domain-specific language for describing Turing machine transition rules.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
Varphi is a minimalist language designed to represent Turing machine programs using simple transition rules. The Varphi Development Kit provides a flexible compiler framework that allows you to build custom compilers to transform Varphi programs into any target format.
|
|
8
|
-
|
|
9
|
-
## Installation
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
pip install varphi-devkit
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
**Requirements:**
|
|
16
|
-
- Python ≥ 3.10
|
|
17
|
-
|
|
18
|
-
## Varphi Language Syntax
|
|
19
|
-
|
|
20
|
-
Varphi programs consist of transition rules with the following syntax:
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
STATE TAPE_CHARACTER STATE TAPE_CHARACTER HEAD_DIRECTION
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Where:
|
|
27
|
-
- **STATE**: Current/target state (format: `q` followed by alphanumeric characters, e.g., `q0`, `q_start`, `q1_accept`)
|
|
28
|
-
- **TAPE_CHARACTER**: Tape symbol (`0` for blank, `1` for marked)
|
|
29
|
-
- **HEAD_DIRECTION**: Head movement (`L` for left, `R` for right)
|
|
30
|
-
|
|
31
|
-
### Example Varphi Program
|
|
32
|
-
|
|
33
|
-
```varphi
|
|
34
|
-
// Simple addition-by-one program
|
|
35
|
-
q0 1 q0 1 R
|
|
36
|
-
q0 0 qHalt 1 R
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### Language Features
|
|
40
|
-
|
|
41
|
-
- **Comments**: Single-line (`//`) and multi-line (`/* */`) comments are supported
|
|
42
|
-
- **Whitespace**: Flexible whitespace handling (spaces, tabs, newlines)
|
|
43
|
-
- **States**: Flexible state naming with `q` prefix
|
|
44
|
-
|
|
45
|
-
## Core Architecture
|
|
46
|
-
|
|
47
|
-
The framework is built around these key components:
|
|
48
|
-
|
|
49
|
-
### Data Model
|
|
50
|
-
|
|
51
|
-
- **`VarphiTapeCharacter`**: Enum for tape symbols (`BLANK="0"`, `ONE="1"`)
|
|
52
|
-
- **`VarphiHeadDirection`**: Enum for head movement (`LEFT="L"`, `RIGHT="R"`)
|
|
53
|
-
- **`VarphiLine`**: Dataclass representing a transition rule with fields:
|
|
54
|
-
- `if_state`: Current state
|
|
55
|
-
- `if_condition`: Current tape character
|
|
56
|
-
- `then_state`: Next state
|
|
57
|
-
- `then_character`: Character to write
|
|
58
|
-
- `then_direction`: Direction to move
|
|
59
|
-
|
|
60
|
-
### Compiler Framework
|
|
61
|
-
|
|
62
|
-
- **`VarphiCompiler`**: Abstract base class for implementing custom compilers
|
|
63
|
-
- **`compile_varphi()`**: Function to parse and compile Varphi programs
|
|
64
|
-
- **`VarphiSyntaxError`**: Exception for syntax errors
|
|
65
|
-
|
|
66
|
-
## Usage
|
|
67
|
-
|
|
68
|
-
### Creating a Custom Compiler
|
|
69
|
-
|
|
70
|
-
To create a Varphi compiler, subclass `VarphiCompiler` and implement three methods:
|
|
71
|
-
|
|
72
|
-
```python
|
|
73
|
-
from varphi_devkit import VarphiCompiler, VarphiLine, compile_varphi
|
|
74
|
-
|
|
75
|
-
class MyCompiler(VarphiCompiler):
|
|
76
|
-
def __init__(self):
|
|
77
|
-
# Initialize your compiler's state
|
|
78
|
-
self.output = []
|
|
79
|
-
|
|
80
|
-
def handle_line(self, line: VarphiLine):
|
|
81
|
-
# Process each transition rule
|
|
82
|
-
self.output.append(f"Transition: {line.if_state} -> {line.then_state}")
|
|
83
|
-
|
|
84
|
-
def generate_compiled_program(self) -> str:
|
|
85
|
-
# Return the final compiled output
|
|
86
|
-
return "\n".join(self.output)
|
|
87
|
-
|
|
88
|
-
# Use your compiler
|
|
89
|
-
program = """
|
|
90
|
-
q0 0 q1 1 R
|
|
91
|
-
q1 1 q_halt 0 L
|
|
92
|
-
"""
|
|
93
|
-
|
|
94
|
-
compiler = MyCompiler()
|
|
95
|
-
result = compile_varphi(program, compiler)
|
|
96
|
-
print(result)
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
## Example Toy Compilers
|
|
100
|
-
|
|
101
|
-
The framework's test suite includes several [example compilers](/tests/toy_compilers) that demonstrate different use cases.
|
|
102
|
-
|
|
103
|
-
## Error Handling
|
|
104
|
-
|
|
105
|
-
The framework provides comprehensive syntax error reporting out of the box:
|
|
106
|
-
|
|
107
|
-
```python
|
|
108
|
-
from varphi_devkit import VarphiSyntaxError, compile_varphi
|
|
109
|
-
from your_compiler import YourCompiler
|
|
110
|
-
|
|
111
|
-
try:
|
|
112
|
-
result = compile_varphi("invalid syntax here", YourCompiler())
|
|
113
|
-
except VarphiSyntaxError as e:
|
|
114
|
-
print(f"Syntax error at line {e.line}, column {e.column}: {e.message}")
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
## API Reference
|
|
118
|
-
|
|
119
|
-
### Core Functions
|
|
120
|
-
|
|
121
|
-
#### `compile_varphi(program: str, compiler: VarphiCompiler) -> str`
|
|
122
|
-
|
|
123
|
-
Parses and compiles a Varphi program using the provided compiler.
|
|
124
|
-
|
|
125
|
-
- **Parameters:**
|
|
126
|
-
- `program`: Varphi source code as a string
|
|
127
|
-
- `compiler`: VarphiCompiler instance to process the program
|
|
128
|
-
- **Returns:** Compiled program output from the compiler
|
|
129
|
-
- **Raises:** `VarphiSyntaxError` for invalid syntax
|
|
130
|
-
|
|
131
|
-
### Abstract Base Class
|
|
132
|
-
|
|
133
|
-
#### `VarphiCompiler`
|
|
134
|
-
|
|
135
|
-
Abstract base class for implementing custom Varphi compilers.
|
|
136
|
-
|
|
137
|
-
**Abstract Methods:**
|
|
138
|
-
- `__init__(self) -> None`: Initialize compiler state
|
|
139
|
-
- `handle_line(self, line: VarphiLine) -> None`: Process a transition rule (line in the Varphi program)
|
|
140
|
-
- `generate_compiled_program(self) -> str`: Return final compiled output
|
|
141
|
-
|
|
142
|
-
### Data Classes
|
|
143
|
-
|
|
144
|
-
#### `VarphiLine`
|
|
145
|
-
|
|
146
|
-
Represents a single transition rule with attributes:
|
|
147
|
-
- `if_state: str` - Current state
|
|
148
|
-
- `if_condition: VarphiTapeCharacter` - Current tape character
|
|
149
|
-
- `then_state: str` - Next state
|
|
150
|
-
- `then_character: VarphiTapeCharacter` - Character to write
|
|
151
|
-
- `then_direction: VarphiHeadDirection` - Head movement direction
|
|
152
|
-
|
|
153
|
-
#### `VarphiTapeCharacter`
|
|
154
|
-
|
|
155
|
-
Enum for tape characters:
|
|
156
|
-
- `BLANK = "0"` - Empty tape cell
|
|
157
|
-
- `ONE = "1"` - Marked tape cell
|
|
158
|
-
|
|
159
|
-
#### `VarphiHeadDirection`
|
|
160
|
-
|
|
161
|
-
Enum for head movement:
|
|
162
|
-
- `LEFT = "L"` - Move head left
|
|
163
|
-
- `RIGHT = "R"` - Move head right
|
|
164
|
-
|
|
165
|
-
### Exceptions
|
|
166
|
-
|
|
167
|
-
#### `VarphiSyntaxError`
|
|
168
|
-
|
|
169
|
-
Exception raised for syntax errors in Varphi programs.
|
|
170
|
-
|
|
171
|
-
**Attributes:**
|
|
172
|
-
- `message: str` - Error description
|
|
173
|
-
- `line: int` - Line number where error occurred
|
|
174
|
-
- `column: int` - Column position of error
|
|
175
|
-
|
|
176
|
-
## License
|
|
177
|
-
|
|
178
|
-
This project is available under the BSD-3-Clause License (see [LICENSE](LICENSE)).
|
|
1
|
+
# Varphi Development Kit
|
|
2
|
+
|
|
3
|
+
A Python framework for creating compilers that target the Varphi language - a domain-specific language for describing Turing machine transition rules.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Varphi is a minimalist language designed to represent Turing machine programs using simple transition rules. The Varphi Development Kit provides a flexible compiler framework that allows you to build custom compilers to transform Varphi programs into any target format.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install varphi-devkit
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Requirements:**
|
|
16
|
+
- Python ≥ 3.10
|
|
17
|
+
|
|
18
|
+
## Varphi Language Syntax
|
|
19
|
+
|
|
20
|
+
Varphi programs consist of transition rules with the following syntax:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
STATE TAPE_CHARACTER STATE TAPE_CHARACTER HEAD_DIRECTION
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Where:
|
|
27
|
+
- **STATE**: Current/target state (format: `q` followed by alphanumeric characters, e.g., `q0`, `q_start`, `q1_accept`)
|
|
28
|
+
- **TAPE_CHARACTER**: Tape symbol (`0` for blank, `1` for marked)
|
|
29
|
+
- **HEAD_DIRECTION**: Head movement (`L` for left, `R` for right)
|
|
30
|
+
|
|
31
|
+
### Example Varphi Program
|
|
32
|
+
|
|
33
|
+
```varphi
|
|
34
|
+
// Simple addition-by-one program
|
|
35
|
+
q0 1 q0 1 R
|
|
36
|
+
q0 0 qHalt 1 R
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Language Features
|
|
40
|
+
|
|
41
|
+
- **Comments**: Single-line (`//`) and multi-line (`/* */`) comments are supported
|
|
42
|
+
- **Whitespace**: Flexible whitespace handling (spaces, tabs, newlines)
|
|
43
|
+
- **States**: Flexible state naming with `q` prefix
|
|
44
|
+
|
|
45
|
+
## Core Architecture
|
|
46
|
+
|
|
47
|
+
The framework is built around these key components:
|
|
48
|
+
|
|
49
|
+
### Data Model
|
|
50
|
+
|
|
51
|
+
- **`VarphiTapeCharacter`**: Enum for tape symbols (`BLANK="0"`, `ONE="1"`)
|
|
52
|
+
- **`VarphiHeadDirection`**: Enum for head movement (`LEFT="L"`, `RIGHT="R"`)
|
|
53
|
+
- **`VarphiLine`**: Dataclass representing a transition rule with fields:
|
|
54
|
+
- `if_state`: Current state
|
|
55
|
+
- `if_condition`: Current tape character
|
|
56
|
+
- `then_state`: Next state
|
|
57
|
+
- `then_character`: Character to write
|
|
58
|
+
- `then_direction`: Direction to move
|
|
59
|
+
|
|
60
|
+
### Compiler Framework
|
|
61
|
+
|
|
62
|
+
- **`VarphiCompiler`**: Abstract base class for implementing custom compilers
|
|
63
|
+
- **`compile_varphi()`**: Function to parse and compile Varphi programs
|
|
64
|
+
- **`VarphiSyntaxError`**: Exception for syntax errors
|
|
65
|
+
|
|
66
|
+
## Usage
|
|
67
|
+
|
|
68
|
+
### Creating a Custom Compiler
|
|
69
|
+
|
|
70
|
+
To create a Varphi compiler, subclass `VarphiCompiler` and implement three methods:
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from varphi_devkit import VarphiCompiler, VarphiLine, compile_varphi
|
|
74
|
+
|
|
75
|
+
class MyCompiler(VarphiCompiler):
|
|
76
|
+
def __init__(self):
|
|
77
|
+
# Initialize your compiler's state
|
|
78
|
+
self.output = []
|
|
79
|
+
|
|
80
|
+
def handle_line(self, line: VarphiLine):
|
|
81
|
+
# Process each transition rule
|
|
82
|
+
self.output.append(f"Transition: {line.if_state} -> {line.then_state}")
|
|
83
|
+
|
|
84
|
+
def generate_compiled_program(self) -> str:
|
|
85
|
+
# Return the final compiled output
|
|
86
|
+
return "\n".join(self.output)
|
|
87
|
+
|
|
88
|
+
# Use your compiler
|
|
89
|
+
program = """
|
|
90
|
+
q0 0 q1 1 R
|
|
91
|
+
q1 1 q_halt 0 L
|
|
92
|
+
"""
|
|
93
|
+
|
|
94
|
+
compiler = MyCompiler()
|
|
95
|
+
result = compile_varphi(program, compiler)
|
|
96
|
+
print(result)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Example Toy Compilers
|
|
100
|
+
|
|
101
|
+
The framework's test suite includes several [example compilers](/tests/toy_compilers) that demonstrate different use cases.
|
|
102
|
+
|
|
103
|
+
## Error Handling
|
|
104
|
+
|
|
105
|
+
The framework provides comprehensive syntax error reporting out of the box:
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from varphi_devkit import VarphiSyntaxError, compile_varphi
|
|
109
|
+
from your_compiler import YourCompiler
|
|
110
|
+
|
|
111
|
+
try:
|
|
112
|
+
result = compile_varphi("invalid syntax here", YourCompiler())
|
|
113
|
+
except VarphiSyntaxError as e:
|
|
114
|
+
print(f"Syntax error at line {e.line}, column {e.column}: {e.message}")
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## API Reference
|
|
118
|
+
|
|
119
|
+
### Core Functions
|
|
120
|
+
|
|
121
|
+
#### `compile_varphi(program: str, compiler: VarphiCompiler) -> str`
|
|
122
|
+
|
|
123
|
+
Parses and compiles a Varphi program using the provided compiler.
|
|
124
|
+
|
|
125
|
+
- **Parameters:**
|
|
126
|
+
- `program`: Varphi source code as a string
|
|
127
|
+
- `compiler`: VarphiCompiler instance to process the program
|
|
128
|
+
- **Returns:** Compiled program output from the compiler
|
|
129
|
+
- **Raises:** `VarphiSyntaxError` for invalid syntax
|
|
130
|
+
|
|
131
|
+
### Abstract Base Class
|
|
132
|
+
|
|
133
|
+
#### `VarphiCompiler`
|
|
134
|
+
|
|
135
|
+
Abstract base class for implementing custom Varphi compilers.
|
|
136
|
+
|
|
137
|
+
**Abstract Methods:**
|
|
138
|
+
- `__init__(self) -> None`: Initialize compiler state
|
|
139
|
+
- `handle_line(self, line: VarphiLine) -> None`: Process a transition rule (line in the Varphi program)
|
|
140
|
+
- `generate_compiled_program(self) -> str`: Return final compiled output
|
|
141
|
+
|
|
142
|
+
### Data Classes
|
|
143
|
+
|
|
144
|
+
#### `VarphiLine`
|
|
145
|
+
|
|
146
|
+
Represents a single transition rule with attributes:
|
|
147
|
+
- `if_state: str` - Current state
|
|
148
|
+
- `if_condition: VarphiTapeCharacter` - Current tape character
|
|
149
|
+
- `then_state: str` - Next state
|
|
150
|
+
- `then_character: VarphiTapeCharacter` - Character to write
|
|
151
|
+
- `then_direction: VarphiHeadDirection` - Head movement direction
|
|
152
|
+
|
|
153
|
+
#### `VarphiTapeCharacter`
|
|
154
|
+
|
|
155
|
+
Enum for tape characters:
|
|
156
|
+
- `BLANK = "0"` - Empty tape cell
|
|
157
|
+
- `ONE = "1"` - Marked tape cell
|
|
158
|
+
|
|
159
|
+
#### `VarphiHeadDirection`
|
|
160
|
+
|
|
161
|
+
Enum for head movement:
|
|
162
|
+
- `LEFT = "L"` - Move head left
|
|
163
|
+
- `RIGHT = "R"` - Move head right
|
|
164
|
+
|
|
165
|
+
### Exceptions
|
|
166
|
+
|
|
167
|
+
#### `VarphiSyntaxError`
|
|
168
|
+
|
|
169
|
+
Exception raised for syntax errors in Varphi programs.
|
|
170
|
+
|
|
171
|
+
**Attributes:**
|
|
172
|
+
- `message: str` - Error description
|
|
173
|
+
- `line: int` - Line number where error occurred
|
|
174
|
+
- `column: int` - Column position of error
|
|
175
|
+
|
|
176
|
+
## License
|
|
177
|
+
|
|
178
|
+
This project is available under the BSD-3-Clause License (see [LICENSE](LICENSE)).
|
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
[project]
|
|
2
|
-
name = "varphi-devkit"
|
|
3
|
-
version = "1.
|
|
4
|
-
description = "A Python framework for creating compilers that target the Varphi language"
|
|
5
|
-
authors = [
|
|
6
|
-
{name = "Hassan El-Sheikha",email = "hmelsheikha@gmail.com"}
|
|
7
|
-
]
|
|
8
|
-
readme = "README.md"
|
|
9
|
-
requires-python = ">=3.10"
|
|
10
|
-
keywords = ["compiler", "turing-machine", "dsl", "antlr", "parser"]
|
|
11
|
-
license = {text = "BSD-3-Clause"}
|
|
12
|
-
homepage = "https://github.com/varphi-lang/varphi-devkit"
|
|
13
|
-
repository = "https://github.com/varphi-lang/varphi-devkit"
|
|
14
|
-
classifiers = [
|
|
15
|
-
"Development Status :: 3 - Alpha",
|
|
16
|
-
"Intended Audience :: Developers",
|
|
17
|
-
"License :: OSI Approved :: MIT License",
|
|
18
|
-
"Programming Language :: Python :: 3",
|
|
19
|
-
"Programming Language :: Python :: 3.10",
|
|
20
|
-
"Programming Language :: Python :: 3.11",
|
|
21
|
-
"Programming Language :: Python :: 3.12",
|
|
22
|
-
"Topic :: Software Development :: Compilers",
|
|
23
|
-
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
24
|
-
]
|
|
25
|
-
dependencies = [
|
|
26
|
-
"antlr4-python3-runtime (>=4.13.2,<5.0.0)",
|
|
27
|
-
]
|
|
28
|
-
|
|
29
|
-
[tool.poetry]
|
|
30
|
-
packages = [{include = "varphi_devkit", from = "src"}]
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
[tool.poetry.group.dev.dependencies]
|
|
34
|
-
pytest = "^8.4.1"
|
|
35
|
-
pylint = "^3.3.7"
|
|
36
|
-
antlr4-tools = "^0.2.2"
|
|
37
|
-
python-semantic-release = "^10.2.0"
|
|
38
|
-
build = "^1.3.0"
|
|
39
|
-
twine = "^6.1.0"
|
|
40
|
-
|
|
41
|
-
[build-system]
|
|
42
|
-
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
|
43
|
-
build-backend = "poetry.core.masonry.api"
|
|
44
|
-
|
|
45
|
-
[semantic_release]
|
|
46
|
-
assets = []
|
|
47
|
-
build_command_env = []
|
|
48
|
-
commit_message = "{version}\n\nAutomatically generated by python-semantic-release"
|
|
49
|
-
commit_parser = "conventional"
|
|
50
|
-
logging_use_named_masks = false
|
|
51
|
-
major_on_zero = true
|
|
52
|
-
allow_zero_version = false
|
|
53
|
-
repo_dir = "."
|
|
54
|
-
no_git_verify = false
|
|
55
|
-
tag_format = "v{version}"
|
|
56
|
-
version_toml = ["pyproject.toml:project.version"]
|
|
57
|
-
|
|
58
|
-
[semantic_release.branches.main]
|
|
59
|
-
match = "(main|master)"
|
|
60
|
-
prerelease_token = "rc"
|
|
61
|
-
prerelease = false
|
|
62
|
-
|
|
63
|
-
[semantic_release.changelog]
|
|
64
|
-
exclude_commit_patterns = []
|
|
65
|
-
mode = "update"
|
|
66
|
-
insertion_flag = "<!-- version list -->"
|
|
67
|
-
template_dir = "templates"
|
|
68
|
-
|
|
69
|
-
[semantic_release.changelog.default_templates]
|
|
70
|
-
changelog_file = "CHANGELOG.md"
|
|
71
|
-
output_format = "md"
|
|
72
|
-
mask_initial_release = true
|
|
73
|
-
|
|
74
|
-
[semantic_release.changelog.environment]
|
|
75
|
-
block_start_string = "{%"
|
|
76
|
-
block_end_string = "%}"
|
|
77
|
-
variable_start_string = "{{"
|
|
78
|
-
variable_end_string = "}}"
|
|
79
|
-
comment_start_string = "{#"
|
|
80
|
-
comment_end_string = "#}"
|
|
81
|
-
trim_blocks = false
|
|
82
|
-
lstrip_blocks = false
|
|
83
|
-
newline_sequence = "\n"
|
|
84
|
-
keep_trailing_newline = false
|
|
85
|
-
extensions = []
|
|
86
|
-
autoescape = false
|
|
87
|
-
|
|
88
|
-
[semantic_release.commit_author]
|
|
89
|
-
env = "GIT_COMMIT_AUTHOR"
|
|
90
|
-
default = "semantic-release <semantic-release>"
|
|
91
|
-
|
|
92
|
-
[semantic_release.commit_parser_options]
|
|
93
|
-
minor_tags = ["feat"]
|
|
94
|
-
patch_tags = ["fix", "perf"]
|
|
95
|
-
other_allowed_tags = ["build", "chore", "ci", "docs", "style", "refactor", "test"]
|
|
96
|
-
allowed_tags = ["feat", "fix", "perf", "build", "chore", "ci", "docs", "style", "refactor", "test"]
|
|
97
|
-
default_bump_level = 0
|
|
98
|
-
parse_squash_commits = true
|
|
99
|
-
ignore_merge_commits = true
|
|
100
|
-
|
|
101
|
-
[semantic_release.remote]
|
|
102
|
-
name = "origin"
|
|
103
|
-
type = "github"
|
|
104
|
-
ignore_token_for_push = false
|
|
105
|
-
insecure = false
|
|
106
|
-
|
|
107
|
-
[semantic_release.publish]
|
|
108
|
-
dist_glob_patterns = ["dist/*"]
|
|
109
|
-
upload_to_vcs_release = true
|
|
110
|
-
|
|
1
|
+
[project]
|
|
2
|
+
name = "varphi-devkit"
|
|
3
|
+
version = "1.1.4"
|
|
4
|
+
description = "A Python framework for creating compilers that target the Varphi language"
|
|
5
|
+
authors = [
|
|
6
|
+
{name = "Hassan El-Sheikha",email = "hmelsheikha@gmail.com"}
|
|
7
|
+
]
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
keywords = ["compiler", "turing-machine", "dsl", "antlr", "parser"]
|
|
11
|
+
license = {text = "BSD-3-Clause"}
|
|
12
|
+
homepage = "https://github.com/varphi-lang/varphi-devkit"
|
|
13
|
+
repository = "https://github.com/varphi-lang/varphi-devkit"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Topic :: Software Development :: Compilers",
|
|
23
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
24
|
+
]
|
|
25
|
+
dependencies = [
|
|
26
|
+
"antlr4-python3-runtime (>=4.13.2,<5.0.0)",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[tool.poetry]
|
|
30
|
+
packages = [{include = "varphi_devkit", from = "src"}]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
[tool.poetry.group.dev.dependencies]
|
|
34
|
+
pytest = "^8.4.1"
|
|
35
|
+
pylint = "^3.3.7"
|
|
36
|
+
antlr4-tools = "^0.2.2"
|
|
37
|
+
python-semantic-release = "^10.2.0"
|
|
38
|
+
build = "^1.3.0"
|
|
39
|
+
twine = "^6.1.0"
|
|
40
|
+
|
|
41
|
+
[build-system]
|
|
42
|
+
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
|
43
|
+
build-backend = "poetry.core.masonry.api"
|
|
44
|
+
|
|
45
|
+
[semantic_release]
|
|
46
|
+
assets = []
|
|
47
|
+
build_command_env = []
|
|
48
|
+
commit_message = "{version}\n\nAutomatically generated by python-semantic-release"
|
|
49
|
+
commit_parser = "conventional"
|
|
50
|
+
logging_use_named_masks = false
|
|
51
|
+
major_on_zero = true
|
|
52
|
+
allow_zero_version = false
|
|
53
|
+
repo_dir = "."
|
|
54
|
+
no_git_verify = false
|
|
55
|
+
tag_format = "v{version}"
|
|
56
|
+
version_toml = ["pyproject.toml:project.version"]
|
|
57
|
+
|
|
58
|
+
[semantic_release.branches.main]
|
|
59
|
+
match = "(main|master)"
|
|
60
|
+
prerelease_token = "rc"
|
|
61
|
+
prerelease = false
|
|
62
|
+
|
|
63
|
+
[semantic_release.changelog]
|
|
64
|
+
exclude_commit_patterns = []
|
|
65
|
+
mode = "update"
|
|
66
|
+
insertion_flag = "<!-- version list -->"
|
|
67
|
+
template_dir = "templates"
|
|
68
|
+
|
|
69
|
+
[semantic_release.changelog.default_templates]
|
|
70
|
+
changelog_file = "CHANGELOG.md"
|
|
71
|
+
output_format = "md"
|
|
72
|
+
mask_initial_release = true
|
|
73
|
+
|
|
74
|
+
[semantic_release.changelog.environment]
|
|
75
|
+
block_start_string = "{%"
|
|
76
|
+
block_end_string = "%}"
|
|
77
|
+
variable_start_string = "{{"
|
|
78
|
+
variable_end_string = "}}"
|
|
79
|
+
comment_start_string = "{#"
|
|
80
|
+
comment_end_string = "#}"
|
|
81
|
+
trim_blocks = false
|
|
82
|
+
lstrip_blocks = false
|
|
83
|
+
newline_sequence = "\n"
|
|
84
|
+
keep_trailing_newline = false
|
|
85
|
+
extensions = []
|
|
86
|
+
autoescape = false
|
|
87
|
+
|
|
88
|
+
[semantic_release.commit_author]
|
|
89
|
+
env = "GIT_COMMIT_AUTHOR"
|
|
90
|
+
default = "semantic-release <semantic-release>"
|
|
91
|
+
|
|
92
|
+
[semantic_release.commit_parser_options]
|
|
93
|
+
minor_tags = ["feat"]
|
|
94
|
+
patch_tags = ["fix", "perf"]
|
|
95
|
+
other_allowed_tags = ["build", "chore", "ci", "docs", "style", "refactor", "test"]
|
|
96
|
+
allowed_tags = ["feat", "fix", "perf", "build", "chore", "ci", "docs", "style", "refactor", "test"]
|
|
97
|
+
default_bump_level = 0
|
|
98
|
+
parse_squash_commits = true
|
|
99
|
+
ignore_merge_commits = true
|
|
100
|
+
|
|
101
|
+
[semantic_release.remote]
|
|
102
|
+
name = "origin"
|
|
103
|
+
type = "github"
|
|
104
|
+
ignore_token_for_push = false
|
|
105
|
+
insecure = false
|
|
106
|
+
|
|
107
|
+
[semantic_release.publish]
|
|
108
|
+
dist_glob_patterns = ["dist/*"]
|
|
109
|
+
upload_to_vcs_release = true
|
|
110
|
+
|