Михаил Капелько 1 month ago
parent
commit
110b44030d
7 changed files with 11 additions and 3 deletions
  1. +0
    -0
      _translator-C++-Swift/Function.py
  2. +0
    -0
      _translator-C++-Swift/Type.py
  3. +0
    -0
      _translator-C++-Swift/process.py
  4. +0
    -0
      _translator-C++-Swift/translate
  5. +0
    -0
      main-2.cpp
  6. +1
    -3
      main.py
  7. +10
    -0
      pythonToC++

translator-C++-Swift/Function.py → _translator-C++-Swift/Function.py View File


translator-C++-Swift/Type.py → _translator-C++-Swift/Type.py View File


translator-C++-Swift/process.py → _translator-C++-Swift/process.py View File


translator-C++-Swift/translate → _translator-C++-Swift/translate View File


+ 0
- 0
main-2.cpp View File


+ 1
- 3
main.py View File

@@ -3,9 +3,7 @@

# L4: Function.

def memory_generateConstPlayfield(
n: int
) -> dict[int, int]:
def memory_generateConstPlayfield(n: int) -> dict[int, int]:
idGroups: dict[int, int] = { }
id = 0
for gid in range(0, n):


+ 10
- 0
pythonToC++ View File

@@ -0,0 +1,10 @@
IN=main.py
OUT=main-2.cpp

# Simple check. TODO REMOVE later
sed 's|# L4: Function.|// L4: Function.|' $IN > $OUT

# dict[X, Y] -> std::map<X, Y>
sed -E 's|dict\[(.*), (.*)\]|std::map<\1, \2>|' $IN > $OUT
# def functionName(X) -> Y -> Y functionName(X) {
sed -E 's|def (.*) -> (.*):|\2 \1 {|' $OUT > $OUT

Loading…
Cancel
Save