├── .coveragerc ├── .gitignore ├── .travis.yml ├── INSTALL.rst ├── LICENSE ├── MANIFEST.in ├── README.rst ├── appveyor.yml ├── data ├── icons │ ├── logo-32x32.png │ ├── logo-64x64.png │ ├── pytuga.svg │ └── text-x-pytuga.svg ├── mime │ ├── pynguin.mime │ └── pynguin.sharedmimeinfo ├── pytg.xml ├── pytuga-avatar.svg ├── pytuga-logo.png ├── pytuga-simple-logo.svg ├── pytuga.desktop └── pytuga.lang ├── dependencies.txt ├── docs ├── Makefile ├── conf.py ├── dev.rst ├── index.rst ├── install.rst ├── license.rst ├── python.rst ├── referencia.rst └── tutorial.rst ├── requirements.txt ├── setup.py ├── src └── pytuga │ ├── __init__.py │ ├── __main__.py │ ├── assets │ ├── kernel.js │ ├── logo-32x32.png │ └── logo-64x64.png │ ├── curses.py │ ├── keywords.py │ ├── lexer.py │ └── transpyler.py ├── tests ├── __init__.py ├── _test_documentation.py ├── test_core.py ├── test_errors.py ├── test_keywords.py ├── test_language.py ├── test_pytugacore.py ├── test_runtime.py ├── test_tuga_io.py ├── test_tuga_math.py └── test_tuga_std.py └── tox.ini /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | include = src/* 3 | branch = True 4 | 5 | 6 | [report] 7 | # Regexes for lines to exclude from consideration 8 | exclude_lines = 9 | # Have to re-enable the standard pragma 10 | pragma: no cover 11 | 12 | # Don't complain about missing debug-only code: 13 | def __repr__ 14 | if self\.debug 15 | 16 | # Don't complain if tests don't hit defensive assertion code: 17 | raise AssertionError 18 | raise NotImplementedError 19 | return NotImplemented 20 | 21 | # Don't complain if non-runnable code isn't run: 22 | if 0: 23 | if False: 24 | if __name__ == .__main__.: 25 | while 0: 26 | while False: 27 | 28 | ignore_errors = True 29 | 30 | 31 | [paths] 32 | source = src/ -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Cached builds 2 | __pycache__/ 3 | *.pyc 4 | *.pyo 5 | *.pyd 6 | *.so 7 | *.dll 8 | *.egg 9 | *.egg-info/ 10 | .cache/ 11 | .coverage 12 | .coverage.xml 13 | 14 | # Build directories 15 | docs/_build/ 16 | build/ 17 | dist/ 18 | 19 | # Python-boilerplate auto generated files 20 | src/transpyler/__meta__.py 21 | 22 | # IDEs 23 | .idea/ 24 | .settings/ 25 | 26 | # Testing and temporary files 27 | .tox/ 28 | .pytest_cache/ 29 | 30 | # MAC OS files 31 | .DS_Store 32 | 33 | # Coverage 34 | htmlcov/ 35 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | cache: pip 3 | dist: trusty 4 | 5 | # Environment variables 6 | env: 7 | TEST_QT=false 8 | 9 | # Test environments 10 | matrix: 11 | include: 12 | - env: TOXENV=py34 13 | python: 3.4 14 | #- env: TOXENV=py35 15 | # python: 3.5 16 | #- env: TOXENV=py36 17 | # python: 3.6 18 | 19 | # Prepare installation 20 | addons: 21 | apt: 22 | sources: 23 | sdfsd 24 | 25 | 26 | before_install: 27 | - sudo apt-get update 28 | - sudo apt-get -qq install python3-pyqt5 python3-pyqt5.qsci 29 | 30 | # Package installation 31 | install: 32 | - apt-get install python3-pyqt5 33 | - pip install tox codecov 34 | 35 | # Run tests 36 | script: 37 | - tox 38 | 39 | # Register code coverage in coveralls 40 | after_success: 41 | - codecov -------------------------------------------------------------------------------- /INSTALL.rst: -------------------------------------------------------------------------------- 1 | ========== 2 | Instalação 3 | ========== 4 | 5 | 6 | Pytuguês se baseia e é implementado em Python 3. Antes da instalação completa do 7 | Pytuguês, é necessário instalar antes algumas bibliotecas adicionais 8 | do Python. As instruções de instalação diferem ligeiramente em cada plataforma. 9 | 10 | 11 | ----- 12 | Linux 13 | ----- 14 | 15 | Você precisa do Python3 e do PyQt5. Existe uma chance razoável que ambos 16 | estejam instalados. Se sua distribuição for baseada no Debian/Ubuntu, 17 | basta fazer download do arquivo dependencies.txt e executar o comando abaixo 18 | para que todas as bibliotecas necessárias sejam instaladas:: 19 | 20 | $ sudo apt-get install $(cat dependencies.txt) 21 | 22 | Se quiser apenas fazer a instalação local, o comando fica:: 23 | 24 | $ pip3 install pytuga --user 25 | 26 | (Ignore a opção --user, caso queira instalar para todos os usuários. Neste caso 27 | é necessário executar o comando como *sudo*.). Uma vez instalado, você pode 28 | atualizar a versão do Pytuguês executando:: 29 | 30 | $ pip3 install pytuga -U --user 31 | 32 | O script de instalação salva os arquivos executáveis na pasta ``~/.local/bin.`` 33 | e na pasta ``~/bin/``, se a mesma existir. 34 | 35 | 36 | ------- 37 | Windows 38 | ------- 39 | 40 | Existem duas opções de instalação no Windows. A primeira funciona somente para 41 | o Windows 64bits e consiste em baixar o arquivo auto-executável do pytuga__. 42 | Baixe este arquivo em qualquer lugar do seu computador e execute-o com um clique 43 | duplo. 44 | 45 | .. __: http://tinyurl.com/pytg-exe 46 | 47 | A segunda opção consiste em baixar os pacotes do Python 3.4 e PyQt5 manualmente 48 | e realizar a instalação via pip. Para isto, escolha os instaladores correspondentes 49 | à sua versão do windows. 50 | 51 | 32 bits 52 | ------- 53 | 54 | * `Python 3.4`__ 55 | * PyQt5__ 56 | 57 | .. __: https://www.python.org/ftp/python/3.4.4/python-3.4.4.msi 58 | .. __: https://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.5.1/PyQt5-5.5.1-gpl-Py3.4-Qt5.5.1-x32.exe 59 | 60 | 61 | 64 bits 62 | ------- 63 | 64 | * `Python 3.4`__ 65 | * PyQt5__ 66 | 67 | .. __: https://www.python.org/ftp/python/3.4.4/python-3.4.4.amd64.msi 68 | .. __: https://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.5.1/PyQt5-5.5.1-gpl-Py3.4-Qt5.5.1-x64.exe 69 | 70 | É importante marcar a opção "Add python.exe to your path" durante a instalação. 71 | Isto facilitará a execução do Pytuguês posteriormente. Depois de terminada a 72 | instalação, abra o terminal do Windows (Win+R e digite "cmd") e execute os 73 | comandos:: 74 | 75 | python -m pip install pytuga -U 76 | 77 | Se o código anterior não funcionar, provavelmente significa que o Python não 78 | está no caminho padrão de procura do Windows. Se este for o caso, é necessário 79 | mudar para o diretório onde o Python estiver instalado. Digite:: 80 | 81 | cd c:\Python34\ 82 | 83 | Agora repita os comandos anteriores. Se você decidiu instalar o Python em 84 | outro caminho, modifique o comando acima para indicar o caminho correto. 85 | 86 | Para executar em modo gráfico, aperte Win+R e digite "pytuga" no prompt. Caso 87 | isto não funcione (especialmente nas versões mais novas do Windows), procure 88 | o executável do tugalinhas na pasta ``c:\Python34\Scripts\`` ou execute o 89 | comando ``python -m pytuga`` do terminal. 90 | 91 | ========== 92 | Configurando Ambiente de Desenvolvimento 93 | ========== 94 | 95 | Para contribuir deve-se usar git clone e fork nos projetos transpyler, qturtle e pytuga no link 96 | oficial do repositório https://github.com/Transpyler:: 97 | 98 | $ git clone url_your_fork.git 99 | 100 | Em cada um você pode adicionar o remote do repositório oficial, para manter seu fork sempre 101 | atualizado:: 102 | 103 | $ git remote add upstream url_oficial_repo.git 104 | 105 | Uma vez clonado os três repositórios, na ordem transpyler qturtle pytuga, 106 | execute o seguinte comando:: 107 | 108 | $ python3 setup.py develop --user 109 | 110 | Atenção: A sequência de instalação *transpyler - qturtle - pytuga* deve ser obedecida, 111 | pois garante a integridade das dependencias. 112 | 113 | Caso queira desinstalar, basta:: 114 | 115 | pip3 uninstall pytuga transpyler qturtle 116 | 117 | Então você pode executar usando:: 118 | 119 | $ pytuga 120 | 121 | Ou como módulo do python:: 122 | 123 | $ python3 -m pytuga 124 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Pytuga. Um Python com sotaque lusitano. 2 | Copyright (C) 2017 Fábio Macêdo Mendes 3 | 4 | This program is free software: you can redistribute it and/or modify it under 5 | the terms of the GNU General Public License as published by the Free Software 6 | Foundation, either version 3 of the License, or (at your option) any later 7 | version. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY 10 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 11 | PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program. If not, see . -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include VERSION 2 | include README.rst 3 | include INSTALL.rst 4 | include setup.cfg 5 | recursive-include data *.* 6 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | .. image:: https://travis-ci.org/pwener/pytuga.svg?branch=master 2 | :target: https://travis-ci.org/pwener/pytuga 3 | 4 | .. image:: https://codecov.io/gh/transpyler-mes/pytuga/branch/master/graph/badge.svg 5 | :target: https://codecov.io/gh/transpyler-mes/pytuga 6 | 7 | ======== 8 | Pytuguês 9 | ======== 10 | 11 | Pytuguês é uma versão da linguagem de programação Python que tenta se aproximar 12 | o máximo possível de um *pseudo-código* em português. A motivação principal em 13 | aprender Pytuguês é evitar as barreiras com a língua inglesa quando iniciamos 14 | a aprender programação. Uma vantagem do Pytuguês com relação a outras soluções 15 | semelhantes é que a transição para uma linguagem de programação de uso comum é 16 | bastante suave, já que é possível misturar código Python e Pytuguês no mesmo 17 | programa. 18 | 19 | A sintaxe da linguagem de programação Python muitas vezes é comparada a um 20 | *pseudo-código* ou algorítimo executável. Ainda que existam alguns recursos 21 | sintáticos avançados que certamente violam esta simplicidade, o Python 22 | provavelmente é uma das linguagens de programação de uso geral com a sintaxe 23 | mais próxima da linguagem natural. Programas em Python frequentemente se 24 | assemelham muito a uma descrição (em inglês) do algorítmo que ele implementa. 25 | Com o Pytuguês, esta facilidade também se aplica aos falantes da língua de 26 | Camões. 27 | 28 | Assim como o Python, o Pytuguês é uma linguagem dinâmica que não precisa ser 29 | compilada. O código é executado diretamente pelo interpretador ou ainda pode 30 | ser criado em modo interativo no estilo REPL (read/eval/print/loop, do inglês 31 | loop de ler, avaliar e imprimir). Neste modo, o interpretador executa 32 | imediatamente os comandos digitados pelo usuário e já mostra o resultado na 33 | tela. 34 | 35 | Este pacote instala o "pytuga", que consiste em um ambiente de programação 36 | visual, no estilo da linguagem LOGO. Para começar sua interação com o Pytuguês, 37 | execute no prompt 38 | ``$ pytuga``. Uma vez aberta a janela do terminal de Pytuguês, digite o 39 | comando:: 40 | 41 | >>> mostre("olá, mundo!") 42 | 43 | Boa programação! 44 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | # We are using Appveyor.io to build our Windows Python packages. Check 2 | # instructions at https://packaging.python.org/appveyor 3 | environment: 4 | global: 5 | TEST_QT: false 6 | matrix: 7 | #- PYTHON: "C:\\Python34" 8 | # TOXENV: 'py34' 9 | 10 | #- PYTHON: "C:\\Python34-x64" 11 | # TOXENV: 'py34' 12 | 13 | #- PYTHON: "C:\\Python35" 14 | # TOXENV: 'py35' 15 | 16 | #- PYTHON: "C:\\Python35-x64" 17 | # TOXENV: 'py35' 18 | 19 | - PYTHON: "C:\\Python36" 20 | TOXENV: 'py36' 21 | 22 | - PYTHON: "C:\\Python36-x64" 23 | TOXENV: 'py36' 24 | 25 | install: 26 | - "%PYTHON%\\python.exe -m pip install pip -U --user" 27 | - "%PYTHON%\\python.exe -m pip install tox wheel cx_Freeze pynsist PyQt5 --user" 28 | - "%PYTHON%\\python.exe -m pip install pytugacore --user" 29 | - "%PYTHON%\\python.exe -m pip install qturtle --user" 30 | - "%PYTHON%\\python.exe -m pip install pygments --user" 31 | - "%PYTHON%\\python.exe -m pip install -e . --user" 32 | 33 | build_script: 34 | - ECHO "skip build" 35 | #- "%PYTHON%\\python.exe setup.py build" 36 | 37 | test_script: 38 | - ECHO "skip test" 39 | #- "%PYTHON%\\python.exe -m tox" 40 | 41 | after_test: 42 | - '%PYTHON%\\python.exe setup.py build_exe --cx-freeze' 43 | - '%PYTHON%\\python.exe setup.py bdist_msi --cx-freeze' 44 | - ps: "mv build/exe* build/pytuga" 45 | - "%PYTHON%\\python.exe -m zipfile -c pytuga.zip build/pytuga/" 46 | - ps: "mv pytuga.zip dist/" 47 | #- "%PYTHON%\\python.exe -m nsist installer.cfg" 48 | #- "%PYTHON%\\python.exe setup.py bdist_wininst" 49 | #- "%PYTHON%\\python.exe setup.py bdist_wheel" 50 | 51 | artifacts: 52 | - path: dist\* 53 | 54 | #on_success: 55 | # - TODO: upload the content of dist/*.whl to a public wheelhouse 56 | -------------------------------------------------------------------------------- /data/icons/logo-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Transpyler/pytuga/6c4ea7054d3154f81498238a97761401e6ca90e2/data/icons/logo-32x32.png -------------------------------------------------------------------------------- /data/icons/logo-64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Transpyler/pytuga/6c4ea7054d3154f81498238a97761401e6ca90e2/data/icons/logo-64x64.png -------------------------------------------------------------------------------- /data/icons/pytuga.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 23 | 25 | 35 | 37 | 41 | 45 | 46 | 56 | 58 | 62 | 66 | 67 | 69 | 73 | 77 | 78 | 89 | 92 | 96 | 100 | 101 | 110 | 111 | 133 | 135 | 136 | 138 | image/svg+xml 139 | 141 | 142 | 143 | 144 | 145 | 150 | 153 | 158 | 163 | 169 | 175 | 178 | 185 | 192 | 199 | 200 | 201 | 202 | 203 | -------------------------------------------------------------------------------- /data/icons/text-x-pytuga.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 23 | 25 | 35 | 37 | 41 | 45 | 46 | 56 | 58 | 62 | 66 | 67 | 69 | 73 | 77 | 78 | 89 | 92 | 96 | 100 | 101 | 110 | 111 | 133 | 135 | 136 | 138 | image/svg+xml 139 | 141 | 142 | 143 | 144 | 145 | 150 | 153 | 158 | 163 | 169 | 175 | 178 | 185 | 192 | 199 | 200 | 201 | 202 | 203 | -------------------------------------------------------------------------------- /data/mime/pynguin.mime: -------------------------------------------------------------------------------- 1 | application/x-pytuga; pytuga %s; ; test=test -n "$DISPLAY" 2 | -------------------------------------------------------------------------------- /data/mime/pynguin.sharedmimeinfo: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Pytuga 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /data/pytg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /data/pytuga-avatar.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 21 | 23 | 24 | 26 | image/svg+xml 27 | 29 | 30 | 31 | 32 | 33 | 63 | 65 | 68 | 72 | 76 | 77 | 79 | 83 | 87 | 88 | 90 | 94 | 98 | 99 | 102 | 106 | 110 | 111 | 114 | 118 | 122 | 123 | 125 | 129 | 133 | 134 | 141 | 143 | 147 | 151 | 152 | 154 | 158 | 162 | 163 | 165 | 169 | 173 | 174 | 176 | 180 | 184 | 185 | 187 | 191 | 195 | 196 | 198 | 202 | 206 | 207 | 216 | 225 | 235 | 245 | 255 | 265 | 275 | 285 | 296 | 306 | 317 | 326 | 327 | 330 | 333 | 339 | 345 | 351 | 354 | 361 | 368 | 375 | 376 | 377 | 378 | 379 | -------------------------------------------------------------------------------- /data/pytuga-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Transpyler/pytuga/6c4ea7054d3154f81498238a97761401e6ca90e2/data/pytuga-logo.png -------------------------------------------------------------------------------- /data/pytuga-simple-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 21 | 23 | 24 | 26 | image/svg+xml 27 | 29 | 30 | 31 | 32 | 33 | 62 | 64 | 67 | 71 | 75 | 76 | 78 | 82 | 86 | 87 | 89 | 93 | 97 | 98 | 101 | 105 | 109 | 110 | 113 | 117 | 121 | 122 | 124 | 128 | 132 | 133 | 140 | 142 | 146 | 150 | 151 | 153 | 157 | 161 | 162 | 164 | 168 | 172 | 173 | 175 | 179 | 183 | 184 | 186 | 190 | 194 | 195 | 197 | 201 | 205 | 206 | 215 | 224 | 234 | 244 | 254 | 264 | 274 | 284 | 295 | 305 | 315 | 326 | 337 | 346 | 347 | 350 | 352 | 357 | 362 | 369 | 375 | 381 | 384 | 391 | 398 | 405 | 406 | 407 | 408 | 409 | -------------------------------------------------------------------------------- /data/pytuga.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Encoding=UTF-8 3 | MimeType=text/plain; 4 | Type=Application 5 | Exec=tugalinhas %u 6 | Icon=pytuga 7 | Comment=Pytuguês programming language 8 | Terminal=false 9 | Name=Pytuga 10 | Categories=Application;ComputerScience;Education; 11 | GenericName=Pytuguês programming language 12 | GenericName[pt_BR]=Programação em português 13 | -------------------------------------------------------------------------------- /data/pytuga.lang: -------------------------------------------------------------------------------- 1 | 2 | 24 | 25 | 26 | *.pytg 27 | # 28 | 29 | 30 | 31 |