Cps translator for python, Python Programming

Assignment Help:

Your task is to construct a translator from the subset of Python in Project 3 intocontinuation-passing style (CPS).

Of course, the expected way of accomplishing this is to translate HIR into CPS.

It is tedious to translate HIR directly to CPS. It is strongly recommended that you push HIR into a desugaring phase--dropping it down to LIR first.

1. You can use any language you want for this project, but you must be able to run your program under Linux or Mac OS X. Once again, non-functional languages are at a steep expressiveness disadvantage, and will require substantially more time and code invested. Please plan and request help accordingly.

2. If the TA or I can't get your code to run, we'll ask you to help us get it running.

1. You must translate the same simplified subset of Python from the Project 2 less the additional restrictions from Project 3.

2. You should assume that Python source is coming in, not pre-lexed, pre-parsed input or pre-translated input.

3. If you need to use a working lexer, you can assume that the programpylex is in the current PATH, and that it matches the behavior of the web app by consuming a file on STDIN and printing its tokens as S-Expressions line-by-line on STDOUT.

4. If you need to use a working parser, you can assume that the programpyparse is in the current PATH, and that it matches the behavior of the web app by consuming a tokenized input on STDIN and printing the AST on stdout.

5. If you need to use a working HIR translator, you can assume that the program pytrans is in the current PATH, and that it matches the behavior of the bytecode app by a Python AST on STDIN and printing the HIR AST on stdout.

6. The output should fit within the grammar for CPS.

7. Include a README.txt file that contains:

1. your name;

2. a list of software dependencies necessary to run your assignment;

3. a description of what you got working, what's partially working and what's completely broken; and

4. a manifest briefly (a few words) describing each file you've turned.

8. Every source code file you turn in needs to have your name and student number at the top and the bottom in comments.

9. The program should use a Makefile:

1. make should compile the program (if compilation is necessary).

2. make run should accept Python code on STDIN and send CPS code toSTDOUT.

3. make test should run any test cases you used.

10. The program should output one S-expression containing the CPS code. The output for invalid input is undefined, but it is recommended that you print an error message containing the word error on failure.

11. Your output need not match the reference implementation exactly. It should be semantically equivalent (unless the reference implementation has a bug).

12. When CPS-converting, the continuation argument always comes last, even for primitive operations.

13. You can also test your output against a Python 3.x interpreter.


Related Discussions:- Cps translator for python

Turtle graphics module in python programming language, Your assignment for ...

Your assignment for the semester will involve the development of a system for drawing trees using the Python programming language and the turtle graphics module (turtle.py). Comple

Example of python code, Worked example 1   Let's examine what  happens...

Worked example 1   Let's examine what  happens when  we compute the following Python code:   def p(x, y): z = x*x - y return z + 1/z   >>> p(1.0, 2.0) -2.0

#title.display of vanderwaals isotherm, draw the variation of pressure with...

draw the variation of pressure with volume of a real gas at temperatures lower than its critical temperature.also draw its surface of discontinuity

Normalize a vector, Normalize a vector Let's imagine we want  to norma...

Normalize a vector Let's imagine we want  to normalize a vector  of three  variables;  that  is to compute a new  vector  of three values,  such that its size  is 1. Here is o

A method defination , De?nition   A method de?nition has the abstrac...

De?nition   A method de?nition has the abstract form: def ( , ..., ): ...   There are essentially three parts: is a name for

Help, When investing money, an important concept to know is compound intere...

When investing money, an important concept to know is compound interest. The equation FV = PV (1+rate)periods . This relates the following four quantities. The present value (

If statements, how do you make an if and else statment work in pytho?

how do you make an if and else statment work in pytho?

Bit Stuffing, How to write program on bit stuffing using python?

How to write program on bit stuffing using python?

Procedures as in First-class objects, Procedures as first-class objects ...

Procedures as first-class objects In Python, unlike  many  other  languages, methods are behave in much  the same way as num­ bers:  they  can be stored as values  of variable

Program to solve word search puzzles, This assignment involves writing a pr...

This assignment involves writing a program to solve word search puzzles. For example in the following word grid it is possible to find the words active, stock, ethernet and java. N

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd