My old university homework which I made back in 2015.
The task was to build a script that will parse a provided text file with a set of commands in a predefined format and execute them, as a data structure it should use linked list.
The file with commands should have name "Sets.command"
The syntax of the commands is as follows:
Create a new set "abc"
new abc
Add a new element "5" to the set "abc"
add abc 5
Remove the element "5" from the set "abc"
del abc 5
Remove the set "abc"
del abc
Union of two sets "abc" and "def". If parameter res
is provided then the result will be stored in the new set res
Otherwise the result will be printed to the terminal.
union abc def [res]
Intersection of two sets "abc" and "def". If parameter res
is provided then the result will be stored in the new set res
Otherwise the result will be printed to the terminal.
intersec abc def [res]
Difference of two sets "abc" and "def". If parameter res
is provided then the result will be stored in the new set res
Otherwise the result will be printed to the terminal.
diff abc def [res]
Symmetric difference of two sets "abc" and "def". If parameter res
is provided then the result will be stored in the new set res
Otherwise the result will be printed to the terminal.
simmdiff abc def [res]
Show the content of the set "abc"
show abc
Show all the sets
showall
Check if the set "abc" has the element "5"
contains abc 5
Check if the set "abc" includes the set "def"
isin abc def
Check if the set "abc" exists
exist abc
Exit the program
exit
new abc
add abc 5
add abc 10
add abc 15
show abc
del abc 10
show abc
union abc def res
show res
exit