Giter Club home page Giter Club logo

phpcompiler's Introduction

PhpCompiler

Run

php __main__.php -c filename.f

Example: filename.f

Source code

var1 = 4;
var2 = var1 + 3;

lexical tokens

[{"ID":"var1","line":1},{"OPERADORASIGNACION":"=","line":1},{"NUMERO":"4","line":1},{"PUNTOYCOMA":";","line":1},{"ID":"var2","line":2},{"OPERADORASIGNACION":"=","line":2},{"ID":"var1","line":2},{"OPERADOR":"+","line":2},{"NUMERO":"3","line":2},{"PUNTOYCOMA":";","line":2}]

syntax tree

<Programa>
β”œβ”€β”€β”€<Sentencia>
β”‚   └───<Asignacion>
β”‚       β”œβ”€β”€β”€ID (var1)
β”‚       β”œβ”€β”€β”€OPERADORASIGNACION (=)
β”‚       └───<Expresion>
β”‚           └───<ExpresionAritmetica>
β”‚               β”œβ”€β”€β”€NUMERO (4)
β”‚               └───<ExpresionAritmeticaFinal>
β”‚                   └───EPSILON
β”œβ”€β”€β”€PUNTOYCOMA (;)
└───<ProgramaFin>
    β”œβ”€β”€β”€<Sentencia>
    β”‚   └───<Asignacion>
    β”‚       β”œβ”€β”€β”€ID (var2)
    β”‚       β”œβ”€β”€β”€OPERADORASIGNACION (=)
    β”‚       └───<Expresion>
    β”‚           └───<ExpresionAritmetica>
    β”‚               β”œβ”€β”€β”€ID (var1)
    β”‚               └───<ExpresionAritmeticaFinal>
    β”‚                   β”œβ”€β”€β”€OPERADOR (+)
    β”‚                   └───<ExpresionAritmetica>
    β”‚                       β”œβ”€β”€β”€NUMERO (3)
    β”‚                       └───<ExpresionAritmeticaFinal>
    β”‚                           └───EPSILON
    β”œβ”€β”€β”€PUNTOYCOMA (;)
    └───<Programa>
        └───EPSILON

phpcompiler's People

Contributors

veronesi avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.