PHPackages                             phortugol/phortugol - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. phortugol/phortugol

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

phortugol/phortugol
===================

A Portugol interpreter written in PHP — the educational pseudocode language used in VisuAlg

v0.1.1(1mo ago)02↓88.9%MITPHPPHP ^8.5

Since Jun 2Pushed 1mo agoCompare

[ Source](https://github.com/phortugol/phortugol)[ Packagist](https://packagist.org/packages/phortugol/phortugol)[ RSS](/packages/phortugol-phortugol/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (10)Versions (3)Used By (0)

 [![Phortugol](art/banner.svg)](art/banner.svg)

 [![PHP Version](https://camo.githubusercontent.com/140267cec03492487ddf1b27d97eb73242fa0fff260b31930bd4daa764b2fbf6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e352d626c7565)](https://www.php.net) [![License: MIT](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE) [![PHPStan Level](https://camo.githubusercontent.com/d69a31811a54641ba38ddb2f984d47438b9445c92cb44c4f50061517b88b3c5f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068707374616e2d6c6576656c253230382d626c756576696f6c6574)](https://phpstan.org) [![Tests](https://camo.githubusercontent.com/67b41126d09b6aa20df0c24f1dbf47c71779e4c42ef80339e7002f65f9b02f37/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74657374732d706573742d6f72616e6765)](https://pestphp.com)

A Portugol interpreter written in PHP — the educational pseudocode language used in [VisuAlg](https://sourceforge.net/projects/visualg30/) and Brazilian CS classrooms.

> **Phortugol** = **PH**P + Por**tugol**

---

What is Portugol?
-----------------

[](#what-is-portugol)

Portugol is a Portuguese pseudocode language widely used in Brazilian computer science education. It reads like natural language, making it ideal for teaching programming fundamentals without the syntax overhead of a production language.

```
algoritmo "hello"
inicio
  escreva "Olá, mundo!"
fimalgoritmo
```

This package tokenizes, parses, and executes Portugol programs entirely in PHP — no `eval()`, no shell calls. Just a clean AST-walking interpreter.

---

Requirements
------------

[](#requirements)

- PHP 8.5+

---

Installation
------------

[](#installation)

```
composer require phortugol/phortugol
```

---

Usage
-----

[](#usage)

### Running a program

[](#running-a-program)

```
use Phortugol\Interpreter\Runner;
use Phortugol\Runtime\TerminalRuntime;

$source =
