Cav𝚅

From Esolang
Jump to navigation Jump to search

Pronounced /cavl/ (The second v in the title is an inverted capitol Lambda.) is a project I am working on for fun. It includes all the "best" parts of C/C++, java, python, and lisp. When I start to get some real work done on it ||| cean up this page but for now I am using it for notes.

  • "Typeless": all variables are blocks of memory of constant size converting that to a value such as an int, float, *, ect to use is a function. treating it as a char may hold multiple char as in holy c. The exact size is implementation specific but only the last 7 bytes are used.
  • everything is treated as a literal. "Variables" are just literal pointers. The first value of an array is tried as a function name first though.
  • Array==Function call: Lisp like all there is no distinction between an array and a function. All arrays are treated as a function, the function name is the [0] element with the rest of the elements used as arguments. As a fall through case if a function is not defined then it returns the array unchanged.
  • To add there will be built-in Array comprehension operations to make this easier.
  • all functions are actually subroutines
  • operations: C Preprocessor like Macros but with recursion. finite recursion at compile time the rest handled at run time with #defif or something this should not be an issue.
  • switch statements but each case must be in its own block.
  • no one statement blocks
  • blocks start with ':' and end with '\n\n'. no logic to make sure these match so you can just have a bunch of new lines but it will close all blocks and you don't need to end the program with a ton of blank lines
  • you may only start a block as part of control flow or as part of an expression.
  • blocks in expressions are executed and the result is ignored, kinda like the c ',' operator but with scoping.
  • no "classes" per-say but structs that mostly work like classes with all members public.
  • all structs must have a "__DEL__" member that is called 50% of the time it leaves scope.
  • lines may not start with a space.
  • The value corresponding to int 666 (000000000000000000001010011010) may never be stored
  • no if, and, or, but
  • also no while
  • no regular for, that is replaced with dofor and foreach.
  • unused arguments to a function are ignored, on overload it will use the most recently defined value
  • unused return values are pushed to the stack
  • the stack does not care about scope
  • starts at the top and works down. functions must be defined before called but recursion is fine. at the end it calls a function called Fnsh.
  • NULL* is a trashcan
  • Another simple language that is only recursive can take one input from the stack and locks it. to start writing it it use ' ' end with either ' ' or ;


Built-in function Meaning in pseudo code
Dofr † switch([1]){ for(;[2];[3]){if(0){ case([n0]): [n0+1],case([n1]): [n1+1], ... , default: [-1]} statement after dofor }
Frea † for &[1] in [2:] statement after for each, done concurrently the rest of the heap is shared by everything but the value pointed to by [1] changes per iteration
* if there is argument [2] sets the value at address [1] to that value. Always returns the value at address [1] after.
= if there are 3 of depends on [1]. =, tests if [2]&[3] are equal. ~, tests if [2]&[3] are ~ equal, >, <, ! etc.
F hyper operation of rank [1] on [2:] treating the inputs as integers
Real treat [1] as an imaginary number return the real component
Imag treat [1] as an imaginary number return the imaginary component
empty function pops the stack.
Prnf prints, like printf always stores the length of what was printed in the location pointed to by the last argument
T n bit bitwise Toffoli gate
Some of the normal ones Example
Fnsh (Prnf () 0)

† not really a function just uses function like syntax, cannot be overloaded.