📄 test_20.mal
字号:
# Monet Mil to Mal compiler# Copyright (c) 2001-2004, CWI. All rights reserved.#Predefined code segment#The compiler can not guarantee an accurate compilation,#because MIL unlike MAL is a dynamically typed language.#A few guidelines to maximize usefullness.#- make the type of variables explicit, in particular 'nil'#- upon advice of M2m to remap identifiers, change it in your program directly#use the "mil_schema" for additional support routines# io.print("setoid(oid(20000000));"); aa_a := oid(20000000); ba_a := setoid(aa_a);# io.print("# definition and use of Monet procs.\n");# io.print("# Note that complex procs should normally be prepared in block mode.\n");# io.print("unknown(\"hello\");"); ca_a := unknown("hello");# io.print("#simple procedure with withdrawal\n");function c():void; da_a := clock(); ea_a := print(da_a);end c;# io.print("c();"); fa_a := c();# io.print("c();"); ga_a := c();# io.print("# redefinition of existing procedure\n");function c():void; clock:= mil.take("clock"); ha_a := print(clock);end c;# io.print("c();"); ia_a := c();# io.print("proc c() : void { cpu().print();}");function c():void; ja_a := cpu(); ka_a := print(ja_a);end c;# io.print("printf(\"#~BeginVariableOutput~#\\n\"); c(); printf(\"#~EndVariableOutput~#\\n\");"); la_a := printf("#~BeginVariableOutput~#\n"); ma_a := c(); na_a := printf("#~EndVariableOutput~#\n");# io.print("proc echo(..any..) : void { $1.print();}");function echo(,echo:any$1...):void; oa_a := mil.getVarTemp($1); pa_a := print(oa_a);end echo;# io.print("echo(1);"); qa_a := echo(1);# io.print("echo(\"hello\");"); ra_a := echo("hello");# io.print("echo(12,13);"); sa_a := echo(12,13);# io.print("echo();"); ta_a := echo();# io.print("proc echo(..any..) : void { $3.print();}");function echo(,echo:any$1...):void; ua_a := mil.getVarTemp($3); va_a := print(ua_a);end echo;# io.print("echo(1);"); wa_a := echo(1);# io.print("echo(1,2,3);"); xa_a := echo(1,2,3);# io.print("# handling non-complete proc definition;\n");function forward():void;end forward;# io.print("forward();"); ya_a := forward();# io.print("forward();"); ab_a := forward();# io.print("quit();"); bb_a := quit();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -