cod
V1.1.0
Cod 是一种开源的基于串联堆栈的通用编程语言,可编译为 C
将来,计划引导编译器,这意味着它将用 Cod 本身编写。
To Cod 是一个开源项目,欢迎贡献。如果您想做出贡献,请分叉存储库,使用 github 问题进行工作,使用问题中使用的票证符号样式,并提交拉取请求。
欢迎 Hacktoberfest 拉取请求,包括拼写错误和语法修复。
您可以在 The cod 网站上下载您操作系统的最新版本
下载后,您可以将可执行文件放入系统路径中,然后它应该可以工作
cod someScript.cod -o someScript.c
如需更多帮助,请运行cod --help
确保将标准库下载到项目根目录中
你好世界:
" Hello World! " prints
嘶嘶声:
-- Fizzbuzz example written in Cod
include " std/math.cod "
include " std/io.cod "
include " std/stack.cod "
alias max_loop_count 40
-- Subroutine to check if number is divisible by another number
subroutine divisible_by {
% 0 ==
}
-- Counter
1
-- Start the loop
true
while {
pop
-- Check if divisible by 3
dup 3 divisible_by if {
" fizz " prints
} pop
-- Check if divisible by 5
dup 5 divisible_by if {
" buzz " prints
} pop
-- Check if divisible by neither
dup 3 divisible_by ! swap dup cycle3 swap 5 divisible_by ! & if {
swap printn swap
} pop
-- Print newline
10 printc pop
-- Increment count
1 +
-- Determain if loop again
dup max_loop_count <=
}