Thanks to visit codestin.com
Credit goes to github.com

Skip to content
FedorMarkin edited this page Jan 2, 2018 · 2 revisions

Welcome to the CSL wiki!

Quick guide to the CSL

Basic concepts

  • 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

Operations

  • 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 special cmp variable, which is not wisible from CSL code. It is 1 if upper element is greater than pre upper, 2 vice versa, and 3 if they are equal
  • gotoM [int] - perform goto operation if cmp equals to 1
  • gotoL [int] - perform goto operation if cmp equals to 2
  • gotoE [int] - perform goto operation if cmp equals to 3
  • gotoNE [int] - perform goto operation if cmp does not equal to 3
  • end - finish the programm (not necessary)

Clone this wiki locally