0% found this document useful (0 votes)
41 views

Python Introduction: 1 Overview About Compiler, Practical Part

The document provides an overview of a university course on designing a simple compiler using Python. It discusses that students will learn Python fundamentals and then use Python to design a compiler for a simple language. It outlines what will be covered in the course, including Python syntax, data types, files, functions, classes and more. Students are instructed to follow the lab instructions printed from the online system and ask for help if needed.

Uploaded by

Renas Dareesh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Python Introduction: 1 Overview About Compiler, Practical Part

The document provides an overview of a university course on designing a simple compiler using Python. It discusses that students will learn Python fundamentals and then use Python to design a compiler for a simple language. It outlines what will be covered in the course, including Python syntax, data types, files, functions, classes and more. Students are instructed to follow the lab instructions printed from the online system and ask for help if needed.

Uploaded by

Renas Dareesh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Python Introduction

University of Zakho
Department of Computer Science
Third Year Students
Compiler Design (Practical Part)

September 24, 2020

1 Overview About Compiler, Practical Part


In the practical part of the compiler course, python will be used to design
a small compiler. At the end of this course, students will have a knowledge
about how to use python to design a new compiler for different languages.
In order to do this, fundamental of python language will be given, before
the main part of the course is started. In each lab, all instructions will be
given to complete each lab.

2 Overview About Python


This course will cover designing a simple compiler using python. Students
will be given basic fundamentals about python, then a simple compiler will
be designed where the required python skill is given.
Python is a popular programming language. It was created by Guido
van Rossum, and released in 1991. It could be used for the following:

• Web development (server-side),

• Software development, mathematics, system scripting.

• Networking

• Designing Compiler for simple languages

3 Why Python?
• Python works on different platforms (Windows, Mac, Linux, Rasp-
berry Pi, etc).

• Python has a simple syntax which could be written in a simple way .

1
• Python has syntax that allows developers to write programs with fewer
lines than some other programming languages.

• Python runs on an interpreter system, meaning that code can be exe-


cuted as soon as it is written.

• Python is Object Oriented Based Programming.

The following are some examples how to run python using CMD:
> 2 + 2
4
> 50 − 5∗6
20
> (50 − 5∗6) / 4
5.0
> 8 / 5 # d i v i s i o n a l w a y s r e t u r n s a f l o a t i n g p o i n t number
1.6
We will be using an editor to write python code in the future labs.

4 What will be included ?


As other object Oriented programming languages, Python consists of the
following structures:

1. Variables and data types (Integers, string, Characters, ...)

2. Collections (Lists,tuples, sets,... )

3. File handling (Reading and writing files)

4. Statements (Condition and loops, return, .....)

5. Functions (Function declaration)

6. Classes (Objects) (Classes methods, inheritance, ... )

The first part of the course (Lab) will be describing how these structures
can be implemented in Python.
The second part will be implementing a simple compiler (the first three
steps) for a simple language. This means that you will need to understand
the first part to complete the second part.

2
5 How to Follow Lab Instructions
At the day before each lab started, instructions will be available in the moo-
dle system. You will need to print these instruction (one pdf file) before
attending the labs. Please make sure you have this file before at-
tending the labs. This will help you how to follow the labs and make it
easy to understand what to do in each lab.
All you have to do is to follow given instructions and combine code into
a single file step by step. You will be allowed to change or add new code, if
needed. If you get any problems or errors in the lab do not hesitate to ask.

6 Teaching Methods
The most recent version of Python is Python 3.8.5, which we shall be using
in this course. Any version of python more than 3 is recommended. In
this course, Python will be written in a text editor. This will be one of the
available Integrated Development Environments and editors, such as Spider,
Pycharm, Netbeans or Eclipse which are particularly useful when managing
larger collections of Python files. We will tell you which one is best to be
used.
In this lab, students will be learn which software will be used and how to
write a simple expressions using python, if needed. If you have any questions
regarding the whole python and the required software, this is the right time
to ask.

7 Python Getting Started


It is recommended to install anaconda as it is all you need to do to install
Python and all the required libraries for this course. We will help you in
case you get any problems.

8 Recommended Online Resources


There are many books and online resources can be used to learn Python.
The following are recommended online resources for this course.

1. https://docs.python.org/3/tutorial/

2. https://www.w3schools.com/python/

You might also like