Skip to content

Xhaust yourself - Programming language written in C++ with a unique design

License

Notifications You must be signed in to change notification settings

ReallySnazzy/Xhaust

Repository files navigation

bad exhaust image

Xhaust

Build Status

Introduction

Keywords

in("<prompt>")                             Take string input
nin("<prompt>")                            Take numeric input
exhaust <value> { <CODE> }                 Loop <CODE>, deplete <value>
out(<value>)                               stdout
chars("<characters>")                      creates ascii list
head(<list>)                               Get head of list
tail(<list>)                               Get tail of list

Examples

Multiply x and y:

//Take numeric input
x = nin()
y = nin()

z = 0
exhaust x
{
  z = z + y
} //deplete: x = x - 1
out(z)

Exhausting static value:

c = 1

//Compiler needs to create variable when value is static
exhaust 10
{
  c = c + 1
  out(c);
}

99 Bottles:

bottles = 99

exhaust bottles
{
  out(bottles)

  //There is no string data type. This is syntax sugar.
  out(chars(" bottles of beer on the wall. Take 1 down pass it around\n"))
}

List Stack?

s = <>
exhaust 10
{
  s = 3::s
  out(s);
  //output: <3,3,3,3,3,3,3,3,3,3>
}

Exhausting lists:

//Build S with construction operator
s = 1::2::3::4::5::<>

exhaust s
{
  out(head(s));
  out(chars(" "));
  //output:1 2 3 4 5 

} //deplete: s = tail(s)

Reversing a list:

s = 1::2::3::4::5::<>
r = <>

exhaust s
{
  j = <>

  //Get last elem of s
  b = -1
  z = s //deep copy
  exhaust b
  {
    if (tail(z) == <>)
    {
      b = 0
    }
    else
    {
      j = head(s)::j
      z = tail(z)
    }
  }

  //put last elem of s at beginning of r
  r = head(z)::r

  //remove last elm from s
  s = j

  //stop depletion step
  s = 0::s
}

Contributors


DrowsySaturn


SamyBencherif

About

Xhaust yourself - Programming language written in C++ with a unique design

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages