version: 0.0.2
(Early development)
You can give the CharrLang shell a test run for the syntax basics by visting this link: https://replit.com/@charlotte-2222/charr-lang?v=1
If you wish to run the language on your own machine, you are welcome to clone/or fork the repository. At the moment Charr is not ready for extended use, but it is capable of running .charr files to some extent.
The current version of CharrLang now supports compilation of .charr files, as well as running syntax in the shell. On a previous version, I broke the shell; and that version remained stable on replit.
I wouldn't say I'm quite done yet, I'd like to keep working on both the shell, compiler, and further development of the language.
Eventually I'll upload to pypi.
Writing Hello World is fairly easy.
out="Hello, World!
One could also write:
List/Array(s) contains of elements of the same type (either int, float, string, bool).
They can be created using the following syntax:
var = [1, 2, 3, 4, 5]
These objects are used to store data.
Charr does not declare explicit variables, variables are created when they are assigned to.
var = 1
foo = "bar"
Charr variables are case sensitive.
Charr supports comments, which are lines starting with a //
character.
// This is a comment
Charr supports the following arithmetic operators:
Operator | Name | Example |
---|---|---|
+ |
Addition | 1 + 1 |
- |
Subtraction | 1 - 1 |
* |
Multiplication | 1 * 1 |
/ |
Division | 1 / 1 |
% |
Modulus | 1 % 1 |
^ |
Exponent | x^y |
inc |
Increment | inc val |
dec |
Decrement | dec val |
Charr supports the following logical operators:
Operator | Name | Example |
---|---|---|
== |
Equality | 1 == 1 |
!= |
Inequality | 1 != 1 |
< |
Less than | 1 < 2 |
> |
Greater than | 1 > 2 |
<= |
Less than or equal to | 1 <= 2 |
>= |
Greater than or equal to | 1 >= 2 |
The assignment operator =
is used to assign a value to a variable.
Charr supports if statements.
if (condition) {
// code to execute if condition is true
}
else{
// code to execute if condition is false
}
Example:
if counter % 5 == 0
{ output "Buzz" }
else
{ output counter }
With the while loop, we can execute a block of code as long as a condition is true.
while condition
do{
// code to execute
}
precision = 100000
total = 0
counter = 0
while counter < precision
do {
odd = (2 * counter + 1)
if (counter % 2 == 0)
{ total = total + 1/odd }
else
{ total = total - 1/odd }
inc counter
}
pi = 4 * total
output pi
Author: Charlotte Childers
Date of documentation: August 3rd, 2022
Feel free to contact me regarding this language or any other questions, comments, or concerns. Email would be the best way to get a response.