Clyx icon

[ :: Clyx programming language ]

[ :: Clyx is... ]


[ :: Get Clyx ]

The most recent Clyx version is 0.3.7. The version is bumped every time the language core words (aka primitives), the standard library or the REPL get updated. The primitive set is expected to be indefinitely frozen once the version number reaches 1.0.


[ :: Examples (clyxc-compatible) ]

[ :: Hello World program ]

#!/usr/bin/env clyx
_start [ say "Hello from Clyx!" ]

[ :: FizzBuzz program ]

#!/usr/bin/env clyx
_start [
  for [ 1 101 range ] [
    1 # tracking flag
    swap # the index is on top
    dup 3 mod 0= if [ "Fizz" puts swap drop 0 swap ] [ ]
    dup 5 mod 0= if [ "Buzz" puts swap drop 0 swap ] [ ]
    swap if [ . ] [ drop cr ]
  ]
]

[ :: TCP echo server ]

#!/usr/bin/env clyx
_start [
  say "Listening on port 1337..."
  1337 nlstn # listen on port 1337
  1 while [ # outer connection accept loop
    dup read # accept a new connection -> conn_fd
    1 # loop condition for client session loop
    while [
      dup read # read data
      dup vlen 0 != # check if data is non-empty
      if [ over swap write drop 1 ] [ drop 0 ]
    ]
    close # close the connection socket
    1 # loop condition for outer server loop
  ]
]

[ :: Try it online ]

Under construction!


[ :: Credits ]