FreeOZ论坛

标题: 新编程语言grass-mud-horse规范 [打印本页]

作者: coredump    时间: 24-12-2009 19:11
标题: 新编程语言grass-mud-horse规范

                               
登录/注册后可看大图

项目主页:http://code.google.com/p/grass-mud-horse/
Example
The code of grass-mud-horse language looks like following, this program loops from 1 to 10:
示例
写出来大概就是这个样子,下面是一个从1到10的循环: 感谢(卡库尔 / Kakur)同学提供

草-草 草泥马数字1压栈Put a 1 on the stack
马-草草 草泥草草草草泥泥马在这里设置一个循环开始的标识Set a Label at this point
草-马草复制栈顶元素Duplicate the top stack item
泥马-草泥输出当前值Output the current value
草草 草泥草泥草马换行(10)压栈Put 10 (newline) on the stack...
泥马-草草输出...and output the newline
草草 草泥马1压栈Put a 1 on the stack
泥草-草草相加栈内两个元素Addition. This increments our current value.
草-马草复制栈顶以便比较Duplicate that value so we can test it
草-草 草泥草泥泥马11压栈Push 11 onto the stack
泥草-草泥相减,如果我们已经循环到11了应该会得到一个0到栈顶Subtraction. So if we've reached the end, we have a zero on the stack.
马-泥草 草泥草草草泥草泥马如果是0,跳到最后If we have a zero, jump to the end
马-草马 草泥草草草草泥泥马跳到开始Jump to the start
马-草草 草泥草草草泥草泥马设置一个标签标识循环结束Set the end label
草-马马清空堆栈,打扫卫生,整理整顿Discard our accumulator, to be tidy
河蟹正如其言Just as it says.

作者: coredump    时间: 24-12-2009 19:12
祝软件版网友圣诞快乐!
平安夜里没有BUG
作者: woodheadz    时间: 24-12-2009 22:47
throw new 河蟹();  
作者: combread    时间: 24-12-2009 23:12
try
    {
        打酱油;
        speak;
        speak freely;
        speak freedom;
    }
    catch (Exception 河蟹)
    {
        被喝茶;
        被躲猫猫;
        被上吊;
    }
    finally
    {
        if (!dead)
            移民;
    }




欢迎光临 FreeOZ论坛 (https://www.freeoz.org/bbs/) Powered by Discuz! X3.2