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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: varphi-devkit
3
- Version: 1.3.0
3
+ Version: 1.5.0
4
4
  Summary: A Python framework for creating compilers that target the Varphi language
5
5
  License: BSD-3-Clause
6
6
  Keywords: compiler,turing-machine,dsl,antlr,parser
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "varphi-devkit"
3
- version = "1.3.0"
3
+ version = "1.5.0"
4
4
  description = "A Python framework for creating compilers that target the Varphi language"
5
5
  authors = [
6
6
  {name = "Hassan El-Sheikha",email = "hmelsheikha@gmail.com"}
@@ -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
- logging.debug("Then direction: %s", then_direction)
91
- line = VarphiLine(if_state, tape_character, then_state, then_character, then_direction)
92
- logging.debug("Delegating to handleLine() helper method")
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