Releases: CASC-Lang/CASC-JIT
v0.1.0
CASC is now much more stable!
In this version of CASC Compiler release, we improved our REPL so some preserved keywords such as "func", "return", or "var" will be highlighted, but REPL is not working friendly with Mandarins, so instead, Mandarins user can just type codes in text editors and save it into xxx.casc or xxx.cas files.
We recommend users use Visual Studio Code to have much better playing fun since we have official extensions to highlight our CASC source codes.
To get started with CASC Programming Language, read out our README.md first! So you can 80% sure what is CASC doing!
The release contains multiple files in a tar.gz or 7zip file, based on your runtime. To get started with, decompress the downloaded file and open up a command line and execute CASC.exe in following possible arguments:
<source-directory-path>
: CASC does not have any way to import other files in runtime, so alternatively the compiler would compile all .casc or .cas files in the folder (included subdirectories) and runs it.repl
: if you just want to play with CASC without any preparations, try out CASC Repl! You can test out what CASC can do for you.
Developers Note:
CASC is currently a small group, with one man in it, so basically I don't have much time to improve CASC's document. If you are willing to improve CASC Programming Language, feel free to fork and send back your PR or make a issue, small supports are the motivations for me to keep improving CASC!
Also, here are some fun syntaxes you should better read out before getting start:
for-loop
for i = 0 to 100 {
print(string(i))
}
從 甲 = 零 到 一百 {
print(字串(甲))
}
desc: i is a local variable means index in this statement, i could changes into any other words. One thing to notice, print does only accept string type, to cast types, use the following conversion functions:
- string() / 字串()
- bool() / 布林()
- number() / 數字()
function declarion
func fib(in: number): number {
if in == 0 || in == 1
return in
return fib(in - 1) + fib(in - 2)
}
函式 費氏數列(輸入值: number): number {
如果 輸入值 是 零 或 輸入值 是 一
返回 輸入值
返回 費氏數列(輸入值 減 一) 加 費氏數列(輸入值 減 二)
}
desc: number, string, and bool are the only three types support currently. And currently we have print function, input function, and random function.
variable declaration
let a = 0
var b = true
val c = "true"
讓 甲 = 零
變數 乙 = 真
終值 丙 = "真"
desc: val is equivalent for let, nothing between them are different, and val declares constant variable, which means cannot be reassigned after declared. The only way to change a constant variable is to redeclare itself. Also, variables cannot be reassigned with different type.
That's it :-)
v0.0.1
CASC
A compiler aim for Manderins progremmers
CASC is a handwritten compiler which can compile English or Manderin or even mixed codes!
Currently it's under developement by ChAoS_UnItY.
This project is inspired by Minsk.
Example Code
程式碼範例
> 1 + 9 - 7
3
> 一 加 九 減 七
3
> 1 + 九 減 7
3
> 一加二十一是二十二
True
Preserved Word Conversion Table
保留字對照表
Operators 運算子
Operator | Traditional Chinese | Simplified Chinese | Note |
---|---|---|---|
+ | 加 / 正 | TODO | |
- | 減 / 負 | TODO | |
/ | 除 | TODO | |
* | 乘 | TODO | |
. | 點 | TODO | |
( | 開 | TODO | TF |
) | 閉 | TODO | TF |
&& | 且 | TODO | |
|| | 或 | TODO | |
! | 反 | TODO | |
== | 是 | TODO | |
!= | 不是 | TODO | |
^2 | 平方 | TODO | OUA |
2√ | 平方根 | TODO | OUA |
^^ | 次方 | TODO | OUA |
√ | 開方 | TODO | OUA |
TF: Testing feature.測試特性。
OUA: Operator Unacceptable. 不接受純運算子,即不接受第一欄位。