← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
You are tasked with implementing a type system for a toy programming language. This language supports:
int, float, strT, T1, T2, S[int, T1, str], [int, str, [int, T1]][param1, param2, ...] -> returnType[int, [int, T1], T2] -> [str, T2, [float, float]]
You need to implement two classes: Node and Function.The Node class represents a type in the language, which can be either: [Source: darkinterview.com]
node_type is a string: represents a primitive or generic typenode_type is a list: represents a tuple containing child nodes
Key Methods:__str__(): Returns the string representation of the node (see Part 1)The Function class represents a function signature with parameters and a return type. [Source: darkinterview.com]