Coder Social home page Coder Social logo

jesusjimsa / formal-languages-automata-and-compilers-uaic Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 186 KB

Exercises for the subject of Formal Languages, Automata and Compilers in UAIC in Iași.

License: GNU General Public License v3.0

Lex 10.99% Yacc 87.77% Makefile 1.16% Roff 0.09%
compiler yacc lex

formal-languages-automata-and-compilers-uaic's Introduction

Formal Languages Automata and Compilers UAIC

Design of an original programming language

Design an original programming language and provide a syntactic analyzer for it, using YACC. Your language should be statically typed and should include:

  • variable declarations, constant declarations (different kind of constants), function declarations and definitions
  • user defined data types (similar to classes in object orientated languages, but with your own syntax); provide specific syntax for working with these types
  • array types
  • control statements (if, for, while, etc.), assignment statements
  • arithmetic and boolean expressions with complex operands
  • operations with string types
  • function calls which can have as parameters: expressions, other function calls, identifiers, constants, etc.
  • A predefined function called print which has a parameter of an integer type

Besides the syntactic analysis of the program, you should also provide semantic analysis as follows:

  • you should check that any variable that appears in a program has been previously defined;
  • a variable should not be declared more than once;
  • a variable appearing in the right side of an expression should have been initialized explicitly.
  • a function is not defined more than once with the same signature
  • a function that is called in the program has been defined
  • type checking - make sure that:
    • the left side of an assignment has the same type as the right side
    • the parameters of a function call have the types from the function definition

Error messages should be provided if these conditions do not hold.
You must provide the evaluation of arithmetic expressions in a program; if a program in syntactically and semantically correct, for every call of the form print(expr), the actual value of expr will be printed, otherwise only the errors will showed.

formal-languages-automata-and-compilers-uaic's People

Contributors

jesusjimsa avatar jmrcalvo avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

formal-languages-automata-and-compilers-uaic's Issues

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.