Git Product home page Git Product logo

compilers's Introduction

Compilers

This is a Course assignment of Compilers in FCAI - Cairo University.

Description

Assignment-1

Write a C++ code that does the following:

  • You are not allowed to use any built-in functions except: cstdlib, cstdio, cstring, iostream.
  • You are not allowed to use string class, vector, or anything from STL libraries.
  • Modify the file CompilersTask_3_CodeGenerator.cpp to include a & operator, which is absoulte differenece, that is 3&5=2 5&3=2
  • This operator has left associativity, and it has higher precedence than +,- and lower precedence than *, /
  • Write an input tiny program and include it inside a comment,which contains several test cases (at least 20 statements involving operators) that explain its usage and proves correctness of using this operator with other operators.
  • Half the mark is dedicatd to comments explaining the code before each code line (for only the part of the code which you added), test cases (at least 20 statements involving operators) that cover a lot of cases, and following the CodingStyle.pdf file.

Assignment-2

  • Write a C++ code that does the following:
  • You are not allowed to use any built-in functions except: cstdlib, cstdio, cstring, iostream.
  • You are not allowed to use string class, vector, or anything from STL libraries.
  • Modify the file CompilersTask_3_CodeGenerator.cpp to include 3 data types, int real bool
  • real should correspond to "double" in C++.
  • All variables MUST be declared at the beginning of the program (example: int x;real y). -
  • It is possible to use boolean variable inside the if and repeat condition.
  • It is not allowed to do arithmetic operations on boolean variables.
  • It is allowed to do arithmetic operations on int, real variables such that, in the same expression, all variables are of the same type.
  • It is not allowed to assign variables of different types.
  • All cases not allowed above should produce meaningful compiler error message. You can use exceptions.
  • If there is a case not mentioned above, just do whatever you believe it is meaningful.
  • Write an input tiny program and include it inside a comment, which contains several test cases (at least 20 statements involving variables) that explain its usage and proves correctness of using variables.
  • Half the mark is dedicatd to comments explaining the code before each code line (for only the part of the code which you added), test cases (at least 20 statements nvolving operators) that cover a lot of cases, and following the CodingStyle.pdf file.

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.