Skip to content

A python transpiler that translates Slovenian python (Piton) to normal python. 🐍

License

Notifications You must be signed in to change notification settings

Anzlc/slovenian-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slovenian Python (Piton) 🐍

A simple python transpiler written in Rust. It introduces Slovenian translations for keywords and some built-in function.

Keywords

| Slovenian   | English   |
|-------------|-----------|
| definiraj   | def       |
| za          | for       |
| v           | in        |
| dokler      | while     |
| vključi     | import    |
| iz          | from      |
| vrni        | return    |
| natisni     | print     |
| obseg       | range     |
| kot         | as        |
| vnos        | input     |
| če          | if        |
| drugače     | else      |
| drugačeče   | elif      |
| in          | and       |
| ali         | or        |
| razred      | class     |
| preveri     | assert    |
| zlomi       | break     |
| nadaljuj    | continue  |
| izbriši     | del       |
| razen       | except    |
| Ne          | False     |
| Da          | True      |
| končno      | finally   |
| globalno    | global    |
| je          | is        |
| Nič         | None      |
| nelokalen   | nonlocal  |
| ne          | not       |
| brez        | pass      |
| dvigni      | raise     |
| poskusi     | try       |
| z           | with      |
| dajaj       | yield     |

How does it work

I built a simple tokenizer that splits keywords while keeping parts like string intact. Then I loop through all keywords and translate them using a hashmap.

How to use

If you want to use this program it is very simple download the .exe from Releases tab and if you want to use it anywhere add the file to Path. To run the code you must have Python installed on your system. Then you can simply run

piton [PATH]

Other options:

-t, --transpile PATH
                        Create a python file from .spy
-r, --run PATH      Run the .spy program
-p, --preview PATH  Preview transpiled .spy program
-h, --help          Get help (output this screen)

Syntax highlighting

If you want some basic syntax highlighting you can istalll VS Code extension from this repo. Go to releases and download the latest version. Then open extensions panel and click the 3-dots and select Install from VSIX.... Then select the downloaded file.

Example

vključi random kot r

ugib = int(vnos("Vnesi št od 1-10: "))

naključna = r.randrange(1, 10)

dokler ugib != naključna:
    če ugib > naključna:
        natisni("Preveč")
    drugače:
        natisni("Premalo")
    ugib = int(vnos("Vnesi št od 1-10: "))
natisni(f"Bravo, naključna št je bila {naključna}")

Contributing

If you find any bugs or issues open an Issue or make a pr.

About

A python transpiler that translates Slovenian python (Piton) to normal python. 🐍

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages