varphi-devkit 1.3.0__tar.gz → 1.5.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.
- {varphi_devkit-1.3.0 → varphi_devkit-1.5.0}/PKG-INFO +1 -1
- {varphi_devkit-1.3.0 → varphi_devkit-1.5.0}/pyproject.toml +1 -1
- {varphi_devkit-1.3.0 → varphi_devkit-1.5.0}/src/varphi_devkit/compilation.py +7 -13
- {varphi_devkit-1.3.0 → varphi_devkit-1.5.0}/src/varphi_devkit/model.py +2 -0
- {varphi_devkit-1.3.0 → varphi_devkit-1.5.0}/LICENSE +0 -0
- {varphi_devkit-1.3.0 → varphi_devkit-1.5.0}/README.md +0 -0
- {varphi_devkit-1.3.0 → varphi_devkit-1.5.0}/src/varphi_devkit/__init__.py +0 -0
- {varphi_devkit-1.3.0 → varphi_devkit-1.5.0}/src/varphi_devkit/syntax/Varphi.g4 +0 -0
- {varphi_devkit-1.3.0 → varphi_devkit-1.5.0}/src/varphi_devkit/syntax/__init__.py +0 -0
- {varphi_devkit-1.3.0 → varphi_devkit-1.5.0}/src/varphi_devkit/syntax/antlr/VarphiLexer.py +0 -0
- {varphi_devkit-1.3.0 → varphi_devkit-1.5.0}/src/varphi_devkit/syntax/antlr/VarphiListener.py +0 -0
- {varphi_devkit-1.3.0 → varphi_devkit-1.5.0}/src/varphi_devkit/syntax/antlr/VarphiParser.py +0 -0
- {varphi_devkit-1.3.0 → varphi_devkit-1.5.0}/src/varphi_devkit/syntax/antlr/__init__.py +0 -0
- {varphi_devkit-1.3.0 → varphi_devkit-1.5.0}/src/varphi_devkit/syntax/error_listener.py +0 -0
|
@@ -21,7 +21,6 @@ Functions:
|
|
|
21
21
|
compile: Parses a Varphi program and compiles it using the provided compiler.
|
|
22
22
|
"""
|
|
23
23
|
|
|
24
|
-
import logging
|
|
25
24
|
from abc import ABC, abstractmethod
|
|
26
25
|
|
|
27
26
|
from antlr4 import InputStream, CommonTokenStream, ParseTreeWalker
|
|
@@ -33,10 +32,6 @@ from .syntax.error_listener import VarphiSyntaxErrorListener
|
|
|
33
32
|
from .model import VarphiTapeCharacter, VarphiHeadDirection, VarphiLine
|
|
34
33
|
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
logger = logging.getLogger(__name__)
|
|
38
|
-
|
|
39
|
-
|
|
40
35
|
class VarphiCompiler(VarphiListener, ABC):
|
|
41
36
|
"""Abstract base class for compiling Varphi programs into target languages.
|
|
42
37
|
|
|
@@ -77,19 +72,18 @@ class VarphiCompiler(VarphiListener, ABC):
|
|
|
77
72
|
Args:
|
|
78
73
|
ctx: The ANTLR parser context for the line rule
|
|
79
74
|
"""
|
|
80
|
-
logging.debug("Entering line %s", ctx.start.line)
|
|
81
75
|
if_state = str(ctx.STATE(0).getText())
|
|
82
|
-
logging.debug("If state: %s", if_state)
|
|
83
76
|
tape_character = VarphiTapeCharacter(ctx.TAPE_CHARACTER(0).getText())
|
|
84
|
-
logging.debug("Tape character: %s", tape_character)
|
|
85
77
|
then_state = str(ctx.STATE(1).getText())
|
|
86
|
-
logging.debug("Then state: %s", then_state)
|
|
87
78
|
then_character = VarphiTapeCharacter(ctx.TAPE_CHARACTER(1).getText())
|
|
88
|
-
logging.debug("Then character: %s", then_character)
|
|
89
79
|
then_direction = VarphiHeadDirection(ctx.HEAD_DIRECTION().getText())
|
|
90
|
-
|
|
91
|
-
line = VarphiLine(if_state,
|
|
92
|
-
|
|
80
|
+
line_number_in_source = ctx.start.line
|
|
81
|
+
line = VarphiLine(if_state,
|
|
82
|
+
tape_character,
|
|
83
|
+
then_state,
|
|
84
|
+
then_character,
|
|
85
|
+
then_direction,
|
|
86
|
+
line_number_in_source)
|
|
93
87
|
self.handle_line(line)
|
|
94
88
|
|
|
95
89
|
|
|
@@ -45,9 +45,11 @@ class VarphiLine:
|
|
|
45
45
|
then_state: next state
|
|
46
46
|
then_character: character to write
|
|
47
47
|
then_direction: direction to move the head
|
|
48
|
+
line_number_in_source: the corresponding line number in the original source Varphi program
|
|
48
49
|
"""
|
|
49
50
|
if_state: str
|
|
50
51
|
if_character: VarphiTapeCharacter
|
|
51
52
|
then_state: str
|
|
52
53
|
then_character: VarphiTapeCharacter
|
|
53
54
|
then_direction: VarphiHeadDirection
|
|
55
|
+
line_number_in_source: int
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{varphi_devkit-1.3.0 → varphi_devkit-1.5.0}/src/varphi_devkit/syntax/antlr/VarphiListener.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|