Code Monkey home page Code Monkey logo

interpreter-compiler's Introduction

Interpreter-Compiler

Final Project - Compiler's Course- Using Bison and Flex

This compiler is using the following grammar:

prog → opt decls opt fun decls begin opt stmts end

opt decls → decls | ε

decls → dec ; decls | dec

dec → var id: tipo

opt fun decls → fun decls | ε

fun decls → fun dec; fun decls | fun dec

fun dec → fun id(opt params): tipo opt decls begin opt stmts end

opt params → param lst | ε

param lst → param, param lst | param

param → id : tipo

tipo → int | float

stmt → id ← expr | if (expresion)stmt | ifelse (expresion)stmt stmt | while (expresion)stmt | read id | print expr | begin opt stmts end | return expr

opt stmts → stmt lst | ε

stmt lst → stmt ; stmt lst | stmt

expresion → expr | expr relop expr

expr → expr + term | expr - term | signo term | term

term → term * factor | term / factor | factor

factor → ( expr ) | id | numint | numfloat | id(opt args)

opt args → arg lst | ε

arg lst → expr, arg lst | expr

relop → < | > | = | <= | >=

signo → ∼

Instructions to run:

Cmd line bison -d final.y flex final.l gcc lex.yy.c final.tab.c -o final

./final.exe

interpreter-compiler's People

Contributors

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