GithubHelp home page GithubHelp logo

myfun-compilers's Introduction

Struttura del progetto

All'interno della repository vi sono diverse directory:

  • hand-coded-lexer: contine il progetto relativo al primo assignment del corso, ovvero produrre un lexer a mano. L'esercitazione si basava sul simulare un NFA tramite l'utilizzo del costrutto switch;
  • jflex-coded-lexer: contiene il progetto relativo al secondo assignment del corso, ovvero riprodurre l'esercitazione uno tramite l'utilizzo del tool JFlex;
  • hand-coded-parser: contiene il progetto relativo al terzo assignment del corso, ovvero produrre un parser a mano. L'esercitazione si basava sulla produzione di una funzione booleane per ogni non terminale, producendo in questo modo un parser a discesa ricorsiva;
  • myfun-language: contiene il progetto relativo al quarto e quinto assignment del corso, ovvero un compilatore completo per il linguaggio MyFun. Tramite l'utilizzo di JFlex e JCup, viene costruito quello che รจ l'Abstact Syntax Tree del linguaggio. Una volta prodotto l'AST, vengono utilizzati due implementazioni dell'interfaccia Visitor, utili per l'analisi semantica e la traduzione del codice in linguaggio C;
  • documentation: contiene la documentazione relativa al quarto e quinto assignment.

Modifiche apportate al linguaggio

All'interno del linguaggio MyFun รจ possibile effettuare l'overload delle funzioni. Risulta invece impossibile assegnare valori non costanti alle variabili locali al di fuori del corpo del main o di una funzione.
Di seguito sono riportate tutte le modifiche effettuate al type system della traccia.

Type system

Chiamata a funzione


If then else

Istruzione read


Istruzione write

Operazioni binarie





Operazioni unarie


Tabella optype1

Relativa alle operazioni PLUS, MINUS, TIMES, DIV, POW.

integer real bool string
integer integer real - -
real real real - -
bool - - - -
string - - - -

Tabella optype2

Relative alle operazioni EQ, NE, LT, LE, GT, GE.

integer real bool string
integer bool bool - -
real bool bool - -
bool - - bool -
string - - - bool

Tabella optype3

Relative all'operazione unaria MINUS.

integer real bool string
minus integer real - -

myfun-compilers's People

Contributors

antonio-cirillo avatar

Stargazers

 avatar

Watchers

 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.