Code Monkey home page Code Monkey logo

lexerlx's Introduction

lexerlx

Simple analizador léxico desarrollado en PHP, de un simple y corto pseudolenguaje, el cual no cuenta con mas de 15 lexemas.

Especificaciones

Se trata de un Lenguaje en Pseudo-código, el cual tiene las siguientes características:

  • -- No utiliza los tradicionales PUNTO Y COMA (;) para indicar el fin de una línea.
  • -- Las palabras reservadas y los símbolos están en una lista, la cual permite la facilidad de poder añadir elementos en un futuro.
  • -- Los identificadores se validan en un AFD.
  • -- Fue desarrollado bajo la tecnología PHP , Codificado en el Editor SUBLIME TEXT 2.
  • -- La codificación del Lexer usa 2 clases: Lexer.class.php y StringTokenizer.class.php.

AFD de los Identificadores

El anterior AFD plantea que los identificadores NO pueden comenzar por DIGITO, pueden empezar por 1 ó 2 GUION_BAJO, no puede comenzar por 3 o más. Además, NO permite GUION_BAJO en otra parte distinta al inicio. Puede contener DIGITO solo si antes ya tiene o LETRA o GUION_BAJO.

Ejemplo de palabras permitidas por el AFD : edad, _clave, __constructor, _2, apellido2.

Ejemplo de palabras NO permitidas por el AFD : 5edad, clave_, _constructor_, apellido_2.

TABLA DE TRANSICIONES DEL AFD

ESTADOS LETRA DIGITO GUION_BAJO ACEPTADO?
0 3 FALSO 1 FALSO
1 3 3 2 FALSO
2 3 FALSO FALSO FALSO
3 3 3 FALSO VERDADERO

TABLA DE LOS LEXEMAS Y TIPOS DE CADA TOKEN DEL LENGUAJE LX

LEXEMA TIPO
" COMILLA_DOBLE
* MULTIPLICACION
+ SUMA
- RESTA
/ DIVISION
= IGUAL
> MAYOR_QUE
< MENOR_QUE
entero TIPO_DATO_ENTERO
cadena TIPO_DATO_CADENA
si ESTRUCTURA_CONDICIONAL_IF
entonces THEN
escriba ESCRITURA
fin FIN_ESTRUCTURA_CONTROL

lexerlx's People

Contributors

jeanbenitez avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.