(This is a fun project) used to demonstrate how interpreters work.
meow("Hello World!") # print "Hello world!" in the console
pspsps add (x, y) { # define add function
x + y # return 15
}
meow(add(10, 5)) # print 15
For more usage examples, check the examples
- Install the catscript interpreter
npm install -g runcat
- Run the catscript file
runcat file.cat
Done! π
Acess the Syntax Highlighting Repository
- in catscript, the
#
symbol is used to comment a line - catscript is case-sensitive
- catscript is whitespace-insensitive
- catscript is a dynamically typed language
- return values are implicit
+
: Addition-
: Subtraction*
: Multiplication/
: Division%
: Modulus
catscript is a dynamically typed language, so you don't need to specify the type of a variable. The interpreter will infer the type based on the value assigned to it.
string
: A sequence of charactersnumber
: A numeric valueboolean
: A logical valueObject
: A collection of key-value pairs
meow()
: Print a message in the consoletimecat()
: Get the current time in ms
To declare a variable, use the cat
or staticat
keyword followed by the variable name and the value.
cat name = "Pedro Luis"
staticat age = 16
cat
variables are mutable, while staticat
variables are immutable.
Important
in catscript, the ; symbol is only for declaration of variables and not is optional
To declare a function, use the pspsps
keyword followed by the function name and the parameters.
pspsps add (x, y) {
x + y # return
}
To call a function, use the function name followed by the parameters (if you have).
meow(add(10, 5)) # print 15
Important
In catscript, the return value is implicit. the last value of the function is returned
To declare an object, use the {} in cat
keyword or staticat
followed by the object name and the key-value pairs.
staticat obj = {
name:"catscript",
repo:"https://github.com/luiisp/catscript",
author:{
name: "Pedro Luis Dias",
github: "https://github.com/luiisp/"
},
version:"lasted",
};
We welcome contributions to the catscript project! If you would like to contribute, please follow these steps:
- Fork the repository on GitHub.
- Clone your forked repository to your local machine.
- Create a new branch for your changes.
- Make your desired changes to the codebase.
- Test your changes to ensure they work as expected.
- Commit your changes and push them to your forked repository.
- Submit a pull request to the main i18n4e repository.
Please make sure to follow our contribution guidelines and adhere to our code of conduct when contributing.
Important
Before submitting your PR, ensure that the code is well formatted and follows our requirements
Created with β€οΈ by luiisp