-
Notifications
You must be signed in to change notification settings - Fork 0
Home
FedorMarkin edited this page Jan 2, 2018
·
2 revisions
Welcome to the CSL wiki!
- The very first thing you should know about the CSL that it is an esoteric language which do not pretend to be as effecient as cpp and langs like it
- Main idea of the CSL is the cracked stack. Cracked stack can be imagined just by cracking long tube, closed both sides, exactly in the middle of it. You get two parts, then you put colorful balls in left one. When you need to get the yellow one form left part, you just take top ball and put it in the right part of the tube until you get yellow one. Then you can put all balls back. It's important, that after the procedure balls do not lose their order.
- In CSL this conseption implemented by two stacks, called Stack and Reserved stack (from this moment: S and RS). You can put elements only in S, and results of operations are put in S.
- CSL works only with integer values
- CSL has basic IO operators. Print upper element in S:
$; in RS:$$. Get an int from user and put in S:> -
push [int]puts an integer value in S -
add,sub,mul,div,mod- perform the operation on last two elements in S and put result in S -
movS- copy top element of S to the top of RS.movRS- vice versa -
swap- changes the values of top elements of S and RS -
goto [uint]- will always 'throw' you on line you've put -
comp- compares two last elements in S. Puts the result in specialcmpvariable, which is not wisible from CSL code. It is1if upper element is greater than pre upper,2vice versa, and3if they are equal -
gotoM [int]- performgotooperation ifcmpequals to 1 -
gotoL [int]- performgotooperation ifcmpequals to 2 -
gotoE [int]- performgotooperation ifcmpequals to 3 -
gotoNE [int]- performgotooperation ifcmpdoes not equal to 3 -
end- finish the programm (not necessary)