python
class Node():
def __init__(self, value):
pass
class PostScript():
def __init__(self):
pass
 Â
def push(self, value):
pass
 Â
def pop(self):
return None
 Â
def peek(self):
pass
 Â
def is_empty(self):
pass
def stack(self):
pass
 Â
def exch(self):
pass
 Â
def index(self):
pass
 Â
def clear(self):
pass
 Â
def dup(self):
pass
 Â
def equal(self):
pass
 Â
def depth(self):
pass
 Â
stack = PostScript()
def decode(command_list):
for object in command_list:
if object == '=':
stack.equal()
elif object == 'count':
stack.depth()
elif object == 'clear':
stack.clear()
elif object == 'dup':
stack.dup()
elif object == 'exch':
stack.exch()
elif object == 'index':
stack.index()
elif object == 'pop':
stack.pop()
elif object == 'stack':
stack.stack()
else:
stack.push(object)
command = input()
command_list = command.split()
decode(command_list)
 Â
For this assignment you are to implement a PostScript commandinterpreter using a Stack. You must implement the stack using asingly-linked list. Solutions that use a data structure other thana singly-linked list will received nocredit.
The interpreter must read and execute a string of PostScriptcommands based on the following definitions:
1. =
objn objn-1 … obj1 = : objn-1 … obj1
This command removes the topmost object form the stack andprints it.
- count
objn … obj1count : [depth of the stack] objn … obj1
This command puts the depth of the stack on the top of thestack. - clear
objn … obj1clear : [empty stack]
This command removes all objects from the stack. - dup
objn … obj1 = : objn objn … obj1
This command adds a duplicate copy of the top object to the stack. - exch
objn objn-1 … obj1 exch : objn-1 objn … obj1
This command exchanges the position of the top two elements of thestack. - index
objn … obj1 a index : objn … obja … obj1
This command adds a copy of the ath object to the top thestack. - pop
objn objn-1 … obj1 pop : objn-1 …. obj1
This command removes the top element from the stack. - stack
This command prints a copy of the entire stack, starting from thetop and working to the bottom..
The input will be a series of data and commands separated by aspace. The data will go onto the stack. Commands do not go onto thestack. You must write at least one separate method for each of thecommands. You may reuse the standard Stack methods discussed inclass: push(), pop(), peek() and is_empty(). A template file hasbeen provided.
 Â