A small subset of PHP implemented in Rust. 🐘

Overview

microphp

A small subset of PHP implemented in Rust.

About

This project aims to implement a small subset of PHP's feature-set using a Rust powered parser and virtual machine.

It uses a recursive-descent parser based on binding power similar to PHP's own precedence model. The interpreter is a bytecode virtual machine where the AST is compiled into a series of bytecode operations and constants. The virtual machine is stack-based, whereas PHP's Zend Engine is a register-based machine.

Both engines share similar opcodes making implementation of features much simpler as the structure and flow of the program can essentially be replicated.

Supported Features

  • Strings (surrounded by double-quotes)
  • A handful of binary and boolean operations.
  • If/else statements (no else if support)
  • While statements (along with break)
  • User-defined functions (no default parameter values or type declarations)
  • Internal / native functions

Optimisations

  • Use a Vec<Value> and store each variable against an index, instead of storing things in a HashMap.
  • Intern strings to reduce memory consumption.
  • Make arrays a little bit better (string keys and maintain insertion order).
You might also like...
Multiple precision floating point numbers implemented purely in Rust.

Multiple precision floating point numbers implemented purely in Rust. Rationale There are several notable implementations of numbers with increased pr

Rust Crate that allows to do interruptions in console. Will be implemented to functional terminal customization kit.

termpause Rust Crate that allows to do interruptions in console. Will be implemented to functional terminal customization kit. Usage Add this in your

A fast, simple and lightweight Bloom filter library for Python, fully implemented in Rust.

rBloom A fast, simple and lightweight Bloom filter library for Python, fully implemented in Rust. It's designed to be as pythonic as possible, mimicki

An Interpreter for Brainfuck programming language implemented in the Rust programming language with zero dependencies.

Brainfuck Hello, Visitor! Hey there, welcome to my project showcase website! It's great to have you here. I hope you're ready to check out some awesom

A version control system implemented from scratch in Rust.

Version Control An experiment to write a version control system from scratch in Rust. CLI Usage Usage: revtool COMMAND Commands: init initia

Introduction to Algorithms (implemented in Go, Rust, Erlang, and Clojure)

Algorithms Working through Introduction to Algorithms, 4th Edition and implementing the algorithms in: Go Rust Erlang Clojure While keeping a diary an

A very tiny terminal snake game, purely implemented in Rust.
A very tiny terminal snake game, purely implemented in Rust.

tiny-snake.rs A very tiny terminal snake game, purely implemented in Rust. Features Optimized binary has only 2760 bytes. No dependencies. Not even li

A AV1 video decoder implemented in pure rust.

Rust AV1 Decoder A AV1 decoder implemented in pure rust. This is an experimental project currently in progress. Unlike existing projects, this is an A

Escrow program implemented in Anchor
Escrow program implemented in Anchor

Anchor Example: Escrow Program See this doc for more implementation details Overview Since this program is extended from the original Escrow Program,

Owner
Ryan Chandler
Ryan Chandler
Use any async Rust library from PHP!

php-tokio - Use any async Rust library from PHP! Created by Daniil Gentili (@danog). This library allows you to use any async rust library from PHP, a

Daniil Gentili 242 Sep 7, 2023
Lapce plugin for the Php language.

lapce-php-intelephense Lapce plugin for the Php language. Prerequisites Install Intelephense, typically by running: $ npm i intelephense -g Settings S

null 3 Jan 9, 2023
A superset of PHP with extended syntax and runtime capabilities.

PXP PXP is a superset of the PHP programming language that provides an extended set of syntax rules and language features to improve developer experie

PXP 188 Jan 29, 2023
A opinionated and fast static analyzer for PHP.

TLDR; A static analyzer for PHP. It helps you catch common mistakes in your PHP code. These are the current checks implemented. Extending undefined cl

Denzyl Dick 11 Mar 6, 2023
PHP++ short for redditlang is a language created by the r/ProgrammerHumor subreddit discord members

RedditLang PHL ( ProgrammerHumor language ) or RedditLang is a language created by the r/ProgrammerHumor discord! The spec is avaliable here Why Reddi

elijah629 10 Jun 23, 2023
j is a limited subset of J, an array programming language

j is a limited subset of J, an array programming language. this file is an accompanying essay.

katelyn martin 7 Nov 8, 2023
A small CLI tool to query ArcGIS REST API services, implemented in Rust. The server response is returned as pretty JSON.

A small CLI tool to query ArcGIS REST API services, implemented in Rust. The server response is returned as pretty JSON.

Andrew Vitale 2 Apr 25, 2022
Prefix tree implemented in Rust.

Prefix tree implemented in rust. A simple library that provides a prefix tree (trie) implementation. It uses generic types for both keys and values. p

Bailey 0 Dec 8, 2021
A Unix shell written and implemented in rust 🦀

vsh A Blazingly fast shell made in Rust ?? Installation Copy and paste the following command and choose the appropriate installtion method for you. Yo

XMantle 89 Dec 18, 2022
A fork of V8Js re-implemented in Rust

PHP-V8Js PHP-V8Js is a PHP extension for the V8 JavaScript engine. It is a re-implementation of the fantastic (though unmaintained) V8Js PHP extension

Joe Hoyle 13 Jan 2, 2023