Skip to content

MrSemyon12/py-to-js-translator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

from Python to JS translator

Transpiler from Python to JavaScript. Includes transpiler module which performs all logic and a simple web interface to interact with.

To run the project locally use following commands python3.9 required:

git clone https://github.com/MrSemyon12/py-to-js-translator.git
cd py-to-js-translator
python -m venv venv
.\venv\Scripts\activate.bat
pip install -r requirements.txt
python .\code\webapp\app.py

After that you can check localhost:5000

Available constructions

  • Binary operators = / + * - and or == != < > <= >=
example = -5 * 1.44 + 7 / -0.62
example = True and -5 or 0 and 8.42 > 9
  • Math functions sin cos tan sqrt abs
example = math.sin(-0.005 + abs(0.1 / -66))
  • Strings
example = "hello" + 'world'
  • Loops while
example = 10
while example >= 4 and math.sin(example) != math.cos(4):
    example = example - 1
    while True:
        example = 5
  • Console output
print(4 + math.sqrt(2))
  • Conditional orerator if else
if 5 < 0:
    print('hello')
    if True:
        print(8)
    else:
        age = 9