Commit e9e8a9fc1aa4ac0cee301997a20afdbf1c6df49f
1 parent
d97868c4
Revert "Ce git me pete les couilles comme c'est pas possible. Ras le bol de cett…
…e merde et vive svn." This reverts commit f0efa7e5574a4a33ee7fe8fbf9a05811e03ebc99.
Showing
16 changed files
with
368 additions
and
659 deletions
Show diff stats
anubis_dev/library/doc_tools/maml3.anubis
| @@ -9,7 +9,6 @@ | @@ -9,7 +9,6 @@ | ||
| 9 | 9 | ||
| 10 | Copyright (c) Alain Prouté 2015. | 10 | Copyright (c) Alain Prouté 2015. |
| 11 | 11 | ||
| 12 | -define One xxx = todo("Handle the restricted use of marks for the web."). | ||
| 13 | 12 | ||
| 14 | This file obsoletes the following files in the same directory: | 13 | This file obsoletes the following files in the same directory: |
| 15 | latex.anubis | 14 | latex.anubis |
| @@ -89,7 +88,7 @@ public type MAML_Pos: // position in a MAML text | @@ -89,7 +88,7 @@ public type MAML_Pos: // position in a MAML text | ||
| 89 | Int offset). | 88 | Int offset). |
| 90 | 89 | ||
| 91 | public type MAML_Error: | 90 | public type MAML_Error: |
| 92 | - //empty_mark_name (MAML_Pos pos), | 91 | + empty_mark_name (MAML_Pos pos), |
| 93 | unknown_mark (MAML_Pos pos, String name), // name of mark not recognized | 92 | unknown_mark (MAML_Pos pos, String name), // name of mark not recognized |
| 94 | too_few_arguments (MAML_Pos pos, String mark_name, | 93 | too_few_arguments (MAML_Pos pos, String mark_name, |
| 95 | Int found, | 94 | Int found, |
| @@ -127,8 +126,7 @@ public type MAML_Parse_Option: | @@ -127,8 +126,7 @@ public type MAML_Parse_Option: | ||
| 127 | option is to inhibit all maml marks which could be dangerous for the server. These marks are | 126 | option is to inhibit all maml marks which could be dangerous for the server. These marks are |
| 128 | not documented in 'maml3_tutorial.maml'. They are the following: | 127 | not documented in 'maml3_tutorial.maml'. They are the following: |
| 129 | 128 | ||
| 130 | - $input(<file_path>) allows to input the content of a file (similar to LaTeX '\input', or Anubis 'read'). | ||
| 131 | - $output(<file path>)(text) allows to output text to a file. | 129 | + $input(<file_path>) allows to 'input' the content of a file (similar to LaTeX '\input', or Anubis 'read'). |
| 132 | 130 | ||
| 133 | 131 | ||
| 134 | *** (4) Generating an HTML output. | 132 | *** (4) Generating an HTML output. |
| @@ -409,7 +407,6 @@ define MAML_Pos | @@ -409,7 +407,6 @@ define MAML_Pos | ||
| 409 | *** [1.4] The type 'MAML' of MAML texts. | 407 | *** [1.4] The type 'MAML' of MAML texts. |
| 410 | 408 | ||
| 411 | type MAML: | 409 | type MAML: |
| 412 | - end, | ||
| 413 | var (Int), // MAML variable $1, $2, ... | 410 | var (Int), // MAML variable $1, $2, ... |
| 414 | text (Text), // ordinary text | 411 | text (Text), // ordinary text |
| 415 | mark (String name, List(MAML) args), // mark | 412 | mark (String name, List(MAML) args), // mark |
| @@ -424,7 +421,6 @@ define String | @@ -424,7 +421,6 @@ define String | ||
| 424 | ) = | 421 | ) = |
| 425 | if m is | 422 | if m is |
| 426 | { | 423 | { |
| 427 | - end then "", | ||
| 428 | var(v) then "$"+abs_to_decimal(v), | 424 | var(v) then "$"+abs_to_decimal(v), |
| 429 | text(txt) then to_string(txt), | 425 | text(txt) then to_string(txt), |
| 430 | mark(name,args) then if args is [] then "$"+name+" " else | 426 | mark(name,args) then if args is [] then "$"+name+" " else |
| @@ -710,7 +706,6 @@ public define List(MAMLMark) | @@ -710,7 +706,6 @@ public define List(MAMLMark) | ||
| 710 | mark("ifpdf", 1), | 706 | mark("ifpdf", 1), |
| 711 | mark("define", 3), // defining a MAML macro: $define(name)(2)(body ... $1 ... $2 ...) | 707 | mark("define", 3), // defining a MAML macro: $define(name)(2)(body ... $1 ... $2 ...) |
| 712 | mark("dollar", 0), // the caracter $ itself | 708 | mark("dollar", 0), // the caracter $ itself |
| 713 | - mark("", 0), // same as "dollar" | ||
| 714 | mark("lpar", 0), // left parenthesis | 709 | mark("lpar", 0), // left parenthesis |
| 715 | mark("rpar", 0), // right parenthesis | 710 | mark("rpar", 0), // right parenthesis |
| 716 | mark("par", 0), // new paragraph | 711 | mark("par", 0), // new paragraph |
| @@ -868,7 +863,7 @@ define ReadMarkNameResult | @@ -868,7 +863,7 @@ define ReadMarkNameResult | ||
| 868 | Stream s | 863 | Stream s |
| 869 | ) = | 864 | ) = |
| 870 | with name = read_mark_name_aux(s,[]), | 865 | with name = read_mark_name_aux(s,[]), |
| 871 | - if name = "" then mark("") else | 866 | + if name = "" then error(empty_mark_name(get_pos(s))) else |
| 872 | if decimal_scan(name) is | 867 | if decimal_scan(name) is |
| 873 | { | 868 | { |
| 874 | failure then mark(name), | 869 | failure then mark(name), |
| @@ -963,7 +958,6 @@ define Result(MAML_Error,(MAML,List(MAMLMark))) | @@ -963,7 +958,6 @@ define Result(MAML_Error,(MAML,List(MAMLMark))) | ||
| 963 | { | 958 | { |
| 964 | error(msg) then error(msg), | 959 | error(msg) then error(msg), |
| 965 | mark(name) then | 960 | mark(name) then |
| 966 | - if name = "end" then ok((end,maml_marks)) else | ||
| 967 | if name = "verbatim" then if read_verbatim_argument(s,"verbatim") is | 961 | if name = "verbatim" then if read_verbatim_argument(s,"verbatim") is |
| 968 | { | 962 | { |
| 969 | error(msg) then error(msg), | 963 | error(msg) then error(msg), |
| @@ -1041,7 +1035,6 @@ define Maybe(String) | @@ -1041,7 +1035,6 @@ define Maybe(String) | ||
| 1041 | ) = | 1035 | ) = |
| 1042 | if m is | 1036 | if m is |
| 1043 | { | 1037 | { |
| 1044 | - end then failure, | ||
| 1045 | var(_) then failure, | 1038 | var(_) then failure, |
| 1046 | text(txt) then success(to_string(txt)), | 1039 | text(txt) then success(to_string(txt)), |
| 1047 | mark(_,_) then failure, | 1040 | mark(_,_) then failure, |
| @@ -1079,7 +1072,7 @@ define Maybe(String) | @@ -1079,7 +1072,7 @@ define Maybe(String) | ||
| 1079 | { | 1072 | { |
| 1080 | failure then failure, | 1073 | failure then failure, |
| 1081 | success(s) then | 1074 | success(s) then |
| 1082 | - if mapand((Word8 c) |-> member(c,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_~"),explode(s)) | 1075 | + if mapand((Word8 c) |-> member(c,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvxyz0123456789"),explode(s)) |
| 1083 | then success(s) | 1076 | then success(s) |
| 1084 | else failure | 1077 | else failure |
| 1085 | }. | 1078 | }. |
| @@ -1124,7 +1117,7 @@ define Result(MAML_Error,List(MAMLMark)) | @@ -1124,7 +1117,7 @@ define Result(MAML_Error,List(MAMLMark)) | ||
| 1124 | define Result(MAML_Error,(MAML,List(MAMLMark))) | 1117 | define Result(MAML_Error,(MAML,List(MAMLMark))) |
| 1125 | parse_MAML | 1118 | parse_MAML |
| 1126 | ( | 1119 | ( |
| 1127 | - List(MAML_Parse_Option) parse_options, | 1120 | + List(MAML_Parse_Option) parse_options, |
| 1128 | Stream s, | 1121 | Stream s, |
| 1129 | List(MAMLMark) maml_marks, | 1122 | List(MAMLMark) maml_marks, |
| 1130 | Maybe(Int) mb_level | 1123 | Maybe(Int) mb_level |
| @@ -1139,7 +1132,6 @@ define Result(MAML_Error,(MAML,List(MAMLMark))) | @@ -1139,7 +1132,6 @@ define Result(MAML_Error,(MAML,List(MAMLMark))) | ||
| 1139 | { | 1132 | { |
| 1140 | error(msg) then error(msg), | 1133 | error(msg) then error(msg), |
| 1141 | ok(p) then since p is (m,new_marks), | 1134 | ok(p) then since p is (m,new_marks), |
| 1142 | - if m is end then ok((text(prefix),maml_marks)) else | ||
| 1143 | if update_mark_list(s,m,new_marks) is // add a new mark if m is $define()()() | 1135 | if update_mark_list(s,m,new_marks) is // add a new mark if m is $define()()() |
| 1144 | { | 1136 | { |
| 1145 | error(msg) then error(msg), | 1137 | error(msg) then error(msg), |
| @@ -1197,15 +1189,12 @@ define String | @@ -1197,15 +1189,12 @@ define String | ||
| 1197 | ) = | 1189 | ) = |
| 1198 | if m is | 1190 | if m is |
| 1199 | { | 1191 | { |
| 1200 | - end then "", | ||
| 1201 | var(i) then "$"+i, | 1192 | var(i) then "$"+i, |
| 1202 | text(s) then to_string(s), | 1193 | text(s) then to_string(s), |
| 1203 | mark(name,args) then "$"+name+concat(map((MAML m1) |-> "("+must_be_text(m1)+")",args),""), | 1194 | mark(name,args) then "$"+name+concat(map((MAML m1) |-> "("+must_be_text(m1)+")",args),""), |
| 1204 | m1 + m2 then must_be_text(m1)+must_be_text(m2) | 1195 | m1 + m2 then must_be_text(m1)+must_be_text(m2) |
| 1205 | }. | 1196 | }. |
| 1206 | 1197 | ||
| 1207 | - | ||
| 1208 | - | ||
| 1209 | *** [3.2] define. | 1198 | *** [3.2] define. |
| 1210 | 1199 | ||
| 1211 | Extending the context with a new definition: | 1200 | Extending the context with a new definition: |
| @@ -1262,7 +1251,6 @@ define MAML | @@ -1262,7 +1251,6 @@ define MAML | ||
| 1262 | ) = | 1251 | ) = |
| 1263 | if body is | 1252 | if body is |
| 1264 | { | 1253 | { |
| 1265 | - end then end, | ||
| 1266 | var(i) then | 1254 | var(i) then |
| 1267 | if nth(i-1,values) is | 1255 | if nth(i-1,values) is |
| 1268 | { | 1256 | { |
| @@ -1359,7 +1347,7 @@ define String | @@ -1359,7 +1347,7 @@ define String | ||
| 1359 | ". | 1347 | ". |
| 1360 | 1348 | ||
| 1361 | \\usepackage{tikz} | 1349 | \\usepackage{tikz} |
| 1362 | - \usetikzlibrary{shapes,arrows} | 1350 | + s\usetikzlibrary{shapes,arrows} |
| 1363 | 1351 | ||
| 1364 | 1352 | ||
| 1365 | 1353 | ||
| @@ -1674,8 +1662,6 @@ define List(Output) | @@ -1674,8 +1662,6 @@ define List(Output) | ||
| 1674 | ok(text,_,outs) then do_output(filename,text,outs,outs) | 1662 | ok(text,_,outs) then do_output(filename,text,outs,outs) |
| 1675 | }. | 1663 | }. |
| 1676 | 1664 | ||
| 1677 | - | ||
| 1678 | - | ||
| 1679 | define To_HTML_Result | 1665 | define To_HTML_Result |
| 1680 | to_HTML | 1666 | to_HTML |
| 1681 | ( | 1667 | ( |
| @@ -1690,7 +1676,6 @@ define To_HTML_Result | @@ -1690,7 +1676,6 @@ define To_HTML_Result | ||
| 1690 | since opts is options(spath,cpath,tpath,fsize,fnsize,twidth), | 1676 | since opts is options(spath,cpath,tpath,fsize,fnsize,twidth), |
| 1691 | if m is | 1677 | if m is |
| 1692 | { | 1678 | { |
| 1693 | - end then ok(t,ctxt,outs), | ||
| 1694 | var(i) then should_not_happen(ok(t,ctxt,outs)), | 1679 | var(i) then should_not_happen(ok(t,ctxt,outs)), |
| 1695 | 1680 | ||
| 1696 | text(txt) then ok(handle_special_chars(txt,html_schar),ctxt,outs), | 1681 | text(txt) then ok(handle_special_chars(txt,html_schar),ctxt,outs), |
| @@ -1704,7 +1689,6 @@ define To_HTML_Result | @@ -1704,7 +1689,6 @@ define To_HTML_Result | ||
| 1704 | if name = "rq" then ok(t-"»",ctxt,outs) else | 1689 | if name = "rq" then ok(t-"»",ctxt,outs) else |
| 1705 | if name = "~" then ok(t-"~",ctxt,outs) else | 1690 | if name = "~" then ok(t-"~",ctxt,outs) else |
| 1706 | if name = "dollar" then ok(t-"$",ctxt,outs) else | 1691 | if name = "dollar" then ok(t-"$",ctxt,outs) else |
| 1707 | - if name = "" then ok(t-"$",ctxt,outs) else | ||
| 1708 | if name = "lpar" then ok(t-"(",ctxt,outs) else | 1692 | if name = "lpar" then ok(t-"(",ctxt,outs) else |
| 1709 | if name = "rpar" then ok(t-")",ctxt,outs) else | 1693 | if name = "rpar" then ok(t-")",ctxt,outs) else |
| 1710 | if name = "par" then ok(t-"<br>",ctxt,outs) else | 1694 | if name = "par" then ok(t-"<br>",ctxt,outs) else |
| @@ -1790,7 +1774,7 @@ define To_HTML_Result | @@ -1790,7 +1774,7 @@ define To_HTML_Result | ||
| 1790 | { | 1774 | { |
| 1791 | [ ] then | 1775 | [ ] then |
| 1792 | // two operands | 1776 | // two operands |
| 1793 | - if name = "output" then with outs1 = do_output(must_be_text(a1),t - must_be_text(a2),outs,outs), | 1777 | + if name = "output" then with outs1 = do_output(must_be_text(a1),to_HTML(a2,ctxt,opts,stack,tocfile,outs,lab),outs), |
| 1794 | ok(t,ctxt,outs1) else | 1778 | ok(t,ctxt,outs1) else |
| 1795 | if name = "code" then ok(t-"<pre style=\"color: inherit; font-size: inherit; background-color: rgb(" | 1779 | if name = "code" then ok(t-"<pre style=\"color: inherit; font-size: inherit; background-color: rgb(" |
| 1796 | -must_be_text(a1)-"); width: "-to_decimal(text_width(opts))-"px;\">"- | 1780 | -must_be_text(a1)-"); width: "-to_decimal(text_width(opts))-"px;\">"- |
| @@ -1955,7 +1939,6 @@ define List(Word8) | @@ -1955,7 +1939,6 @@ define List(Word8) | ||
| 1955 | then explode("\\texttt{\\symbol{94}}") + latex_prepare(t,ic,il) | 1939 | then explode("\\texttt{\\symbol{94}}") + latex_prepare(t,ic,il) |
| 1956 | else ['\\', '^', '{', '}' . latex_prepare(t,ic,il)] else | 1940 | else ['\\', '^', '{', '}' . latex_prepare(t,ic,il)] else |
| 1957 | if c = '&' then ['\\', '&' . latex_prepare(t,ic,il)] else | 1941 | if c = '&' then ['\\', '&' . latex_prepare(t,ic,il)] else |
| 1958 | - if c = '%' then ['\\', '%' . latex_prepare(t,ic,il)] else | ||
| 1959 | if c = '#' then ['\\', '#' . latex_prepare(t,ic,il)] else | 1942 | if c = '#' then ['\\', '#' . latex_prepare(t,ic,il)] else |
| 1960 | if c = '\\' then if ic | 1943 | if c = '\\' then if ic |
| 1961 | then explode("{\\texttt{\\symbol{92}}}") + latex_prepare(t,ic,il) | 1944 | then explode("{\\texttt{\\symbol{92}}}") + latex_prepare(t,ic,il) |
| @@ -1997,7 +1980,6 @@ define MAML | @@ -1997,7 +1980,6 @@ define MAML | ||
| 1997 | ) = | 1980 | ) = |
| 1998 | if m is | 1981 | if m is |
| 1999 | { | 1982 | { |
| 2000 | - end then end, | ||
| 2001 | var(i) then m, | 1983 | var(i) then m, |
| 2002 | text(txt) then text(latex_prepare(txt,ic,il)), | 1984 | text(txt) then text(latex_prepare(txt,ic,il)), |
| 2003 | mark(name,args) then if (name = "tt" | name = "code") | 1985 | mark(name,args) then if (name = "tt" | name = "code") |
| @@ -2092,7 +2074,6 @@ define (Text,List(MAML_Macro)) | @@ -2092,7 +2074,6 @@ define (Text,List(MAML_Macro)) | ||
| 2092 | ) = | 2074 | ) = |
| 2093 | if m is | 2075 | if m is |
| 2094 | { | 2076 | { |
| 2095 | - end then (t,ctxt), | ||
| 2096 | var(i) then (t,ctxt), | 2077 | var(i) then (t,ctxt), |
| 2097 | 2078 | ||
| 2098 | text(txt) then (txt,ctxt), | 2079 | text(txt) then (txt,ctxt), |
| @@ -2105,7 +2086,6 @@ define (Text,List(MAML_Macro)) | @@ -2105,7 +2086,6 @@ define (Text,List(MAML_Macro)) | ||
| 2105 | if name = "rq" then (t-"\\fg{}",ctxt) else | 2086 | if name = "rq" then (t-"\\fg{}",ctxt) else |
| 2106 | if name = "~" then (t-"\\textasciitilde{}",ctxt) else | 2087 | if name = "~" then (t-"\\textasciitilde{}",ctxt) else |
| 2107 | if name = "dollar" then (t-"\\$",ctxt) else | 2088 | if name = "dollar" then (t-"\\$",ctxt) else |
| 2108 | - if name = "" then (t-"\\$",ctxt) else | ||
| 2109 | if name = "lpar" then (t-"(",ctxt) else | 2089 | if name = "lpar" then (t-"(",ctxt) else |
| 2110 | if name = "rpar" then (t-")",ctxt) else | 2090 | if name = "rpar" then (t-")",ctxt) else |
| 2111 | if name = "par" then (t-"\\rule{1mm}{0mm}\n\n",ctxt) else | 2091 | if name = "par" then (t-"\\rule{1mm}{0mm}\n\n",ctxt) else |
| @@ -2305,8 +2285,8 @@ public define String | @@ -2305,8 +2285,8 @@ public define String | ||
| 2305 | ) = | 2285 | ) = |
| 2306 | if e is | 2286 | if e is |
| 2307 | { | 2287 | { |
| 2308 | - //empty_mark_name(pos) then | ||
| 2309 | - // "Empty mark name at "+format_without_offset(pos)+".", | 2288 | + empty_mark_name(pos) then |
| 2289 | + "Empty mark name at "+format_without_offset(pos)+".", | ||
| 2310 | 2290 | ||
| 2311 | unknown_mark(pos,name) then | 2291 | unknown_mark(pos,name) then |
| 2312 | "Unknown mark '$"+name+"' at "+format_without_offset(pos)+".", | 2292 | "Unknown mark '$"+name+"' at "+format_without_offset(pos)+".", |
| @@ -2411,35 +2391,14 @@ define Maybe(WStream) | @@ -2411,35 +2391,14 @@ define Maybe(WStream) | ||
| 2411 | success(f) then success(weaken(f)) | 2391 | success(f) then success(weaken(f)) |
| 2412 | }. | 2392 | }. |
| 2413 | 2393 | ||
| 2414 | - | ||
| 2415 | -type Option: | ||
| 2416 | - pdf. // generate a PDF file | ||
| 2417 | - | ||
| 2418 | - | ||
| 2419 | -define List(Option) | ||
| 2420 | - get_options | ||
| 2421 | - ( | ||
| 2422 | - List(String) args | ||
| 2423 | - ) = | ||
| 2424 | - if args is | ||
| 2425 | - { | ||
| 2426 | - [ ] then [ ], | ||
| 2427 | - [h . t] then | ||
| 2428 | - if h = "-pdf" then [pdf . get_options(t)] else | ||
| 2429 | - get_options(t) | ||
| 2430 | - }. | ||
| 2431 | - | ||
| 2432 | global define One | 2394 | global define One |
| 2433 | maml | 2395 | maml |
| 2434 | ( | 2396 | ( |
| 2435 | List(String) args | 2397 | List(String) args |
| 2436 | ) = | 2398 | ) = |
| 2437 | - with options = get_options(args), | ||
| 2438 | if args is | 2399 | if args is |
| 2439 | { | 2400 | { |
| 2440 | - [ ] then print("Usage: anbexec maml <filename> <option> ... <option>\n"+ | ||
| 2441 | - " Options:\n"+ | ||
| 2442 | - " -pdf generate a PDF (and LaTeX) output\n"), | 2401 | + [ ] then print("Usage: anbexec maml <filename>\n"), |
| 2443 | [h . _] then if file(h,read) is | 2402 | [h . _] then if file(h,read) is |
| 2444 | { | 2403 | { |
| 2445 | failure then print("File '"+h+"' not found.\n"), | 2404 | failure then print("File '"+h+"' not found.\n"), |
| @@ -2479,24 +2438,22 @@ global define One | @@ -2479,24 +2438,22 @@ global define One | ||
| 2479 | -html_text-"</div></td></tr></table></center></body></html>")) | 2438 | -html_text-"</div></td></tr></table></center></body></html>")) |
| 2480 | }; | 2439 | }; |
| 2481 | // output the LaTeX | 2440 | // output the LaTeX |
| 2482 | - if pdf:options | ||
| 2483 | - then (if to_LaTeX(m,predefined,0,false) is (latex_text,_) then | ||
| 2484 | - if file(h+".tex",new) is | ||
| 2485 | - { | ||
| 2486 | - failure then print("Cannot create file '"+h+".tex'.\n"), | ||
| 2487 | - success(f) then forget(print(weaken(f), | ||
| 2488 | - t-latex_pdf_preambule("")-latex_text-latex_pdf_postambule)); | ||
| 2489 | - forget(flush(f)); | ||
| 2490 | - if (Maybe(Word8))execute(success("."),"pdflatex", | ||
| 2491 | - ["-no-shell-escape", // avoid security problems | ||
| 2492 | - "-interaction", "nonstopmode", // avoid stopping | ||
| 2493 | - h+".tex"]) is | ||
| 2494 | - { | ||
| 2495 | - failure then print("Cannot execute pdflatex.\n"), | ||
| 2496 | - success(_) then unique | ||
| 2497 | - } | ||
| 2498 | - }) | ||
| 2499 | - else unique | 2441 | + if to_LaTeX(m,predefined,0,false) is (latex_text,_) then |
| 2442 | + if file(h+".tex",new) is | ||
| 2443 | + { | ||
| 2444 | + failure then print("Cannot create file '"+h+".tex'.\n"), | ||
| 2445 | + success(f) then forget(print(weaken(f), | ||
| 2446 | + t-latex_pdf_preambule("")-latex_text-latex_pdf_postambule)); | ||
| 2447 | + forget(flush(f)); | ||
| 2448 | + if (Maybe(Word8))execute(success("."),"pdflatex", | ||
| 2449 | + ["-no-shell-escape", // avoid security problems | ||
| 2450 | + "-interaction", "nonstopmode", // avoid stopping | ||
| 2451 | + h+".tex"]) is | ||
| 2452 | + { | ||
| 2453 | + failure then print("Cannot execute pdflatex.\n"), | ||
| 2454 | + success(_) then unique | ||
| 2455 | + } | ||
| 2456 | + } | ||
| 2500 | } | 2457 | } |
| 2501 | } | 2458 | } |
| 2502 | } | 2459 | } |
anubis_dev/library/doc_tools/maml3_tutorial.maml
| @@ -5,11 +5,11 @@ $comment( The MAML3 tutorial (written in MAML3) | @@ -5,11 +5,11 @@ $comment( The MAML3 tutorial (written in MAML3) | ||
| 5 | $define(title)(1)($par$par$center($big($big($bold($1))))$par$par) | 5 | $define(title)(1)($par$par$center($big($big($bold($1))))$par$par) |
| 6 | $define(MAML)(0)($bold($red(MAML))) | 6 | $define(MAML)(0)($bold($red(MAML))) |
| 7 | $define(em)(1)($italic($1)) | 7 | $define(em)(1)($italic($1)) |
| 8 | -$define(argu)(1)($rgb(0,80,0)(<$1>)) | ||
| 9 | $define(mark0)(1)($label($1)$subsection($red($tt($dollar $1)))) | 8 | $define(mark0)(1)($label($1)$subsection($red($tt($dollar $1)))) |
| 10 | -$define(mark1)(2)($label($1)$subsection($red($tt($dollar $1$lpar$argu($2)$rpar)))) | ||
| 11 | -$define(mark2)(3)($label($1)$subsection($red($tt($dollar $1$lpar$argu($2)$rpar$lpar$argu($3)$rpar)))) | ||
| 12 | -$define(mark3)(4)($label($1)$subsection($red($tt($dollar $1$lpar$argu($2)$rpar$lpar$argu($3)$rpar$lpar$argu($4)$rpar)))) | 9 | +$define(mark1)(2)($label($1)$subsection($red($tt($dollar $1$lpar$2$rpar)))) |
| 10 | +$define(mark2)(3)($label($1)$subsection($red($tt($dollar $1$lpar$2$rpar$lpar$3$rpar)))) | ||
| 11 | +$define(mark3)(4)($label($1)$subsection($red($tt($dollar $1$lpar$2$rpar$lpar$3$rpar$lpar$4$rpar)))) | ||
| 12 | +$define(arg)(1)($tt($red($1))) | ||
| 13 | $define(LaTeX)(0)($latex(\LaTeX)) | 13 | $define(LaTeX)(0)($latex(\LaTeX)) |
| 14 | $define(tcode)(1)($code(255,255,255)($1)) | 14 | $define(tcode)(1)($code(255,255,255)($1)) |
| 15 | 15 | ||
| @@ -86,7 +86,7 @@ text, rather than writing them from scratch at each occurrence. In some sens, de | @@ -86,7 +86,7 @@ text, rather than writing them from scratch at each occurrence. In some sens, de | ||
| 86 | creating your own style. | 86 | creating your own style. |
| 87 | $par$par | 87 | $par$par |
| 88 | For example, it can be the case that some concept of your discourse has to be emphasized in a particular way, say printed | 88 | For example, it can be the case that some concept of your discourse has to be emphasized in a particular way, say printed |
| 89 | -in red. You should not use $tt($dollar red(...)) in the text. You should better first give a name (say $tt(thething)) to | 89 | +in red. You whould not use $tt($dollar red(...)) in the text. You should better first give a name (say $tt(thething)) to |
| 90 | your concept, and define it near the beginning of the text: | 90 | your concept, and define it near the beginning of the text: |
| 91 | $par$par | 91 | $par$par |
| 92 | $tt($dollar define(thething)(1)($dollar red($dollar 1))) | 92 | $tt($dollar define(thething)(1)($dollar red($dollar 1))) |
| @@ -98,22 +98,19 @@ This will structure your text in a useful semantic way, instead of a non signifi | @@ -98,22 +98,19 @@ This will structure your text in a useful semantic way, instead of a non signifi | ||
| 98 | to later update. | 98 | to later update. |
| 99 | It also has the advantage that you can later easily change the layout of the text by modifying | 99 | It also has the advantage that you can later easily change the layout of the text by modifying |
| 100 | only the values in these $tt($dollar define). | 100 | only the values in these $tt($dollar define). |
| 101 | -$par | ||
| 102 | -$par | ||
| 103 | -The $tt($dollar input) mark let you ``input'' a $MAML source at any point of nother $MAML source. Hence, you should | ||
| 104 | -define your style in a file (say $tt(mystyle.maml)) and put an $tt($dollar input(mystyle.maml)) at the beginning of your | ||
| 105 | -source file. | 101 | + |
| 102 | + | ||
| 106 | 103 | ||
| 107 | 104 | ||
| 108 | $section(The catalog of $MAML marks) | 105 | $section(The catalog of $MAML marks) |
| 109 | Below are the $MAML marks in alphabetic order: | 106 | Below are the $MAML marks in alphabetic order: |
| 110 | 107 | ||
| 111 | - $mark1(big)(text) Prints its argument $argu(text) bigger. This mark can be nested. | 108 | + $mark1(big)(text) Prints its argument $arg(text) bigger. This mark can be nested. |
| 112 | 109 | ||
| 113 | 110 | ||
| 114 | - $mark1(bold)(text) Prints its argument $argu(text) in $bold(bold). | 111 | + $mark1(bold)(text) Prints its argument $arg(text) in $bold(bold). |
| 115 | 112 | ||
| 116 | - $mark2(box)(width)(text) This mark puts $argu(text) into an invisible box of width $argu(width). The text if left aligned | 113 | + $mark2(box)(width)(text) This mark puts $arg(text) into an invisible box of width $arg(width). The text if left aligned |
| 117 | within the box. This mark can be used for simulating tabulators. For example, | 114 | within the box. This mark can be used for simulating tabulators. For example, |
| 118 | $tcode( | 115 | $tcode( |
| 119 | $dollar box(50)(Smith) $dollar box(50)(John) $dollar box(30)(24) Baltimore $dollar par | 116 | $dollar box(50)(Smith) $dollar box(50)(John) $dollar box(30)(24) Baltimore $dollar par |
| @@ -127,14 +124,14 @@ Below are the $MAML marks in alphabetic order: | @@ -127,14 +124,14 @@ Below are the $MAML marks in alphabetic order: | ||
| 127 | Of course, if you have to produce such tables, you should better first define a new mark whose role is to display | 124 | Of course, if you have to produce such tables, you should better first define a new mark whose role is to display |
| 128 | a single line of the table. This mark should include the $tt($dollar par) at the end of line. | 125 | a single line of the table. This mark should include the $tt($dollar par) at the end of line. |
| 129 | 126 | ||
| 130 | - $mark1(center)(text) This mark horizontally centers the $argu(text) in the page. | 127 | + $mark1(center)(text) This mark horizontally centers the $arg(text) in the page. |
| 131 | 128 | ||
| 132 | - $mark2(code)(background color)(text) This marks is for writing computer code. | ||
| 133 | - The $argu(background-color) argument must have the form $tt(r,g,b), where $tt(r), $tt(g) and $tt(b) are intensities of | 129 | + $mark2(code)(background-color)(text) This marks is for writing computer code. |
| 130 | + The $arg(background-color) argument must have the form $tt(r,g,b), where $tt(r), $tt(g) and $tt(b) are intensities of | ||
| 134 | red green and blue and must be integers between 0 and 255. | 131 | red green and blue and must be integers between 0 and 255. |
| 135 | - The $argu(text) argument is formated using a fixed width | 132 | + The $arg(text) argument is formated using a fixed width |
| 136 | (typewriter) font, spaces and newlines are taken into account, so that the result has essentially the same layout as the | 133 | (typewriter) font, spaces and newlines are taken into account, so that the result has essentially the same layout as the |
| 137 | - original. Nevertheless, $MAML marks are allowed within $argu(text), but some of them, such as $tt($dollar list), | 134 | + original. Nevertheless, $MAML marks are allowed within $arg(text), but some of them, such as $tt($dollar list), |
| 138 | can produce incoherent result. For example, | 135 | can produce incoherent result. For example, |
| 139 | $par | 136 | $par |
| 140 | $tcode($dollar code(220,220,220)( | 137 | $tcode($dollar code(220,220,220)( |
| @@ -170,41 +167,36 @@ $red(define) $blue(Int) | @@ -170,41 +167,36 @@ $red(define) $blue(Int) | ||
| 170 | 167 | ||
| 171 | $mark1(comment)(text) This mark allows you to put a comment, which will not be rendered, in your $MAML source text. | 168 | $mark1(comment)(text) This mark allows you to put a comment, which will not be rendered, in your $MAML source text. |
| 172 | $par | 169 | $par |
| 173 | - $em(Warning:) Parentheses must be balanced within $argu(text), otherwise the $MAML parser will not find the end of the | 170 | + $em(Warning:) Parentheses must be balanced within $arg(text), otherwise the $MAML parser will not find the end of the |
| 174 | comment. | 171 | comment. |
| 175 | 172 | ||
| 176 | - $mark3(define)(name)(numer of arguments)(value) | ||
| 177 | - This mark let you define new marks (i.e. macros). It takes three arguments. The first argument $argu(name) is the name of the new mark. It should | 173 | + $mark3(define)(name)(num)(value) |
| 174 | + This mark let you define new marks (i.e. macros). It takes three arguments. The first argument $arg(name) is the name of the new mark. It should | ||
| 178 | not be already in use, must be made only of letters (A to Z and a to z) and numbers (0 to 9), and | 175 | not be already in use, must be made only of letters (A to Z and a to z) and numbers (0 to 9), and |
| 179 | - must contain at least one letter. The second argument $argu(number of arguments) is the number of arguments your new mark will accept. It must | ||
| 180 | - be a positive or zero integer. The last argument $argu(value) is the value of the mark. This is a $MAML text, and it can | 176 | + must contain at least one letter. The second argument $arg(num) is the number of arguments your new mark will accept. It must |
| 177 | + be a positive or zero integer. The last argument $arg(value) is the value of the mark. This is a $MAML text, and it can | ||
| 181 | contain marks of the form $tt($dollar 1), $tt($dollar 2), $tt($dollar 3), ... (called $MAML $em(variables)) which represent the arguments | 178 | contain marks of the form $tt($dollar 1), $tt($dollar 2), $tt($dollar 3), ... (called $MAML $em(variables)) which represent the arguments |
| 182 | of the mark, and which will be later replaced by the actual arguments when the mark is used in the text. | 179 | of the mark, and which will be later replaced by the actual arguments when the mark is used in the text. |
| 183 | 180 | ||
| 184 | $mark0(dollar) This mark inserts a character $dollar in the text. Notice that $tt($dollar tt($dollar dollar)) | 181 | $mark0(dollar) This mark inserts a character $dollar in the text. Notice that $tt($dollar tt($dollar dollar)) |
| 185 | - produces $tt($dollar), wheras $tt($dollar dollar) produces $dollar. You can also write $tt($) instead of $tt($ dollar), | ||
| 186 | - provided that the character $tt($) is not followed by an integer, nor a latin letter nor a tilde character. | 182 | + produces $tt($dollar), wheras $tt($dollar dollar) produces $dollar. |
| 187 | 183 | ||
| 188 | - $mark0(end) This mark indicates that the MAML compiler should stop reading. In case this mark appears within a | ||
| 189 | - source text read through an $tt($dollar input) mark, the ``input'' file is closed and parsing resumes in the | ||
| 190 | - calling source. | ||
| 191 | - | ||
| 192 | - $mark1(ifhtml)(text) The argument $argu(text) will be present in the HTML output, but not in the $LaTeX nor in the PDF | 184 | + $mark1(ifhtml)(text) The argument $arg(text) will be present in the HTML output, but not in the $LaTeX nor in the PDF |
| 193 | output. | 185 | output. |
| 194 | 186 | ||
| 195 | - $mark1(ifpdf)(text) The argument $argu(text) will be present in the $LaTeX and in the PDF | 187 | + $mark1(ifpdf)(text) The argument $arg(text) will be present in the $LaTeX and in the PDF |
| 196 | output, but not in the HTML output. | 188 | output, but not in the HTML output. |
| 197 | 189 | ||
| 198 | - $mark2(image)(width)(file path) | ||
| 199 | - This mark allows you to insert an image in the text. The argument $argu(width) is the width the image will have | ||
| 200 | - when displayed (in pixels in the case of HTML, and points in the case of $LaTeX), and $argu(file path) is the path of the file | 190 | + $mark2(image)(width)(path) |
| 191 | + This mark allows you to insert an image in the text. The argument $arg(width) is the width the image will have | ||
| 192 | + when displayed (in pixels in the case of HTML, and points in the case of $LaTeX), and $arg(path) is the path of the file | ||
| 201 | containing the image. For example, | 193 | containing the image. For example, |
| 202 | $tcode($dollar center($dollar image($dollar ifpdf(100)$dollar ifhtml(200))(cows.jpg))) | 194 | $tcode($dollar center($dollar image($dollar ifpdf(100)$dollar ifhtml(200))(cows.jpg))) |
| 203 | will produce this: | 195 | will produce this: |
| 204 | $center($image($ifpdf(100)$ifhtml(200))(cows.jpg)) | 196 | $center($image($ifpdf(100)$ifhtml(200))(cows.jpg)) |
| 205 | At the same time, you remark that the width of the image can be computed by $MAML marks. | 197 | At the same time, you remark that the width of the image can be computed by $MAML marks. |
| 206 | $par | 198 | $par |
| 207 | - $em(Warning:) The $argu(file path) of the image is relative to the root directory on the server in the case of | 199 | + $em(Warning:) The $arg(path) of the image is relative to the root directory on the server in the case of |
| 208 | an HTML output. In the case of a $LaTeX/PDF output, it is relative to the directory within which | 200 | an HTML output. In the case of a $LaTeX/PDF output, it is relative to the directory within which |
| 209 | the MAML parser is executed. | 201 | the MAML parser is executed. |
| 210 | 202 | ||
| @@ -212,14 +204,12 @@ $red(define) $blue(Int) | @@ -212,14 +204,12 @@ $red(define) $blue(Int) | ||
| 212 | $mark1(input)(file name) | 204 | $mark1(input)(file name) |
| 213 | This mark let you insert the content of another $MAML file. This other file could for example contain your own $MAML | 205 | This mark let you insert the content of another $MAML file. This other file could for example contain your own $MAML |
| 214 | macros or be the file with extension $tt(.mamltoc) generated by the $MAML compiler (see $ref(section)($tt($dollar section))). | 206 | macros or be the file with extension $tt(.mamltoc) generated by the $MAML compiler (see $ref(section)($tt($dollar section))). |
| 215 | - For security reasons, this mark has restricted use in the web version of MAML. It can read files from one directory | ||
| 216 | - only. | ||
| 217 | 207 | ||
| 218 | - $mark1(italic)(text) Prints its argument $argu(text) in $italic(italic). | 208 | + $mark1(italic)(text) Prints its argument $arg(text) in $italic(italic). |
| 219 | 209 | ||
| 220 | $mark0(item) Marks the begining of an $em(item) within a $ref(list)($tt($dollar list)) | 210 | $mark0(item) Marks the begining of an $em(item) within a $ref(list)($tt($dollar list)) |
| 221 | 211 | ||
| 222 | - $mark1(label)(tag) This mark defines a $em(label) in the text, in other words, a position where to jump. | 212 | + $mark1(label)(name) This mark defines a $em(label) in the text, in other words, a position where to jump. |
| 223 | This is to be used in conjunction with $ref(ref)($tt($dollar ref)). | 213 | This is to be used in conjunction with $ref(ref)($tt($dollar ref)). |
| 224 | 214 | ||
| 225 | $mark1(latex)(formula) This mark allows to include math formulas to be formated by $LaTeX. | 215 | $mark1(latex)(formula) This mark allows to include math formulas to be formated by $LaTeX. |
| @@ -229,48 +219,44 @@ $red(define) $blue(Int) | @@ -229,48 +219,44 @@ $red(define) $blue(Int) | ||
| 229 | $latex($$\int_0^\infty\frac{dx}{1+x^2}$$) | 219 | $latex($$\int_0^\infty\frac{dx}{1+x^2}$$) |
| 230 | This mark should not be used for big pieces of $LaTeX | 220 | This mark should not be used for big pieces of $LaTeX |
| 231 | text. It is mainly intended for math formulas, especially for HTML output where the formula is rendered | 221 | text. It is mainly intended for math formulas, especially for HTML output where the formula is rendered |
| 232 | - as a PNG image with transparent background. | 222 | + as a PNG image with tansparent background. |
| 233 | $par$par | 223 | $par$par |
| 234 | You can use $tt($dollar latex) in the text. The result will be correctly aligned with the text. For example,$par | 224 | You can use $tt($dollar latex) in the text. The result will be correctly aligned with the text. For example,$par |
| 235 | $center($tcode(the polynomial $dollar latex($dollar X^2+X+1$dollar) is of degree 2)) | 225 | $center($tcode(the polynomial $dollar latex($dollar X^2+X+1$dollar) is of degree 2)) |
| 236 | is rendered as~: | 226 | is rendered as~: |
| 237 | $center(the polynomial $latex($X^2+X+1$) is of degree 2) | 227 | $center(the polynomial $latex($X^2+X+1$) is of degree 2) |
| 238 | 228 | ||
| 239 | - $mark1(list)(items) This mark allows to create a list. The argument $argu(items) must be a sequence of $em(items), | ||
| 240 | - i.e. texts which are all prefixed by the mark $ref(item)($tt($dollar item)). | 229 | + $mark1(list)(text) This mark allows to create a list. The argument $arg(text) must be a sequence of $em(items), |
| 230 | + i.e. texts which are all beginning by the mark $ref(item)($tt($dollar item)). | ||
| 241 | 231 | ||
| 242 | $mark0(lpar) This mark inserts a left (opening) parenthese into the text. You must use $tt($dollar lpar) and/or | 232 | $mark0(lpar) This mark inserts a left (opening) parenthese into the text. You must use $tt($dollar lpar) and/or |
| 243 | $tt($dollar rpar) if you want to introduce unbalanced parentheses within an argument of a mark. | 233 | $tt($dollar rpar) if you want to introduce unbalanced parentheses within an argument of a mark. |
| 244 | 234 | ||
| 245 | - $mark2(mailto)(address)(text) This marks, which appears as $argu(text), | 235 | + $mark2(mailto)(address)(text) This marks, which appears as $arg(text), |
| 246 | creates a link which is supposed, in the HTML case, to open your mail agent in order to let you | 236 | creates a link which is supposed, in the HTML case, to open your mail agent in order to let you |
| 247 | - send an email to the indicated $argu(address). In the PDF case, the $argu(address) is just indicated between parentheses | ||
| 248 | - beside $argu(text). | 237 | + send an email to the indicated $arg(address). In the PDF case, the $arg(address) is just indicated between parentheses |
| 238 | + beside $arg(text). | ||
| 249 | For example, | 239 | For example, |
| 250 | $center($tt($dollar blue($dollar mailto(XZ32@planet.mars)(the martian)))) produces: | 240 | $center($tt($dollar blue($dollar mailto(XZ32@planet.mars)(the martian)))) produces: |
| 251 | $blue($mailto(XZ32@planet.mars)(the martian)) | 241 | $blue($mailto(XZ32@planet.mars)(the martian)) |
| 252 | 242 | ||
| 253 | - $mark1(note)(text) This mark produces a footnote containing $argu(text). | 243 | + $mark1(note)(text) This mark produces a footnote containing $arg(text). |
| 254 | In the case of $LaTeX/PDF this is a usual | 244 | In the case of $LaTeX/PDF this is a usual |
| 255 | footnote.$ifpdf($note(Like this one.)) In the case of HTML, this is a popup which appears at the bottom of the browser's window when the mouse | 245 | footnote.$ifpdf($note(Like this one.)) In the case of HTML, this is a popup which appears at the bottom of the browser's window when the mouse |
| 256 | passes over this indication : $ifhtml($note(Here is the note !))$ifpdf(($sup(note))).$ifhtml( Try it !) | 246 | passes over this indication : $ifhtml($note(Here is the note !))$ifpdf(($sup(note))).$ifhtml( Try it !) |
| 257 | 247 | ||
| 258 | - $mark2(output)(file path)(text) This mark does not produce anything in the resulting HTML or PDF files, but outputs | ||
| 259 | - $argu(text) (without any modification) into the file $argu(file path). For security reasons, this mark is not available | ||
| 260 | - in the web version of MAML. | ||
| 261 | - | ||
| 262 | $mark0(par) This marks generates a line break. You can use several $tt($dollar par) in order to make some | 248 | $mark0(par) This marks generates a line break. You can use several $tt($dollar par) in order to make some |
| 263 | vertical space in your text. | 249 | vertical space in your text. |
| 264 | $par$par | 250 | $par$par |
| 265 | $em(Warning:) The MAML parser doesn't take newline characters into account (they are just read as spaces). Hence, | 251 | $em(Warning:) The MAML parser doesn't take newline characters into account (they are just read as spaces). Hence, |
| 266 | using $tt($dollar par) is often necessary. | 252 | using $tt($dollar par) is often necessary. |
| 267 | 253 | ||
| 268 | - $mark2(ref)(tag)(text) | 254 | + $mark2(ref)(name)(text) |
| 269 | This mark creates an internal hyperlink. When clicked upon, this moves the text | 255 | This mark creates an internal hyperlink. When clicked upon, this moves the text |
| 270 | - to the position of the $ref(label)($tt($dollar label)) (this is a $tt($dollar ref) !) with the same tag name. | 256 | + to the position of the $ref(label)($tt($dollar label)) (this is a $tt($dollar ref) !) with the same name. |
| 271 | 257 | ||
| 272 | - $mark2(rgb)(color)(text) This mark sets the color of characters in $argu(text) to $argu(color), where | ||
| 273 | - $argu(color) has the form of three integers separated by commas, representing the intensities of red, green and blue. | 258 | + $mark2(rgb)(color)(text) This mark sets the color of characters in $arg(text) to $arg(color), where |
| 259 | + $arg(color) has the form of three integers separated by commas, representing the intensities of red, green and blue. | ||
| 274 | These numbers must be between 0 and 255. For example, | 260 | These numbers must be between 0 and 255. For example, |
| 275 | $center($tcode($dollar rgb(255,0,0)(the text))) | 261 | $center($tcode($dollar rgb(255,0,0)(the text))) |
| 276 | produces: | 262 | produces: |
| @@ -283,50 +269,49 @@ $red(define) $blue(Int) | @@ -283,50 +269,49 @@ $red(define) $blue(Int) | ||
| 283 | $tt($dollar rpar) if you want to introduce unbalanced parentheses within an argument of a mark. | 269 | $tt($dollar rpar) if you want to introduce unbalanced parentheses within an argument of a mark. |
| 284 | 270 | ||
| 285 | $mark1(section)(title) This mark defines a $em(section) within the text. It is translated into | 271 | $mark1(section)(title) This mark defines a $em(section) within the text. It is translated into |
| 286 | - $tt(<h3>$argu(title)</h3>) in HTML and into $tt(\section{$argu(title)}) in $LaTeX. Sections are automatically numbered. | ||
| 287 | - $par$par | 272 | + $tt(<h3>$arg(title)</h3>) in HTML and into $tt(\section{$arg(title)}) in $LaTeX, producing a numbered |
| 273 | + section in the PDF output.$par$par | ||
| 288 | When it encouters either $tt($dollar section), $tt($dollar subsection) or $tt($dollar subsubsection), the $MAML | 274 | When it encouters either $tt($dollar section), $tt($dollar subsection) or $tt($dollar subsubsection), the $MAML |
| 289 | compiler adds a line to the file with the same name as the source file but with $tt(.mamltoc) appended. This file contains | 275 | compiler adds a line to the file with the same name as the source file but with $tt(.mamltoc) appended. This file contains |
| 290 | marks of the form $tt($dollar tocsec(label)(text)) (and similarly $tt($dollar tocsubsec) and | 276 | marks of the form $tt($dollar tocsec(label)(text)) (and similarly $tt($dollar tocsubsec) and |
| 291 | $tt($dollar tocsubsubsec)), and it is up to you to define the meaning of these marks. Combined with $tt($dollar input) this lets | 277 | $tt($dollar tocsubsubsec)), and it is up to you to define the meaning of these marks. Combined with $tt($dollar input) this lets |
| 292 | - you make a table of contents for the HTML output. Actually, this is how the table of contents of the present tutorial | ||
| 293 | - was made. | 278 | + you make a table of contents for the HTML output. |
| 294 | 279 | ||
| 295 | - $mark1(sub)(text) This mark lowers $argu(text) and renders it in a smaller size. For example, $tt(x$dollar sub(1)) | 280 | + $mark1(sub)(text) This mark lowers $arg(text) and renders it in a smaller size. For example, $tt(x$dollar sub(1)) |
| 296 | produces x$sub(1). | 281 | produces x$sub(1). |
| 297 | 282 | ||
| 298 | $mark1(subsection)(title) This mark defines a $em(subsection) within the text. It is translated into | 283 | $mark1(subsection)(title) This mark defines a $em(subsection) within the text. It is translated into |
| 299 | - $tt(<h4>$argu(title)</h4>) in HTML and into $tt(\subsection{$argu(title)}) in $LaTeX. Subsections are automatically | ||
| 300 | - numbered. | 284 | + $tt(<h4>$arg(title)</h4>) in HTML and into $tt(\subsection{$arg(title)}) in $LaTeX, producing a numbered |
| 285 | + subsection in the PDF output. | ||
| 301 | 286 | ||
| 302 | $mark1(subsubsection)(title) This mark defines a $em(subsubsection) within the text. It is translated into | 287 | $mark1(subsubsection)(title) This mark defines a $em(subsubsection) within the text. It is translated into |
| 303 | - $tt(<h5>$argu(title)</h5>) in HTML and into $tt(\subsubsection{$argu(title)}) in $LaTeX. Subsubsections are automatically | ||
| 304 | - numbered. | 288 | + $tt(<h5>$arg(title)</h5>) in HTML and into $tt(\subsubsection{$arg(title)}) in $LaTeX, producing a numbered |
| 289 | + subsubsection in the PDF output. | ||
| 305 | 290 | ||
| 306 | - $mark1(sup)(text) This mark raises $argu(text) and renders it in a smaller size. For example, $tt(x$dollar sup(1)) | 291 | + $mark1(sup)(text) This mark raises $arg(text) and renders it in a smaller size. For example, $tt(x$dollar sup(1)) |
| 307 | produces x$sup(1). | 292 | produces x$sup(1). |
| 308 | 293 | ||
| 309 | - $mark2(tbgc)(color)(text) This mark ($em(text background color)) shows $argu(text) over a background of color | ||
| 310 | - $argu(color). For example, | 294 | + $mark2(tbgc)(color)(text) This mark ($em(text background color)) shows $arg(text) over a background of color |
| 295 | + $arg(color). For example, | ||
| 311 | $center($tcode($dollar tbgc(255,200,200)(Some text.))) | 296 | $center($tcode($dollar tbgc(255,200,200)(Some text.))) |
| 312 | - produces: $tbgc(255,200,200)(Some text.) $em(Warning:) This will force $argu(text) to be on a single line, so that | ||
| 313 | - it is valuable only for very short texts. See also $ref(code)($tt($dollar code(...))). | 297 | + produces: $tbgc(255,200,200)(Some text.) $em(Warning:) This will force $arg(text) to be on a single line, so that |
| 298 | + it is valuable only for very short texts. | ||
| 314 | 299 | ||
| 315 | - $mark2(tlink)(text)(url) This mark creates an hypertext link targeting the $argu(url), and shown as the clickable | ||
| 316 | - $argu(text) (which can also be an image). | 300 | + $mark2(tlink)(text)(url) This mark creates an hypertext link targeting the $arg(url), and shown as the clickable |
| 301 | + $arg(text) (which can also be an image). | ||
| 317 | 302 | ||
| 318 | - $mark1(tt)(text) This mark renders $argu(text) in fixed width (typewriter) font. It is similar to | ||
| 319 | - $ref(code)($tt($dollar code(...))), with the difference that $argu(text) is put inline instead of as a separate block. | ||
| 320 | - For example, $tt($dollar tt(This) is $dollar code(255,255,255)(an) example.) | 303 | + $mark1(tt)(text) This mark renders $arg(text) in fixed width (typewriter) font. It is similar to |
| 304 | + $ref(code)($tt($dollar code(...))), with the difference that $arg(text) is put inline instead of as a separate block. | ||
| 305 | + For example, $tt($dollar tt(This) is $dollar code(an) example.) | ||
| 321 | produces: $tt(This) is $tcode(an) example. | 306 | produces: $tt(This) is $tcode(an) example. |
| 322 | $par | 307 | $par |
| 323 | See also $ref(code)($tt($dollar code(...))) and $ref(verbatim)($tt($dollar verbatim(...))). | 308 | See also $ref(code)($tt($dollar code(...))) and $ref(verbatim)($tt($dollar verbatim(...))). |
| 324 | 309 | ||
| 325 | $mark1(verbatim)(text) This marks reproduces its content without any change with two exceptions. | 310 | $mark1(verbatim)(text) This marks reproduces its content without any change with two exceptions. |
| 326 | Indeed, $MAML marks within | 311 | Indeed, $MAML marks within |
| 327 | - $argu(text) are not interpreted, except the two marks $tt($dollar lpar) and $tt($dollar rpar), which allows you | ||
| 328 | - to produce unbalanced parentheses in $argu(text) despite the fact that actual parentheses $em(must) be | ||
| 329 | - balanced in $argu(text). Example: | 312 | + $arg(text) are not interpreted, except the two marks $tt($dollar lpar) and $tt($dollar rpar), which allows you |
| 313 | + to produce unbalanced parentheses in $arg(text) despite the fact that actual parentheses $em(must) be | ||
| 314 | + balanced in $arg(text). Example: | ||
| 330 | $par | 315 | $par |
| 331 | $tcode($dollar verbatim( | 316 | $tcode($dollar verbatim( |
| 332 | In this ($dollar blue(text))(), ((parentheses) are) $dollar rpar$dollar rpar$dollar lpar balanced. | 317 | In this ($dollar blue(text))(), ((parentheses) are) $dollar rpar$dollar rpar$dollar lpar balanced. |
| @@ -344,7 +329,7 @@ $red(define) $blue(Int) | @@ -344,7 +329,7 @@ $red(define) $blue(Int) | ||
| 344 | See also $ref(code)($tt($dollar code(...))) and $ref(tt)($tt($dollar tt(...))). | 329 | See also $ref(code)($tt($dollar code(...))) and $ref(tt)($tt($dollar tt(...))). |
| 345 | 330 | ||
| 346 | 331 | ||
| 347 | -$ifhtml($par$par$par$par$par$par$par$par$par$par$par$par$par$par$par$par$par$par$par$par$par$par$par) | 332 | +$par$par$par$par$par$par$par$par$par$par$par$par$par$par$par$par$par$par$par$par$par$par$par |
| 348 | 333 | ||
| 349 | 334 | ||
| 350 | 335 |
anubis_dev/library/doc_tools/maml3_tutorial.maml.html
| @@ -60,41 +60,39 @@ This documentation itself was written in <strong><div style="display: inline; co | @@ -60,41 +60,39 @@ This documentation itself was written in <strong><div style="display: inline; co | ||
| 60 | <br><br><br><center><table style="color: inherit; font-size: inherit;"><tr><td><strong><big>Contents</big></strong></td></tr></table></center><br><big><a rel="tag" href="#toclab1">The <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> syntax</a></big><br> | 60 | <br><br><br><center><table style="color: inherit; font-size: inherit;"><tr><td><strong><big>Contents</big></strong></td></tr></table></center><br><big><a rel="tag" href="#toclab1">The <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> syntax</a></big><br> |
| 61 | <big><a rel="tag" href="#toclab2">Creating your own style</a></big><br> | 61 | <big><a rel="tag" href="#toclab2">Creating your own style</a></big><br> |
| 62 | <big><a rel="tag" href="#toclab3">The catalog of <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> marks</a></big><br> | 62 | <big><a rel="tag" href="#toclab3">The catalog of <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> marks</a></big><br> |
| 63 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab4"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$big(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></a><br> | ||
| 64 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab5"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$bold(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></a><br> | ||
| 65 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab6"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$box(<div style="display: inline; color: rgb(0,80,0)"><width></div>)(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></a><br> | ||
| 66 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab7"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$center(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></a><br> | ||
| 67 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab8"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$code(<div style="display: inline; color: rgb(0,80,0)"><background color></div>)(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></a><br> | ||
| 68 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab9"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$comment(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></a><br> | ||
| 69 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab10"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$define(<div style="display: inline; color: rgb(0,80,0)"><name></div>)(<div style="display: inline; color: rgb(0,80,0)"><numer of arguments></div>)(<div style="display: inline; color: rgb(0,80,0)"><value></div>)</span></div></a><br> | 63 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab4"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$big(text)</span></div></a><br> |
| 64 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab5"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$bold(text)</span></div></a><br> | ||
| 65 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab6"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$box(width)(text)</span></div></a><br> | ||
| 66 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab7"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$center(text)</span></div></a><br> | ||
| 67 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab8"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$code(background-color)(text)</span></div></a><br> | ||
| 68 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab9"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$comment(text)</span></div></a><br> | ||
| 69 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab10"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$define(name)(num)(value)</span></div></a><br> | ||
| 70 | <div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab11"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$dollar</span></div></a><br> | 70 | <div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab11"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$dollar</span></div></a><br> |
| 71 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab12"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$end</span></div></a><br> | ||
| 72 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab13"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$ifhtml(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></a><br> | ||
| 73 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab14"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$ifpdf(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></a><br> | ||
| 74 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab15"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$image(<div style="display: inline; color: rgb(0,80,0)"><width></div>)(<div style="display: inline; color: rgb(0,80,0)"><file path></div>)</span></div></a><br> | ||
| 75 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab16"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$input(<div style="display: inline; color: rgb(0,80,0)"><file name></div>)</span></div></a><br> | ||
| 76 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab17"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$italic(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></a><br> | ||
| 77 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab18"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$item</span></div></a><br> | ||
| 78 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab19"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$label(<div style="display: inline; color: rgb(0,80,0)"><tag></div>)</span></div></a><br> | ||
| 79 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab20"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$latex(<div style="display: inline; color: rgb(0,80,0)"><formula></div>)</span></div></a><br> | ||
| 80 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab21"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$list(<div style="display: inline; color: rgb(0,80,0)"><items></div>)</span></div></a><br> | ||
| 81 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab22"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$lpar</span></div></a><br> | ||
| 82 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab23"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$mailto(<div style="display: inline; color: rgb(0,80,0)"><address></div>)(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></a><br> | ||
| 83 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab24"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$note(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></a><br> | ||
| 84 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab25"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$output(<div style="display: inline; color: rgb(0,80,0)"><file path></div>)(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></a><br> | ||
| 85 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab26"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$par</span></div></a><br> | ||
| 86 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab27"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$ref(<div style="display: inline; color: rgb(0,80,0)"><tag></div>)(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></a><br> | ||
| 87 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab28"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$rgb(<div style="display: inline; color: rgb(0,80,0)"><color></div>)(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></a><br> | ||
| 88 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab29"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$rpar</span></div></a><br> | ||
| 89 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab30"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$section(<div style="display: inline; color: rgb(0,80,0)"><title></div>)</span></div></a><br> | ||
| 90 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab31"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$sub(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></a><br> | ||
| 91 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab32"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$subsection(<div style="display: inline; color: rgb(0,80,0)"><title></div>)</span></div></a><br> | ||
| 92 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab33"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$subsubsection(<div style="display: inline; color: rgb(0,80,0)"><title></div>)</span></div></a><br> | ||
| 93 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab34"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$sup(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></a><br> | ||
| 94 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab35"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tbgc(<div style="display: inline; color: rgb(0,80,0)"><color></div>)(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></a><br> | ||
| 95 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab36"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tlink(<div style="display: inline; color: rgb(0,80,0)"><text></div>)(<div style="display: inline; color: rgb(0,80,0)"><url></div>)</span></div></a><br> | ||
| 96 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab37"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tt(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></a><br> | ||
| 97 | -<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab38"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$verbatim(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></a><br> | 71 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab12"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$ifhtml(text)</span></div></a><br> |
| 72 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab13"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$ifpdf(text)</span></div></a><br> | ||
| 73 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab14"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$image(width)(path)</span></div></a><br> | ||
| 74 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab15"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$input(file name)</span></div></a><br> | ||
| 75 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab16"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$italic(text)</span></div></a><br> | ||
| 76 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab17"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$item</span></div></a><br> | ||
| 77 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab18"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$label(name)</span></div></a><br> | ||
| 78 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab19"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$latex(formula)</span></div></a><br> | ||
| 79 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab20"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$list(text)</span></div></a><br> | ||
| 80 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab21"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$lpar</span></div></a><br> | ||
| 81 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab22"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$mailto(address)(text)</span></div></a><br> | ||
| 82 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab23"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$note(text)</span></div></a><br> | ||
| 83 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab24"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$par</span></div></a><br> | ||
| 84 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab25"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$ref(name)(text)</span></div></a><br> | ||
| 85 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab26"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$rgb(color)(text)</span></div></a><br> | ||
| 86 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab27"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$rpar</span></div></a><br> | ||
| 87 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab28"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$section(title)</span></div></a><br> | ||
| 88 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab29"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$sub(text)</span></div></a><br> | ||
| 89 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab30"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$subsection(title)</span></div></a><br> | ||
| 90 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab31"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$subsubsection(title)</span></div></a><br> | ||
| 91 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab32"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$sup(text)</span></div></a><br> | ||
| 92 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab33"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tbgc(color)(text)</span></div></a><br> | ||
| 93 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab34"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tlink(text)(url)</span></div></a><br> | ||
| 94 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab35"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tt(text)</span></div></a><br> | ||
| 95 | +<div align="left" style="display: inline-block; width: 20px;"></div><a rel="tag" href="#toclab36"><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$verbatim(text)</span></div></a><br> | ||
| 98 | <br> | 96 | <br> |
| 99 | 97 | ||
| 100 | <a id=toclab1></a><h2>The <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> syntax</h2> | 98 | <a id=toclab1></a><h2>The <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> syntax</h2> |
| @@ -106,8 +104,8 @@ in HTML. If you want to insert an actual <em>tilde</em> character in your text, | @@ -106,8 +104,8 @@ in HTML. If you want to insert an actual <em>tilde</em> character in your text, | ||
| 106 | that what follows is a <em>mark</em>. The name of the mark immediatly follows the character <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$</span>. The arguments | 104 | that what follows is a <em>mark</em>. The name of the mark immediatly follows the character <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$</span>. The arguments |
| 107 | of the mark follow this name, and each one must be delimited by a pair of parentheses. For example, if you | 105 | of the mark follow this name, and each one must be delimited by a pair of parentheses. For example, if you |
| 108 | want to render some text in blue, you can write: | 106 | want to render some text in blue, you can write: |
| 109 | -<br><center><table style="color: inherit; font-size: inherit;"><tr><td><pre style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;">$blue(this text is rendered in blue) | ||
| 110 | -</pre></td></tr></table></center><br> | 107 | +<br><center><table style="color: inherit; font-size: inherit;"><tr><td><table style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;"><tr><td><pre>$blue(this text is rendered in blue) |
| 108 | +</pre></td></tr></table></td></tr></table></center><br> | ||
| 111 | which will produce this: | 109 | which will produce this: |
| 112 | <br><center><table style="color: inherit; font-size: inherit;"><tr><td><div style="display: inline; color: rgb(0,0,200)">this text is rendered in blue</div></td></tr></table></center><br> | 110 | <br><center><table style="color: inherit; font-size: inherit;"><tr><td><div style="display: inline; color: rgb(0,0,200)">this text is rendered in blue</div></td></tr></table></center><br> |
| 113 | <br>Each mark accepts a fixed number of arguments. Since each argument must be delimited by a pair of parentheses | 111 | <br>Each mark accepts a fixed number of arguments. Since each argument must be delimited by a pair of parentheses |
| @@ -117,12 +115,12 @@ parenthese. Nevertheless, you can still include unbalanced parentheses in an arg | @@ -117,12 +115,12 @@ parenthese. Nevertheless, you can still include unbalanced parentheses in an arg | ||
| 117 | <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$lpar</span> (left parenthese) and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$rpar</span> (right parenthese). | 115 | <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$lpar</span> (left parenthese) and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$rpar</span> (right parenthese). |
| 118 | <br><br>The mark <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$blue</span> takes one argument as you saw above. As another example, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tlink</span> takes two | 116 | <br><br>The mark <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$blue</span> takes one argument as you saw above. As another example, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tlink</span> takes two |
| 119 | arguments, and the text: | 117 | arguments, and the text: |
| 120 | -<br><center><table style="color: inherit; font-size: inherit;"><tr><td><pre style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;">$tlink(Visit | 118 | +<br><center><table style="color: inherit; font-size: inherit;"><tr><td><table style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;"><tr><td><pre>$tlink(Visit |
| 121 | $big($blue(G)$red(o)$yellow(o)$blue(g)$green(l)$red(e))) | 119 | $big($blue(G)$red(o)$yellow(o)$blue(g)$green(l)$red(e))) |
| 122 | (http://www.google.com) | 120 | (http://www.google.com) |
| 123 | -</pre></td></tr></table></center><br> | 121 | +</pre></td></tr></table></td></tr></table></center><br> |
| 124 | will produce this (that you can click upon): | 122 | will produce this (that you can click upon): |
| 125 | -<br><br><center><table style="color: inherit; font-size: inherit;"><tr><td><a href="http://www.google.com" target="wf6007c235f2664f2d79cbe18b01f9097aa7eab80">Visit <big><div style="display: inline; color: rgb(0,0,200)">G</div><div style="display: inline; color: rgb(220,0,0)">o</div><div style="display: inline; color: rgb(180,180,0)">o</div><div style="display: inline; color: rgb(0,0,200)">g</div><div style="display: inline; color: rgb(0,180,0)">l</div><div style="display: inline; color: rgb(220,0,0)">e</div></big></a></td></tr></table></center><br> | 123 | +<br><br><center><table style="color: inherit; font-size: inherit;"><tr><td><a href="http://www.google.com" target="w3f3e70818b5b9c6a9b18ca17def89046a999c993">Visit <big><div style="display: inline; color: rgb(0,0,200)">G</div><div style="display: inline; color: rgb(220,0,0)">o</div><div style="display: inline; color: rgb(180,180,0)">o</div><div style="display: inline; color: rgb(0,0,200)">g</div><div style="display: inline; color: rgb(0,180,0)">l</div><div style="display: inline; color: rgb(220,0,0)">e</div></big></a></td></tr></table></center><br> |
| 126 | <br><em>Remark:</em> The name of a mark is right delimited by the first character which is not an acceptable character | 124 | <br><em>Remark:</em> The name of a mark is right delimited by the first character which is not an acceptable character |
| 127 | for such a name. If this character is a space, it is discarded. On the contrary, if a second | 125 | for such a name. If this character is a space, it is discarded. On the contrary, if a second |
| 128 | space follows, it is not discarded. Hence for example, | 126 | space follows, it is not discarded. Hence for example, |
| @@ -140,7 +138,7 @@ marks. In other words, it's better to first define (using the <span style="font- | @@ -140,7 +138,7 @@ marks. In other words, it's better to first define (using the <span style="font- | ||
| 140 | text, rather than writing them from scratch at each occurrence. In some sens, defining these concepts is the same as | 138 | text, rather than writing them from scratch at each occurrence. In some sens, defining these concepts is the same as |
| 141 | creating your own style. | 139 | creating your own style. |
| 142 | <br><br>For example, it can be the case that some concept of your discourse has to be emphasized in a particular way, say printed | 140 | <br><br>For example, it can be the case that some concept of your discourse has to be emphasized in a particular way, say printed |
| 143 | -in red. You should not use <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$red(...)</span> in the text. You should better first give a name (say <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">thething</span>) to | 141 | +in red. You whould not use <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$red(...)</span> in the text. You should better first give a name (say <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">thething</span>) to |
| 144 | your concept, and define it near the beginning of the text: | 142 | your concept, and define it near the beginning of the text: |
| 145 | <br><br><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$define(thething)(1)($red($1))</span> | 143 | <br><br><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$define(thething)(1)($red($1))</span> |
| 146 | <br><br>and write <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$thething(...)</span> in the text instead of <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$red(...)</span>. | 144 | <br><br>and write <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$thething(...)</span> in the text instead of <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$red(...)</span>. |
| @@ -148,39 +146,38 @@ your concept, and define it near the beginning of the text: | @@ -148,39 +146,38 @@ your concept, and define it near the beginning of the text: | ||
| 148 | to later update. | 146 | to later update. |
| 149 | It also has the advantage that you can later easily change the layout of the text by modifying | 147 | It also has the advantage that you can later easily change the layout of the text by modifying |
| 150 | only the values in these <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$define</span>. | 148 | only the values in these <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$define</span>. |
| 151 | -<br><br>The <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$input</span> mark let you ``input'' a <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> source at any point of nother <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> source. Hence, you should | ||
| 152 | -define your style in a file (say <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">mystyle.maml</span>) and put an <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$input(mystyle.maml)</span> at the beginning of your | ||
| 153 | -source file. | 149 | + |
| 150 | + | ||
| 154 | 151 | ||
| 155 | 152 | ||
| 156 | <a id=toclab3></a><h2>The catalog of <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> marks</h2> | 153 | <a id=toclab3></a><h2>The catalog of <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> marks</h2> |
| 157 | Below are the <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> marks in alphabetic order: | 154 | Below are the <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> marks in alphabetic order: |
| 158 | 155 | ||
| 159 | - <a id="big"></a><a id=toclab4></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$big(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></h3> Prints its argument <div style="display: inline; color: rgb(0,80,0)"><text></div> bigger. This mark can be nested. | 156 | + <a id="big"></a><a id=toclab4></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$big(text)</span></div></h3> Prints its argument <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span> bigger. This mark can be nested. |
| 160 | 157 | ||
| 161 | 158 | ||
| 162 | - <a id="bold"></a><a id=toclab5></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$bold(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></h3> Prints its argument <div style="display: inline; color: rgb(0,80,0)"><text></div> in <strong>bold</strong>. | 159 | + <a id="bold"></a><a id=toclab5></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$bold(text)</span></div></h3> Prints its argument <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span> in <strong>bold</strong>. |
| 163 | 160 | ||
| 164 | - <a id="box"></a><a id=toclab6></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$box(<div style="display: inline; color: rgb(0,80,0)"><width></div>)(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></h3> This mark puts <div style="display: inline; color: rgb(0,80,0)"><text></div> into an invisible box of width <div style="display: inline; color: rgb(0,80,0)"><width></div>. The text if left aligned | 161 | + <a id="box"></a><a id=toclab6></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$box(width)(text)</span></div></h3> This mark puts <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span> into an invisible box of width <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">width</div></span>. The text if left aligned |
| 165 | within the box. This mark can be used for simulating tabulators. For example, | 162 | within the box. This mark can be used for simulating tabulators. For example, |
| 166 | - <pre style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;"> | 163 | + <table style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;"><tr><td><pre> |
| 167 | $box(50)(Smith) $box(50)(John) $box(30)(24) Baltimore $par | 164 | $box(50)(Smith) $box(50)(John) $box(30)(24) Baltimore $par |
| 168 | $box(50)(Ford) $box(50)(Max) $box(30)(32) New York $par | 165 | $box(50)(Ford) $box(50)(Max) $box(30)(32) New York $par |
| 169 | - </pre> | 166 | + </pre></td></tr></table> |
| 170 | produces: | 167 | produces: |
| 171 | <br><br> <div align="left" style="display: inline-block; width: 50px;">Smith</div> <div align="left" style="display: inline-block; width: 50px;">John</div> <div align="left" style="display: inline-block; width: 30px;">24</div> Baltimore <br> <div align="left" style="display: inline-block; width: 50px;">Ford</div> <div align="left" style="display: inline-block; width: 50px;">Max</div> <div align="left" style="display: inline-block; width: 30px;">32</div> New York <br> <br> Of course, if you have to produce such tables, you should better first define a new mark whose role is to display | 168 | <br><br> <div align="left" style="display: inline-block; width: 50px;">Smith</div> <div align="left" style="display: inline-block; width: 50px;">John</div> <div align="left" style="display: inline-block; width: 30px;">24</div> Baltimore <br> <div align="left" style="display: inline-block; width: 50px;">Ford</div> <div align="left" style="display: inline-block; width: 50px;">Max</div> <div align="left" style="display: inline-block; width: 30px;">32</div> New York <br> <br> Of course, if you have to produce such tables, you should better first define a new mark whose role is to display |
| 172 | a single line of the table. This mark should include the <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$par</span> at the end of line. | 169 | a single line of the table. This mark should include the <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$par</span> at the end of line. |
| 173 | 170 | ||
| 174 | - <a id="center"></a><a id=toclab7></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$center(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></h3> This mark horizontally centers the <div style="display: inline; color: rgb(0,80,0)"><text></div> in the page. | 171 | + <a id="center"></a><a id=toclab7></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$center(text)</span></div></h3> This mark horizontally centers the <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span> in the page. |
| 175 | 172 | ||
| 176 | - <a id="code"></a><a id=toclab8></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$code(<div style="display: inline; color: rgb(0,80,0)"><background color></div>)(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></h3> This marks is for writing computer code. | ||
| 177 | - The <div style="display: inline; color: rgb(0,80,0)"><background-color></div> argument must have the form <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">r,g,b</span>, where <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">r</span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">g</span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">b</span> are intensities of | 173 | + <a id="code"></a><a id=toclab8></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$code(background-color)(text)</span></div></h3> This marks is for writing computer code. |
| 174 | + The <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">background-color</div></span> argument must have the form <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">r,g,b</span>, where <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">r</span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">g</span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">b</span> are intensities of | ||
| 178 | red green and blue and must be integers between 0 and 255. | 175 | red green and blue and must be integers between 0 and 255. |
| 179 | - The <div style="display: inline; color: rgb(0,80,0)"><text></div> argument is formated using a fixed width | 176 | + The <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span> argument is formated using a fixed width |
| 180 | (typewriter) font, spaces and newlines are taken into account, so that the result has essentially the same layout as the | 177 | (typewriter) font, spaces and newlines are taken into account, so that the result has essentially the same layout as the |
| 181 | - original. Nevertheless, <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> marks are allowed within <div style="display: inline; color: rgb(0,80,0)"><text></div>, but some of them, such as <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$list</span>, | 178 | + original. Nevertheless, <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> marks are allowed within <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span>, but some of them, such as <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$list</span>, |
| 182 | can produce incoherent result. For example, | 179 | can produce incoherent result. For example, |
| 183 | - <br> <pre style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;">$code(220,220,220)( | 180 | + <br> <table style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;"><tr><td><pre>$code(220,220,220)( |
| 184 | $red(define) $blue(Int) | 181 | $red(define) $blue(Int) |
| 185 | length | 182 | length |
| 186 | ( | 183 | ( |
| @@ -191,9 +188,9 @@ $red(define) $blue(Int) | @@ -191,9 +188,9 @@ $red(define) $blue(Int) | ||
| 191 | [ ] $red(then) 0, $green(// the list is empty) | 188 | [ ] $red(then) 0, $green(// the list is empty) |
| 192 | [h . t] $red(then) 1+length(t) | 189 | [h . t] $red(then) 1+length(t) |
| 193 | }. | 190 | }. |
| 194 | - )</pre> | 191 | + )</pre></td></tr></table> |
| 195 | <br> produces: | 192 | <br> produces: |
| 196 | - <br> <pre style="color: inherit; font-size: inherit; background-color: rgb(220,220,220); width: 600px;"> | 193 | + <br> <table style="color: inherit; font-size: inherit; background-color: rgb(220,220,220); width: 600px;"><tr><td><pre> |
| 197 | <div style="display: inline; color: rgb(220,0,0)">define</div> <div style="display: inline; color: rgb(0,0,200)">Int</div> | 194 | <div style="display: inline; color: rgb(220,0,0)">define</div> <div style="display: inline; color: rgb(0,0,200)">Int</div> |
| 198 | length | 195 | length |
| 199 | ( | 196 | ( |
| @@ -204,170 +201,158 @@ $red(define) $blue(Int) | @@ -204,170 +201,158 @@ $red(define) $blue(Int) | ||
| 204 | [ ] <div style="display: inline; color: rgb(220,0,0)">then</div> 0, <div style="display: inline; color: rgb(0,180,0)">// the list is empty</div> | 201 | [ ] <div style="display: inline; color: rgb(220,0,0)">then</div> 0, <div style="display: inline; color: rgb(0,180,0)">// the list is empty</div> |
| 205 | [h . t] <div style="display: inline; color: rgb(220,0,0)">then</div> 1+length(t) | 202 | [h . t] <div style="display: inline; color: rgb(220,0,0)">then</div> 1+length(t) |
| 206 | }. | 203 | }. |
| 207 | - </pre> | 204 | + </pre></td></tr></table> |
| 208 | <br> See also <a rel="tag" href="#tt"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tt(...)</span></a> and <a rel="tag" href="#verbatim"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$verbatim(...)</span></a> | 205 | <br> See also <a rel="tag" href="#tt"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tt(...)</span></a> and <a rel="tag" href="#verbatim"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$verbatim(...)</span></a> |
| 209 | 206 | ||
| 210 | 207 | ||
| 211 | - <a id="comment"></a><a id=toclab9></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$comment(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></h3> This mark allows you to put a comment, which will not be rendered, in your <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> source text. | ||
| 212 | - <br> <em>Warning:</em> Parentheses must be balanced within <div style="display: inline; color: rgb(0,80,0)"><text></div>, otherwise the <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> parser will not find the end of the | 208 | + <a id="comment"></a><a id=toclab9></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$comment(text)</span></div></h3> This mark allows you to put a comment, which will not be rendered, in your <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> source text. |
| 209 | + <br> <em>Warning:</em> Parentheses must be balanced within <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span>, otherwise the <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> parser will not find the end of the | ||
| 213 | comment. | 210 | comment. |
| 214 | 211 | ||
| 215 | - <a id="define"></a><a id=toclab10></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$define(<div style="display: inline; color: rgb(0,80,0)"><name></div>)(<div style="display: inline; color: rgb(0,80,0)"><numer of arguments></div>)(<div style="display: inline; color: rgb(0,80,0)"><value></div>)</span></div></h3> | ||
| 216 | - This mark let you define new marks (i.e. macros). It takes three arguments. The first argument <div style="display: inline; color: rgb(0,80,0)"><name></div> is the name of the new mark. It should | 212 | + <a id="define"></a><a id=toclab10></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$define(name)(num)(value)</span></div></h3> |
| 213 | + This mark let you define new marks (i.e. macros). It takes three arguments. The first argument <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">name</div></span> is the name of the new mark. It should | ||
| 217 | not be already in use, must be made only of letters (A to Z and a to z) and numbers (0 to 9), and | 214 | not be already in use, must be made only of letters (A to Z and a to z) and numbers (0 to 9), and |
| 218 | - must contain at least one letter. The second argument <div style="display: inline; color: rgb(0,80,0)"><number of arguments></div> is the number of arguments your new mark will accept. It must | ||
| 219 | - be a positive or zero integer. The last argument <div style="display: inline; color: rgb(0,80,0)"><value></div> is the value of the mark. This is a <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> text, and it can | 215 | + must contain at least one letter. The second argument <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">num</div></span> is the number of arguments your new mark will accept. It must |
| 216 | + be a positive or zero integer. The last argument <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">value</div></span> is the value of the mark. This is a <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> text, and it can | ||
| 220 | contain marks of the form <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$1</span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$2</span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$3</span>, ... (called <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> <em>variables</em>) which represent the arguments | 217 | contain marks of the form <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$1</span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$2</span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$3</span>, ... (called <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> <em>variables</em>) which represent the arguments |
| 221 | of the mark, and which will be later replaced by the actual arguments when the mark is used in the text. | 218 | of the mark, and which will be later replaced by the actual arguments when the mark is used in the text. |
| 222 | 219 | ||
| 223 | <a id="dollar"></a><a id=toclab11></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$dollar</span></div></h3> This mark inserts a character $ in the text. Notice that <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tt($dollar)</span> | 220 | <a id="dollar"></a><a id=toclab11></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$dollar</span></div></h3> This mark inserts a character $ in the text. Notice that <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tt($dollar)</span> |
| 224 | - produces <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$</span>, wheras <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$dollar</span> produces $. You can also write <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$</span> instead of <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$dollar</span>, | ||
| 225 | - provided that the character <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$</span> is not followed by an integer, nor a latin letter nor a tilde character. | 221 | + produces <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$</span>, wheras <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$dollar</span> produces $. |
| 226 | 222 | ||
| 227 | - <a id="end"></a><a id=toclab12></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$end</span></div></h3> This mark indicates that the MAML compiler should stop reading. In case this mark appears within a | ||
| 228 | - source text read through an <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$input</span> mark, the ``input'' file is closed and parsing resumes in the | ||
| 229 | - calling source. | ||
| 230 | - | ||
| 231 | - <a id="ifhtml"></a><a id=toclab13></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$ifhtml(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></h3> The argument <div style="display: inline; color: rgb(0,80,0)"><text></div> will be present in the HTML output, but not in the <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px"> nor in the PDF | 223 | + <a id="ifhtml"></a><a id=toclab12></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$ifhtml(text)</span></div></h3> The argument <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span> will be present in the HTML output, but not in the <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px"> nor in the PDF |
| 232 | output. | 224 | output. |
| 233 | 225 | ||
| 234 | - <a id="ifpdf"></a><a id=toclab14></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$ifpdf(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></h3> The argument <div style="display: inline; color: rgb(0,80,0)"><text></div> will be present in the <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px"> and in the PDF | 226 | + <a id="ifpdf"></a><a id=toclab13></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$ifpdf(text)</span></div></h3> The argument <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span> will be present in the <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px"> and in the PDF |
| 235 | output, but not in the HTML output. | 227 | output, but not in the HTML output. |
| 236 | 228 | ||
| 237 | - <a id="image"></a><a id=toclab15></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$image(<div style="display: inline; color: rgb(0,80,0)"><width></div>)(<div style="display: inline; color: rgb(0,80,0)"><file path></div>)</span></div></h3> | ||
| 238 | - This mark allows you to insert an image in the text. The argument <div style="display: inline; color: rgb(0,80,0)"><width></div> is the width the image will have | ||
| 239 | - when displayed (in pixels in the case of HTML, and points in the case of <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px">), and <div style="display: inline; color: rgb(0,80,0)"><file path></div> is the path of the file | 229 | + <a id="image"></a><a id=toclab14></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$image(width)(path)</span></div></h3> |
| 230 | + This mark allows you to insert an image in the text. The argument <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">width</div></span> is the width the image will have | ||
| 231 | + when displayed (in pixels in the case of HTML, and points in the case of <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px">), and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">path</div></span> is the path of the file | ||
| 240 | containing the image. For example, | 232 | containing the image. For example, |
| 241 | - <pre style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;">$center($image($ifpdf(100)$ifhtml(200))(cows.jpg))</pre> | 233 | + <table style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;"><tr><td><pre>$center($image($ifpdf(100)$ifhtml(200))(cows.jpg))</pre></td></tr></table> |
| 242 | will produce this: | 234 | will produce this: |
| 243 | <br><center><table style="color: inherit; font-size: inherit;"><tr><td><img src="cows.jpg" width="200"></td></tr></table></center><br> | 235 | <br><center><table style="color: inherit; font-size: inherit;"><tr><td><img src="cows.jpg" width="200"></td></tr></table></center><br> |
| 244 | At the same time, you remark that the width of the image can be computed by <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> marks. | 236 | At the same time, you remark that the width of the image can be computed by <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> marks. |
| 245 | - <br> <em>Warning:</em> The <div style="display: inline; color: rgb(0,80,0)"><file path></div> of the image is relative to the root directory on the server in the case of | 237 | + <br> <em>Warning:</em> The <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">path</div></span> of the image is relative to the root directory on the server in the case of |
| 246 | an HTML output. In the case of a <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px">/PDF output, it is relative to the directory within which | 238 | an HTML output. In the case of a <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px">/PDF output, it is relative to the directory within which |
| 247 | the MAML parser is executed. | 239 | the MAML parser is executed. |
| 248 | 240 | ||
| 249 | 241 | ||
| 250 | - <a id="input"></a><a id=toclab16></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$input(<div style="display: inline; color: rgb(0,80,0)"><file name></div>)</span></div></h3> | 242 | + <a id="input"></a><a id=toclab15></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$input(file name)</span></div></h3> |
| 251 | This mark let you insert the content of another <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> file. This other file could for example contain your own <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> macros or be the file with extension <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">.mamltoc</span> generated by the <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> compiler (see <a rel="tag" href="#section"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$section</span></a>). | 243 | This mark let you insert the content of another <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> file. This other file could for example contain your own <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> macros or be the file with extension <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">.mamltoc</span> generated by the <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> compiler (see <a rel="tag" href="#section"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$section</span></a>). |
| 252 | - For security reasons, this mark has restricted use in the web version of MAML. It can read files from one directory | ||
| 253 | - only. | ||
| 254 | 244 | ||
| 255 | - <a id="italic"></a><a id=toclab17></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$italic(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></h3> Prints its argument <div style="display: inline; color: rgb(0,80,0)"><text></div> in <em>italic</em>. | 245 | + <a id="italic"></a><a id=toclab16></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$italic(text)</span></div></h3> Prints its argument <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span> in <em>italic</em>. |
| 256 | 246 | ||
| 257 | - <a id="item"></a><a id=toclab18></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$item</span></div></h3> Marks the begining of an <em>item</em> within a <a rel="tag" href="#list"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$list</span></a> | 247 | + <a id="item"></a><a id=toclab17></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$item</span></div></h3> Marks the begining of an <em>item</em> within a <a rel="tag" href="#list"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$list</span></a> |
| 258 | 248 | ||
| 259 | - <a id="label"></a><a id=toclab19></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$label(<div style="display: inline; color: rgb(0,80,0)"><tag></div>)</span></div></h3> This mark defines a <em>label</em> in the text, in other words, a position where to jump. | 249 | + <a id="label"></a><a id=toclab18></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$label(name)</span></div></h3> This mark defines a <em>label</em> in the text, in other words, a position where to jump. |
| 260 | This is to be used in conjunction with <a rel="tag" href="#ref"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$ref</span></a>. | 250 | This is to be used in conjunction with <a rel="tag" href="#ref"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$ref</span></a>. |
| 261 | 251 | ||
| 262 | - <a id="latex"></a><a id=toclab20></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$latex(<div style="display: inline; color: rgb(0,80,0)"><formula></div>)</span></div></h3> This mark allows to include math formulas to be formated by <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px">. | 252 | + <a id="latex"></a><a id=toclab19></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$latex(formula)</span></div></h3> This mark allows to include math formulas to be formated by <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px">. |
| 263 | For example, | 253 | For example, |
| 264 | - <br><center><table style="color: inherit; font-size: inherit;"><tr><td><pre style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;">$latex($$\int_0^\infty\frac{dx}{1+x^2}$$)</pre></td></tr></table></center><br> | 254 | + <br><center><table style="color: inherit; font-size: inherit;"><tr><td><table style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;"><tr><td><pre>$latex($$\int_0^\infty\frac{dx}{1+x^2}$$)</pre></td></tr></table></td></tr></table></center><br> |
| 265 | will be rendered as: | 255 | will be rendered as: |
| 266 | <br><center><img src="png/fq22PnfBrYNx2fPr8NQyxy5tdO_A.png" width="72" height="36" style="vertical-align: -0px"></center><br> | 256 | <br><center><img src="png/fq22PnfBrYNx2fPr8NQyxy5tdO_A.png" width="72" height="36" style="vertical-align: -0px"></center><br> |
| 267 | This mark should not be used for big pieces of <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px"> | 257 | This mark should not be used for big pieces of <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px"> |
| 268 | text. It is mainly intended for math formulas, especially for HTML output where the formula is rendered | 258 | text. It is mainly intended for math formulas, especially for HTML output where the formula is rendered |
| 269 | - as a PNG image with transparent background. | ||
| 270 | - <br><br> You can use <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$latex</span> in the text. The result will be correctly aligned with the text. For example,<br> <br><center><table style="color: inherit; font-size: inherit;"><tr><td><pre style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;">the polynomial $latex($X^2+X+1$) is of degree 2</pre></td></tr></table></center><br> | 259 | + as a PNG image with tansparent background. |
| 260 | + <br><br> You can use <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$latex</span> in the text. The result will be correctly aligned with the text. For example,<br> <br><center><table style="color: inherit; font-size: inherit;"><tr><td><table style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;"><tr><td><pre>the polynomial $latex($X^2+X+1$) is of degree 2</pre></td></tr></table></td></tr></table></center><br> | ||
| 271 | is rendered as : | 261 | is rendered as : |
| 272 | <br><center><table style="color: inherit; font-size: inherit;"><tr><td>the polynomial <img src="png/fyKx7xRolFAoYjXkjs4VdbNyRjAQ.png" width="77" height="15" style="vertical-align: -1px"> is of degree 2</td></tr></table></center><br> | 262 | <br><center><table style="color: inherit; font-size: inherit;"><tr><td>the polynomial <img src="png/fyKx7xRolFAoYjXkjs4VdbNyRjAQ.png" width="77" height="15" style="vertical-align: -1px"> is of degree 2</td></tr></table></center><br> |
| 273 | 263 | ||
| 274 | - <a id="list"></a><a id=toclab21></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$list(<div style="display: inline; color: rgb(0,80,0)"><items></div>)</span></div></h3> This mark allows to create a list. The argument <div style="display: inline; color: rgb(0,80,0)"><items></div> must be a sequence of <em>items</em>, | ||
| 275 | - i.e. texts which are all prefixed by the mark <a rel="tag" href="#item"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$item</span></a>. | 264 | + <a id="list"></a><a id=toclab20></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$list(text)</span></div></h3> This mark allows to create a list. The argument <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span> must be a sequence of <em>items</em>, |
| 265 | + i.e. texts which are all beginning by the mark <a rel="tag" href="#item"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$item</span></a>. | ||
| 276 | 266 | ||
| 277 | - <a id="lpar"></a><a id=toclab22></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$lpar</span></div></h3> This mark inserts a left (opening) parenthese into the text. You must use <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$lpar</span> and/or | 267 | + <a id="lpar"></a><a id=toclab21></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$lpar</span></div></h3> This mark inserts a left (opening) parenthese into the text. You must use <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$lpar</span> and/or |
| 278 | <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$rpar</span> if you want to introduce unbalanced parentheses within an argument of a mark. | 268 | <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$rpar</span> if you want to introduce unbalanced parentheses within an argument of a mark. |
| 279 | 269 | ||
| 280 | - <a id="mailto"></a><a id=toclab23></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$mailto(<div style="display: inline; color: rgb(0,80,0)"><address></div>)(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></h3> This marks, which appears as <div style="display: inline; color: rgb(0,80,0)"><text></div>, | 270 | + <a id="mailto"></a><a id=toclab22></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$mailto(address)(text)</span></div></h3> This marks, which appears as <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span>, |
| 281 | creates a link which is supposed, in the HTML case, to open your mail agent in order to let you | 271 | creates a link which is supposed, in the HTML case, to open your mail agent in order to let you |
| 282 | - send an email to the indicated <div style="display: inline; color: rgb(0,80,0)"><address></div>. In the PDF case, the <div style="display: inline; color: rgb(0,80,0)"><address></div> is just indicated between parentheses | ||
| 283 | - beside <div style="display: inline; color: rgb(0,80,0)"><text></div>. | 272 | + send an email to the indicated <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">address</div></span>. In the PDF case, the <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">address</div></span> is just indicated between parentheses |
| 273 | + beside <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span>. | ||
| 284 | For example, | 274 | For example, |
| 285 | <br><center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$blue($mailto(XZ32@planet.mars)(the martian))</span></td></tr></table></center><br> produces: | 275 | <br><center><table style="color: inherit; font-size: inherit;"><tr><td><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$blue($mailto(XZ32@planet.mars)(the martian))</span></td></tr></table></center><br> produces: |
| 286 | <div style="display: inline; color: rgb(0,0,200)"><a href="mailto:XZ32@planet.mars">the martian</a></div> | 276 | <div style="display: inline; color: rgb(0,0,200)"><a href="mailto:XZ32@planet.mars">the martian</a></div> |
| 287 | 277 | ||
| 288 | - <a id="note"></a><a id=toclab24></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$note(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></h3> This mark produces a footnote containing <div style="display: inline; color: rgb(0,80,0)"><text></div>. | 278 | + <a id="note"></a><a id=toclab23></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$note(text)</span></div></h3> This mark produces a footnote containing <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span>. |
| 289 | In the case of <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px">/PDF this is a usual | 279 | In the case of <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px">/PDF this is a usual |
| 290 | footnote. In the case of HTML, this is a popup which appears at the bottom of the browser's window when the mouse | 280 | footnote. In the case of HTML, this is a popup which appears at the bottom of the browser's window when the mouse |
| 291 | passes over this indication : <div class="dropdown"> | 281 | passes over this indication : <div class="dropdown"> |
| 292 | <span>(<sup>note</sup>)</span> | 282 | <span>(<sup>note</sup>)</span> |
| 293 | <div class="drp-content" style="font-size:10px; width:500; padding: 6px 6px 6px 6px;">Here is the note !</div></div>. Try it ! | 283 | <div class="drp-content" style="font-size:10px; width:500; padding: 6px 6px 6px 6px;">Here is the note !</div></div>. Try it ! |
| 294 | 284 | ||
| 295 | - <a id="output"></a><a id=toclab25></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$output(<div style="display: inline; color: rgb(0,80,0)"><file path></div>)(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></h3> This mark does not produce anything in the resulting HTML or PDF files, but outputs | ||
| 296 | - <div style="display: inline; color: rgb(0,80,0)"><text></div> (without any modification) into the file <div style="display: inline; color: rgb(0,80,0)"><file path></div>. For security reasons, this mark is not available | ||
| 297 | - in the web version of MAML. | ||
| 298 | - | ||
| 299 | - <a id="par"></a><a id=toclab26></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$par</span></div></h3> This marks generates a line break. You can use several <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$par</span> in order to make some | 285 | + <a id="par"></a><a id=toclab24></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$par</span></div></h3> This marks generates a line break. You can use several <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$par</span> in order to make some |
| 300 | vertical space in your text. | 286 | vertical space in your text. |
| 301 | <br><br> <em>Warning:</em> The MAML parser doesn't take newline characters into account (they are just read as spaces). Hence, | 287 | <br><br> <em>Warning:</em> The MAML parser doesn't take newline characters into account (they are just read as spaces). Hence, |
| 302 | using <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$par</span> is often necessary. | 288 | using <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$par</span> is often necessary. |
| 303 | 289 | ||
| 304 | - <a id="ref"></a><a id=toclab27></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$ref(<div style="display: inline; color: rgb(0,80,0)"><tag></div>)(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></h3> | 290 | + <a id="ref"></a><a id=toclab25></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$ref(name)(text)</span></div></h3> |
| 305 | This mark creates an internal hyperlink. When clicked upon, this moves the text | 291 | This mark creates an internal hyperlink. When clicked upon, this moves the text |
| 306 | - to the position of the <a rel="tag" href="#label"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$label</span></a> (this is a <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$ref</span> !) with the same tag name. | 292 | + to the position of the <a rel="tag" href="#label"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$label</span></a> (this is a <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$ref</span> !) with the same name. |
| 307 | 293 | ||
| 308 | - <a id="rgb"></a><a id=toclab28></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$rgb(<div style="display: inline; color: rgb(0,80,0)"><color></div>)(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></h3> This mark sets the color of characters in <div style="display: inline; color: rgb(0,80,0)"><text></div> to <div style="display: inline; color: rgb(0,80,0)"><color></div>, where | ||
| 309 | - <div style="display: inline; color: rgb(0,80,0)"><color></div> has the form of three integers separated by commas, representing the intensities of red, green and blue. | 294 | + <a id="rgb"></a><a id=toclab26></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$rgb(color)(text)</span></div></h3> This mark sets the color of characters in <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span> to <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">color</div></span>, where |
| 295 | + <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">color</div></span> has the form of three integers separated by commas, representing the intensities of red, green and blue. | ||
| 310 | These numbers must be between 0 and 255. For example, | 296 | These numbers must be between 0 and 255. For example, |
| 311 | - <br><center><table style="color: inherit; font-size: inherit;"><tr><td><pre style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;">$rgb(255,0,0)(the text)</pre></td></tr></table></center><br> | 297 | + <br><center><table style="color: inherit; font-size: inherit;"><tr><td><table style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;"><tr><td><pre>$rgb(255,0,0)(the text)</pre></td></tr></table></td></tr></table></center><br> |
| 312 | produces: | 298 | produces: |
| 313 | <br><center><table style="color: inherit; font-size: inherit;"><tr><td><div style="display: inline; color: rgb(255,0,0)">the text</div></td></tr></table></center><br> | 299 | <br><center><table style="color: inherit; font-size: inherit;"><tr><td><div style="display: inline; color: rgb(255,0,0)">the text</div></td></tr></table></center><br> |
| 314 | <br> The marks <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$red(...)</span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$green(...)</span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$blue(...)</span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$yellow(...)</span> and | 300 | <br> The marks <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$red(...)</span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$green(...)</span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$blue(...)</span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$yellow(...)</span> and |
| 315 | <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$grey(...)</span> are predefined. | 301 | <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$grey(...)</span> are predefined. |
| 316 | 302 | ||
| 317 | - <a id="rpar"></a><a id=toclab29></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$rpar</span></div></h3> This mark inserts a right (closing) parenthese into the text. You must use <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$lpar</span> and/or | 303 | + <a id="rpar"></a><a id=toclab27></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$rpar</span></div></h3> This mark inserts a right (closing) parenthese into the text. You must use <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$lpar</span> and/or |
| 318 | <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$rpar</span> if you want to introduce unbalanced parentheses within an argument of a mark. | 304 | <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$rpar</span> if you want to introduce unbalanced parentheses within an argument of a mark. |
| 319 | 305 | ||
| 320 | - <a id="section"></a><a id=toclab30></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$section(<div style="display: inline; color: rgb(0,80,0)"><title></div>)</span></div></h3> This mark defines a <em>section</em> within the text. It is translated into | ||
| 321 | - <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><h3><div style="display: inline; color: rgb(0,80,0)"><title></div></h3></span> in HTML and into <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">\section{<div style="display: inline; color: rgb(0,80,0)"><title></div>}</span> in <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px">. Sections are automatically numbered. | ||
| 322 | - <br><br> When it encouters either <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$section</span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$subsection</span> or <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$subsubsection</span>, the <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> compiler adds a line to the file with the same name as the source file but with <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">.mamltoc</span> appended. This file contains | 306 | + <a id="section"></a><a id=toclab28></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$section(title)</span></div></h3> This mark defines a <em>section</em> within the text. It is translated into |
| 307 | + <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><h3><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">title</div></span></h3></span> in HTML and into <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">\section{<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">title</div></span>}</span> in <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px">, producing a numbered | ||
| 308 | + section in the PDF output.<br><br> When it encouters either <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$section</span>, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$subsection</span> or <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$subsubsection</span>, the <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> compiler adds a line to the file with the same name as the source file but with <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">.mamltoc</span> appended. This file contains | ||
| 323 | marks of the form <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tocsec(label)(text)</span> (and similarly <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tocsubsec</span> and | 309 | marks of the form <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tocsec(label)(text)</span> (and similarly <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tocsubsec</span> and |
| 324 | <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tocsubsubsec</span>), and it is up to you to define the meaning of these marks. Combined with <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$input</span> this lets | 310 | <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tocsubsubsec</span>), and it is up to you to define the meaning of these marks. Combined with <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$input</span> this lets |
| 325 | - you make a table of contents for the HTML output. Actually, this is how the table of contents of the present tutorial | ||
| 326 | - was made. | 311 | + you make a table of contents for the HTML output. |
| 327 | 312 | ||
| 328 | - <a id="sub"></a><a id=toclab31></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$sub(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></h3> This mark lowers <div style="display: inline; color: rgb(0,80,0)"><text></div> and renders it in a smaller size. For example, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">x$sub(1)</span> | 313 | + <a id="sub"></a><a id=toclab29></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$sub(text)</span></div></h3> This mark lowers <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span> and renders it in a smaller size. For example, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">x$sub(1)</span> |
| 329 | produces x<sub>1</sub>. | 314 | produces x<sub>1</sub>. |
| 330 | 315 | ||
| 331 | - <a id="subsection"></a><a id=toclab32></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$subsection(<div style="display: inline; color: rgb(0,80,0)"><title></div>)</span></div></h3> This mark defines a <em>subsection</em> within the text. It is translated into | ||
| 332 | - <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><h4><div style="display: inline; color: rgb(0,80,0)"><title></div></h4></span> in HTML and into <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">\subsection{<div style="display: inline; color: rgb(0,80,0)"><title></div>}</span> in <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px">. Subsections are automatically | ||
| 333 | - numbered. | 316 | + <a id="subsection"></a><a id=toclab30></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$subsection(title)</span></div></h3> This mark defines a <em>subsection</em> within the text. It is translated into |
| 317 | + <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><h4><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">title</div></span></h4></span> in HTML and into <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">\subsection{<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">title</div></span>}</span> in <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px">, producing a numbered | ||
| 318 | + subsection in the PDF output. | ||
| 334 | 319 | ||
| 335 | - <a id="subsubsection"></a><a id=toclab33></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$subsubsection(<div style="display: inline; color: rgb(0,80,0)"><title></div>)</span></div></h3> This mark defines a <em>subsubsection</em> within the text. It is translated into | ||
| 336 | - <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><h5><div style="display: inline; color: rgb(0,80,0)"><title></div></h5></span> in HTML and into <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">\subsubsection{<div style="display: inline; color: rgb(0,80,0)"><title></div>}</span> in <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px">. Subsubsections are automatically | ||
| 337 | - numbered. | 320 | + <a id="subsubsection"></a><a id=toclab31></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$subsubsection(title)</span></div></h3> This mark defines a <em>subsubsection</em> within the text. It is translated into |
| 321 | + <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><h5><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">title</div></span></h5></span> in HTML and into <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">\subsubsection{<span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">title</div></span>}</span> in <img src="png/fNScTnBA4MH-qH_w0pRfArXeeKE8.png" width="36" height="14" style="vertical-align: -3px">, producing a numbered | ||
| 322 | + subsubsection in the PDF output. | ||
| 338 | 323 | ||
| 339 | - <a id="sup"></a><a id=toclab34></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$sup(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></h3> This mark raises <div style="display: inline; color: rgb(0,80,0)"><text></div> and renders it in a smaller size. For example, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">x$sup(1)</span> | 324 | + <a id="sup"></a><a id=toclab32></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$sup(text)</span></div></h3> This mark raises <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span> and renders it in a smaller size. For example, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">x$sup(1)</span> |
| 340 | produces x<sup>1</sup>. | 325 | produces x<sup>1</sup>. |
| 341 | 326 | ||
| 342 | - <a id="tbgc"></a><a id=toclab35></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tbgc(<div style="display: inline; color: rgb(0,80,0)"><color></div>)(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></h3> This mark (<em>text background color</em>) shows <div style="display: inline; color: rgb(0,80,0)"><text></div> over a background of color | ||
| 343 | - <div style="display: inline; color: rgb(0,80,0)"><color></div>. For example, | ||
| 344 | - <br><center><table style="color: inherit; font-size: inherit;"><tr><td><pre style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;">$tbgc(255,200,200)(Some text.)</pre></td></tr></table></center><br> | ||
| 345 | - produces: <div style="display: inline; background-color: rgb(255,200,200); ">Some text.</div> <em>Warning:</em> This will force <div style="display: inline; color: rgb(0,80,0)"><text></div> to be on a single line, so that | ||
| 346 | - it is valuable only for very short texts. See also <a rel="tag" href="#code"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$code(...)</span></a>. | 327 | + <a id="tbgc"></a><a id=toclab33></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tbgc(color)(text)</span></div></h3> This mark (<em>text background color</em>) shows <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span> over a background of color |
| 328 | + <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">color</div></span>. For example, | ||
| 329 | + <br><center><table style="color: inherit; font-size: inherit;"><tr><td><table style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;"><tr><td><pre>$tbgc(255,200,200)(Some text.)</pre></td></tr></table></td></tr></table></center><br> | ||
| 330 | + produces: <div style="display: inline; background-color: rgb(255,200,200); ">Some text.</div> <em>Warning:</em> This will force <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span> to be on a single line, so that | ||
| 331 | + it is valuable only for very short texts. | ||
| 347 | 332 | ||
| 348 | - <a id="tlink"></a><a id=toclab36></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tlink(<div style="display: inline; color: rgb(0,80,0)"><text></div>)(<div style="display: inline; color: rgb(0,80,0)"><url></div>)</span></div></h3> This mark creates an hypertext link targeting the <div style="display: inline; color: rgb(0,80,0)"><url></div>, and shown as the clickable | ||
| 349 | - <div style="display: inline; color: rgb(0,80,0)"><text></div> (which can also be an image). | 333 | + <a id="tlink"></a><a id=toclab34></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tlink(text)(url)</span></div></h3> This mark creates an hypertext link targeting the <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">url</div></span>, and shown as the clickable |
| 334 | + <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span> (which can also be an image). | ||
| 350 | 335 | ||
| 351 | - <a id="tt"></a><a id=toclab37></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tt(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></h3> This mark renders <div style="display: inline; color: rgb(0,80,0)"><text></div> in fixed width (typewriter) font. It is similar to | ||
| 352 | - <a rel="tag" href="#code"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$code(...)</span></a>, with the difference that <div style="display: inline; color: rgb(0,80,0)"><text></div> is put inline instead of as a separate block. | ||
| 353 | - For example, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tt(This) is $code(255,255,255)(an) example.</span> | ||
| 354 | - produces: <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">This</span> is <pre style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;">an</pre> example. | 336 | + <a id="tt"></a><a id=toclab35></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tt(text)</span></div></h3> This mark renders <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span> in fixed width (typewriter) font. It is similar to |
| 337 | + <a rel="tag" href="#code"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$code(...)</span></a>, with the difference that <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span> is put inline instead of as a separate block. | ||
| 338 | + For example, <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tt(This) is $code(an) example.</span> | ||
| 339 | + produces: <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">This</span> is <table style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;"><tr><td><pre>an</pre></td></tr></table> example. | ||
| 355 | <br> See also <a rel="tag" href="#code"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$code(...)</span></a> and <a rel="tag" href="#verbatim"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$verbatim(...)</span></a>. | 340 | <br> See also <a rel="tag" href="#code"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$code(...)</span></a> and <a rel="tag" href="#verbatim"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$verbatim(...)</span></a>. |
| 356 | 341 | ||
| 357 | - <a id="verbatim"></a><a id=toclab38></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$verbatim(<div style="display: inline; color: rgb(0,80,0)"><text></div>)</span></div></h3> This marks reproduces its content without any change with two exceptions. | 342 | + <a id="verbatim"></a><a id=toclab36></a><h3><div style="display: inline; color: rgb(220,0,0)"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$verbatim(text)</span></div></h3> This marks reproduces its content without any change with two exceptions. |
| 358 | Indeed, <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> marks within | 343 | Indeed, <strong><div style="display: inline; color: rgb(220,0,0)">MAML</div></strong> marks within |
| 359 | - <div style="display: inline; color: rgb(0,80,0)"><text></div> are not interpreted, except the two marks <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$lpar</span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$rpar</span>, which allows you | ||
| 360 | - to produce unbalanced parentheses in <div style="display: inline; color: rgb(0,80,0)"><text></div> despite the fact that actual parentheses <em>must</em> be | ||
| 361 | - balanced in <div style="display: inline; color: rgb(0,80,0)"><text></div>. Example: | ||
| 362 | - <br> <pre style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;">$verbatim( | 344 | + <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span> are not interpreted, except the two marks <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$lpar</span> and <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$rpar</span>, which allows you |
| 345 | + to produce unbalanced parentheses in <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span> despite the fact that actual parentheses <em>must</em> be | ||
| 346 | + balanced in <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;"><div style="display: inline; color: rgb(220,0,0)">text</div></span>. Example: | ||
| 347 | + <br> <table style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;"><tr><td><pre>$verbatim( | ||
| 363 | In this ($blue(text))(), ((parentheses) are) $rpar$rpar$lpar balanced. | 348 | In this ($blue(text))(), ((parentheses) are) $rpar$rpar$lpar balanced. |
| 364 | - )</pre> | 349 | + )</pre></td></tr></table> |
| 365 | <br> produces: | 350 | <br> produces: |
| 366 | <br><pre> | 351 | <br><pre> |
| 367 | In this ($blue(text))(), ((parentheses) are) ))( balanced. | 352 | In this ($blue(text))(), ((parentheses) are) ))( balanced. |
| 368 | </pre><br> | 353 | </pre><br> |
| 369 | Nevertheless, colors are applied if <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$verbatim(...)</span> is within a <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$rgb(...)(...)</span>. Indeed, | 354 | Nevertheless, colors are applied if <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$verbatim(...)</span> is within a <span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$rgb(...)(...)</span>. Indeed, |
| 370 | - <pre style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;">$rgb(255,0,0)($verbatim(Red verbatim text))</pre> | 355 | + <table style="color: inherit; font-size: inherit; background-color: rgb(255,255,255); width: 600px;"><tr><td><pre>$rgb(255,0,0)($verbatim(Red verbatim text))</pre></td></tr></table> |
| 371 | produces: | 356 | produces: |
| 372 | <div style="display: inline; color: rgb(255,0,0)"><br><pre>Red verbatim text</pre><br></div> | 357 | <div style="display: inline; color: rgb(255,0,0)"><br><pre>Red verbatim text</pre><br></div> |
| 373 | <br> See also <a rel="tag" href="#code"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$code(...)</span></a> and <a rel="tag" href="#tt"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tt(...)</span></a>. | 358 | <br> See also <a rel="tag" href="#code"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$code(...)</span></a> and <a rel="tag" href="#tt"><span style="font-family:'Lucida Console', monospace; font-size:inherit; font-style: normal;">$tt(...)</span></a>. |
| @@ -378,5 +363,4 @@ $red(define) $blue(Int) | @@ -378,5 +363,4 @@ $red(define) $blue(Int) | ||
| 378 | 363 | ||
| 379 | 364 | ||
| 380 | 365 | ||
| 381 | - | ||
| 382 | </div></td></tr></table></center></body></html> | 366 | </div></td></tr></table></center></body></html> |
| 383 | \ No newline at end of file | 367 | \ No newline at end of file |
anubis_dev/library/doc_tools/maml3_tutorial.maml.pdf
No preview for this file type
anubis_dev/library/network/metaprotocol.anubis
| @@ -34,28 +34,12 @@ public type Protocol:... | @@ -34,28 +34,12 @@ public type Protocol:... | ||
| 34 | states are always of opposite kinds. | 34 | states are always of opposite kinds. |
| 35 | 35 | ||
| 36 | 36 | ||
| 37 | - *** Description of a state. | ||
| 38 | - | ||
| 39 | - Execution in a given state (should it be a server state or a client state) is as follows: | ||
| 40 | - | ||
| 41 | - - for the initial state (on one side only): | ||
| 42 | - -- create a first state and send the initial message. | ||
| 43 | - | ||
| 44 | - - for all other states: | ||
| 45 | - -- wait for the message, | ||
| 46 | - -- apply a function to this message and the previous state. This function returns either: | ||
| 47 | - - a pair made of the message to be sent and a new state (in this case, send the message), or | ||
| 48 | - - nothing (in this case, close the connection). | ||
| 49 | - | ||
| 50 | -public type ProtocolState: | ||
| 51 | - initial (String state_name, | ||
| 52 | - List(String) state_types, | ||
| 53 | - List(String) initial_values, | ||
| 54 | - String function_name), | ||
| 55 | - | ||
| 56 | - other (String state_name, | ||
| 57 | - List(String) state_names, | ||
| 58 | - String function_name). | 37 | + |
| 38 | + | ||
| 39 | + | ||
| 40 | + | ||
| 41 | + | ||
| 42 | + | ||
| 59 | 43 | ||
| 60 | 44 | ||
| 61 | 45 |
anubis_dev/library/predefined.anubis
| @@ -4612,8 +4612,7 @@ public define SQLite3QueryResult | @@ -4612,8 +4612,7 @@ public define SQLite3QueryResult | ||
| 4612 | *** (13) Fast lexical analysis. | 4612 | *** (13) Fast lexical analysis. |
| 4613 | 4613 | ||
| 4614 | We provide a small tool for compiling lexers described using lists into 'fast | 4614 | We provide a small tool for compiling lexers described using lists into 'fast |
| 4615 | - lexers'. Here we have only low level tools. High level tools, including an LEX/FLEX-like algorithm | ||
| 4616 | - for constructing a low level lexer from a set of regular expressions (to be used preferably) | 4615 | + lexers'. Here we have only low level tools. High level tools (to be used preferably) |
| 4617 | are in 'library/lexical_analysis/'. | 4616 | are in 'library/lexical_analysis/'. |
| 4618 | 4617 | ||
| 4619 | 4618 | ||
| @@ -4621,7 +4620,7 @@ public define SQLite3QueryResult | @@ -4621,7 +4620,7 @@ public define SQLite3QueryResult | ||
| 4621 | 4620 | ||
| 4622 | A 'lexer' is an automaton made of 'states' and 'transitions'. To each state is | 4621 | A 'lexer' is an automaton made of 'states' and 'transitions'. To each state is |
| 4623 | attached a set of 'transitions' (having this state as their 'source state'). A | 4622 | attached a set of 'transitions' (having this state as their 'source state'). A |
| 4624 | - transition is a pair made of a character (Word8) and a state name (Word16) (the 'target' | 4623 | + transition is a pair made of a character (Word8) and a state (Word16) (the 'target' |
| 4625 | state for this transition). | 4624 | state for this transition). |
| 4626 | 4625 | ||
| 4627 | public type FastLexerTransition: | 4626 | public type FastLexerTransition: |
| @@ -4631,9 +4630,7 @@ public type FastLexerTransition: | @@ -4631,9 +4630,7 @@ public type FastLexerTransition: | ||
| 4631 | There are three sorts of states: 'accepting' states, 'rejecting' states and 'ignoring' | 4630 | There are three sorts of states: 'accepting' states, 'rejecting' states and 'ignoring' |
| 4632 | states. By convention, the lexer returns a result if it cannot read more in an | 4631 | states. By convention, the lexer returns a result if it cannot read more in an |
| 4633 | accepting or rejecting state, and restarts from state 0 (without stopping) if it | 4632 | accepting or rejecting state, and restarts from state 0 (without stopping) if it |
| 4634 | - cannot read more in an ignoring state. It also returns when it reaches the end of | ||
| 4635 | - the input buffer. The automatic reloading of this buffer and restarting of the lexer | ||
| 4636 | - is written in 'library/lexical_analysis/fast_lexer_5.anubis'. | 4633 | + cannot read more in an ignoring state. |
| 4637 | 4634 | ||
| 4638 | public type FastLexerState: // description of states (names of states are generated automatically) | 4635 | public type FastLexerState: // description of states (names of states are generated automatically) |
| 4639 | rejecting (List(FastLexerTransition) transitions), | 4636 | rejecting (List(FastLexerTransition) transitions), |
| @@ -4661,11 +4658,11 @@ public type FastLexerState: // description of states (names of states are gene | @@ -4661,11 +4658,11 @@ public type FastLexerState: // description of states (names of states are gene | ||
| 4661 | +---------+ | 4658 | +---------+ |
| 4662 | 4659 | ||
| 4663 | The automaton starts in state 0 and reads a character. If it is white it goes to state | 4660 | The automaton starts in state 0 and reads a character. If it is white it goes to state |
| 4664 | - 2. In this state (Whixh has no transition) the automaton ignores the result obtained | ||
| 4665 | - so far and restarts from state 0. If it reads a lowercase letter, it goes to state 1, | ||
| 4666 | - otherwise it rejects the input. While in state 1, the automaton reads as many lower case | ||
| 4667 | - letters as possible and accepts the input. This automaton may be represented as the following | ||
| 4668 | - datum of type 'List(FastLexerState)': | 4661 | + 2. In this state the automaton ignores the result obtained so far and restarts from |
| 4662 | + state 0. If it reads a lowercase letter, it goes to state 1, otherwise it rejects the | ||
| 4663 | + input. While in state 1, the automaton reads as many lower case letters as possible | ||
| 4664 | + and accepts the input. This automaton may be represented as the following datum of | ||
| 4665 | + type 'List(FastLexerState)': | ||
| 4669 | 4666 | ||
| 4670 | [ | 4667 | [ |
| 4671 | /* state 0 */ | 4668 | /* state 0 */ |
| @@ -4684,7 +4681,7 @@ public type FastLexerState: // description of states (names of states are gene | @@ -4684,7 +4681,7 @@ public type FastLexerState: // description of states (names of states are gene | ||
| 4684 | 4681 | ||
| 4685 | Notice that a state is identified by its rank in the list. The starting state is always state 0. | 4682 | Notice that a state is identified by its rank in the list. The starting state is always state 0. |
| 4686 | Also notice that ignoring states may have transitions. Indeed, if we want to | 4683 | Also notice that ignoring states may have transitions. Indeed, if we want to |
| 4687 | - accept sequences of at least two 'a' and ignore anything else, we may have an automaton | 4684 | + detect sequences of at least two 'a' and ignore anything else, we may have an automaton |
| 4688 | like this one: | 4685 | like this one: |
| 4689 | 4686 | ||
| 4690 | 'a' 'a' | 4687 | 'a' 'a' |
| @@ -4707,100 +4704,64 @@ public type FastLexerState: // description of states (names of states are gene | @@ -4707,100 +4704,64 @@ public type FastLexerState: // description of states (names of states are gene | ||
| 4707 | The automaton always tries to read the longuest possible sequence. Hence, transitions | 4704 | The automaton always tries to read the longuest possible sequence. Hence, transitions |
| 4708 | always have precedence over the sort of the state (rejecting, accepting, ignoring). | 4705 | always have precedence over the sort of the state (rejecting, accepting, ignoring). |
| 4709 | 4706 | ||
| 4710 | - Of course, it is possible to write down Anubis functions for running this automaton. | 4707 | + Of course, it is possible to write down an Anubis function for running this automaton. |
| 4711 | But this may work quite slowly. This is the reason why we provide a sort of 'compiler' | 4708 | But this may work quite slowly. This is the reason why we provide a sort of 'compiler' |
| 4712 | for this kind of automaton. This 'compiler' produces a 'fast lexer', which is actually | 4709 | for this kind of automaton. This 'compiler' produces a 'fast lexer', which is actually |
| 4713 | made of two byte arrays which are used as decision and transition tables by an automaton | 4710 | made of two byte arrays which are used as decision and transition tables by an automaton |
| 4714 | - written in C (which is a single instruction of the virtual machine). | 4711 | + written in C (this is a primitive of the virtual machine). |
| 4715 | 4712 | ||
| 4716 | Also notice that lexer descriptions as above don't have to be written by hand. They are | 4713 | Also notice that lexer descriptions as above don't have to be written by hand. They are |
| 4717 | generated from sets of regular expressions by Anubis programs that you can find in | 4714 | generated from sets of regular expressions by Anubis programs that you can find in |
| 4718 | - 'library/lexical_analysis/fast_lexer_5.anubis'. | 4715 | + 'library/lexical_analysis'. |
| 4719 | 4716 | ||
| 4720 | 4717 | ||
| 4721 | *** (13.2) Compiling a description. | 4718 | *** (13.2) Compiling a description. |
| 4722 | 4719 | ||
| 4723 | - Each (low level) fast lexer is actually seen as a function taking several arguments | ||
| 4724 | - (see below). | ||
| 4725 | - | ||
| 4726 | - During its execution the fast lexer doesn't return until one of the following conditions is met: | ||
| 4727 | - | ||
| 4728 | - - (1) no transition is possible and the current state is a not an ignoring state, | ||
| 4729 | - - (2) the end of the input is reached (no character to read). | ||
| 4730 | - | ||
| 4731 | - Notice that if no transition is possible (we have read the longest possible lexeme) and if the current | ||
| 4732 | - state is 'ignoring', the lexer doesn't return but instead restarts in state 0. This is the reason | ||
| 4733 | - why no action (in the sens of 'fast_lexer_5.anubis') can be attached to an ignoring state. | ||
| 4734 | - | ||
| 4735 | - Also notice that if in some state 's' a lexeme is accepted, and if there is a possible transition, | ||
| 4736 | - the lexer continues to read. However, it is possible that no longer lexeme can be accepted, and in | ||
| 4737 | - this case, the lexeme accepted in state 's' must be returned. This is why the lexer maintains a | ||
| 4738 | - 'possible last accepted lexeme' of the type below: | ||
| 4739 | - | ||
| 4740 | -public type FastLexerLastAccepted: | ||
| 4741 | - none, // nothing was previously accepted | ||
| 4742 | - last(Word16 state, // something was accepted in this state | ||
| 4743 | - Int ending_position). // position in the input buffer where the last accepted lexeme ends | ||
| 4744 | - | ||
| 4745 | - The starting position of the accepted token is not a component in the alternative 'last' because, | ||
| 4746 | - it can be recovered by other means. Also the role of the component 'state' in the alternative 'last' | ||
| 4747 | - is mainly to allow the recovering of the corresponding action. | ||
| 4748 | - | ||
| 4749 | - The type below describes all possible situations when the lexer returns: | 4720 | + Each (low level) fast lexer is actually a function taking several arguments (see below) |
| 4721 | + and returning a result of the following type: | ||
| 4750 | 4722 | ||
| 4751 | public type FastLexerOutput: | 4723 | public type FastLexerOutput: |
| 4752 | - rejected (Word16 where, Int start, Int end), | ||
| 4753 | - accepted (Word16 where, Int start, Int end, Int current), | 4724 | + rejected(Word16 where, Int start, Int end), |
| 4725 | + accepted(Word16 where, Int start, Int end), | ||
| 4754 | ignored_to_end. | 4726 | ignored_to_end. |
| 4755 | 4727 | ||
| 4756 | - 'start' and 'end' delimit a sequence of characters in the input buffer, precisely the characters whose | ||
| 4757 | - offsets are between 'start' included and 'end' not included. | ||
| 4758 | - | ||
| 4759 | - Notice that when the lexer is called, a current position of reading is given together with a state. | ||
| 4760 | - This is because it can be necessary to resume a reading which was interrupted by the necessity to | ||
| 4761 | - reload the input buffer. | ||
| 4762 | - | ||
| 4763 | - rejected(where,start,end) means: | ||
| 4764 | - - nothing was accepted (in particular, there was no 'last accepted') | ||
| 4765 | - - the current state is 'where', | ||
| 4766 | - - 'start' and 'end' delimit a lexeme which cannot be accepted (to be used in an error message), | ||
| 4767 | - - 'end' is also the current position of reading. | ||
| 4768 | - In this case, we can know if we are at the end of the input buffer by comparing 'end' with | ||
| 4769 | - the length of the buffer. We can also check that 'where' is a rejecting state, which it is necessarily. | ||
| 4770 | - The component 'where' is necessary in order to resume reading if we have to reload the buffer. Indeed, | ||
| 4771 | - despite the fact that the sequence delimited by 'start' and 'end' was rejected, it is still possible | ||
| 4772 | - that it is the beginning of an acceptable token that can be recognized only after the buffer is reloaded. | ||
| 4773 | - | ||
| 4774 | - accepted(where,start,end,current) means: | ||
| 4775 | - - a token is accepted which is delimited by 'start' and 'end', | ||
| 4776 | - - 'current' is the current position of reading (it is always greater then or equal to 'end'), | ||
| 4777 | - - 'where' is the state which was current when the token was accepted. | ||
| 4778 | - In this case, the reason why we need to know the current position of reading is the following. | ||
| 4779 | - Assume that "a" is an acceptable token, that "abc" is another acceptable token, but not "ab", and that the last | ||
| 4780 | - two bytes of the input are "ab". In other words, "abc" could be accepted after the buffer is reloaded. In | ||
| 4781 | - this case, the lexer reads "a" and "b" and is obliged to return because at the end of the input buffer. It | ||
| 4782 | - had first accepted "a" as a token, so that there is a last accepted token, and it returns: | ||
| 4783 | - | ||
| 4784 | - accepted(w,s,e,c) | ||
| 4785 | - | ||
| 4786 | - where 'w' is the state which was current just at the moment the token "a" was accepted, and where | ||
| 4787 | - 's' and 'e' delimit this token "a". In other words, assuming that the length of the buffer is 10, "a" is | ||
| 4788 | - at position 8 and "b" at position 9. We have 's' = 8 and 'e' = 9. But we also have 'current' = 10, because | ||
| 4789 | - the buffer was read to its end. Here, we need to know 'current' because if we knew only 'end', we could not | ||
| 4790 | - know that the buffer must be reloaded. Notice that despite the fact that the lexer returns accepted, the state | ||
| 4791 | - reached after reading "b" is rejecting. However, the state 'w' is an accepting state because it is the state | ||
| 4792 | - which was current just after reading "a". | ||
| 4793 | - | ||
| 4794 | - ignored_to_end means: | ||
| 4795 | - The lexer did not accept not reject anything but saw only tokens to be ignored (maybe many of them, since | ||
| 4796 | - it doesn't return when ignoring tokens), and reached the end of the input buffer. | 4728 | + The lexer tries to accept the longest possible lexeme. Consequently, it remembers the |
| 4729 | + last position (if any) at which a lexeme was accepted (this is actually the end of | ||
| 4730 | + the accepted lexeme not its beginning), and tries to accept a | ||
| 4731 | + longer one. If at some point nothing longer can be accepted, the lexer proceeds as | ||
| 4732 | + follows: | ||
| 4733 | + | ||
| 4734 | + (1) there is a last accepted position: it returns: accepted(w,s,e) where 'w' is | ||
| 4735 | + the state reached when the lexeme was accepted, 's' and 'e' the starting | ||
| 4736 | + and end positions of this last accepted lexeme within the input byte array. | ||
| 4737 | + | ||
| 4738 | + (2) there is no last accepted position: it returns: rejected(w,s,e) where | ||
| 4739 | + 's' and 'e' are the starting and end positions of what has been read, | ||
| 4740 | + and where 'w' is the state currently reached. | ||
| 4741 | + | ||
| 4742 | + If the end of the input is not reached (i.e. if e < length(input_buffer)), the above | ||
| 4743 | + must be interpreted textually, i.e. 'accepted' means accepted, and 'rejected' means | ||
| 4744 | + rejected. However, if e = length(input_buffer), the result must be different if we | ||
| 4745 | + can provide more input. Indeed, a initial segment of an acceptable lexeme can be | ||
| 4746 | + non acceptable. In this case, we want to enlarge the input (adding new bytes to | ||
| 4747 | + the input buffer, from which only an end is kept) and restart the lexer. This is | ||
| 4748 | + done in the high level part ('library/lexical_analysis'). When restarting the lexer, | ||
| 4749 | + we must eventually provide a last accepted position, hence the argument 'last_accepted' | ||
| 4750 | + of type 'FastLexerLastAccepted', containing (maybe) a position in the source byte | ||
| 4751 | + array and a state. | ||
| 4752 | + | ||
| 4753 | + The lexer returns 'ignored_to_end' when it ignores everything until the end of the input. This | ||
| 4754 | + means that it has reached the end of the input, that it has not found any acceptable lexeme | ||
| 4755 | + nor any sequence to be rejected. | ||
| 4756 | + | ||
| 4757 | +public type FastLexerLastAccepted: | ||
| 4758 | + none, | ||
| 4759 | + last(Word16 state, | ||
| 4760 | + Int position). // position in the input where the last accepted lexeme ends | ||
| 4797 | 4761 | ||
| 4798 | - The above informations were of course essential for the writting of 'library/fast_lexer_5.anubis'. | ||
| 4799 | - | ||
| 4800 | Now, here is the tool for making a fast lexer. First, the return type of 'make_fast_lexer': | 4762 | Now, here is the tool for making a fast lexer. First, the return type of 'make_fast_lexer': |
| 4801 | 4763 | ||
| 4802 | public type MakeFastLexerResult: | 4764 | public type MakeFastLexerResult: |
| 4803 | - // error conditions: | ||
| 4804 | unknown_state(Word16), // found a transition to a non existing state | 4765 | unknown_state(Word16), // found a transition to a non existing state |
| 4805 | too_many_states, // maximum is 65530 | 4766 | too_many_states, // maximum is 65530 |
| 4806 | // otherwise, the fast lexer itself (this is a function discussed below): | 4767 | // otherwise, the fast lexer itself (this is a function discussed below): |
| @@ -4826,31 +4787,28 @@ public define MakeFastLexerResult | @@ -4826,31 +4787,28 @@ public define MakeFastLexerResult | ||
| 4826 | -> FastLexerOutput | 4787 | -> FastLexerOutput |
| 4827 | 4788 | ||
| 4828 | The arguments are: - the input buffer | 4789 | The arguments are: - the input buffer |
| 4829 | - - a possible last accepted token position | ||
| 4830 | - - the current position of reading within the buffer (where to resume reading) | ||
| 4831 | - - the position where the currently read token candidate starts within the buffer | ||
| 4832 | - - the state into which to resume reading | ||
| 4833 | - | ||
| 4834 | - 'token_start' is where the currently read token begins in the input buffer. Actually, this will be actual | ||
| 4835 | - beginning of the returned token if a token is recognized and if nothing is ignored before a token is recognized. | ||
| 4836 | - If nothing is ignored, this will be the beginning of either a recognized token or of a rejected lexeme. | 4790 | + - the state into which a token has been previously accepted (if any) together |
| 4791 | + with the position (within the buffer) where this token ends | ||
| 4792 | + - the current position of reading within the buffer (where to start reading) | ||
| 4793 | + - the position where the currently read token starts within the buffer | ||
| 4794 | + (actually, this is always 0 when we call this function in | ||
| 4795 | + 'library/lexical_analysis/fast_lexer_2.anubis', this is due to how the | ||
| 4796 | + buffer is reloaded) | ||
| 4797 | + - the state at which reading must begin | ||
| 4837 | 4798 | ||
| 4838 | - The reason for the above arguments is mainly that when the low level lexer is called again, a token | ||
| 4839 | - was maybe already partially read. For example, we can have this ("abracad" was already read by a previous call): | 4799 | + The reason for this is mainly that when the low level lexer is called again, a token may have been already |
| 4800 | + partially read. For example, we can have this ("abracad" was already read by a previous call): | ||
| 4840 | 4801 | ||
| 4841 | - "abracadabrantesque ..." | ||
| 4842 | - ^ ^ ^ ^ | ||
| 4843 | - | | | | | ||
| 4844 | - | | | c | 4802 | + "abracadabra ..." |
| 4803 | + ^ ^ ^ | ||
| 4804 | + | | | | ||
| 4845 | | | reading position | 4805 | | | reading position |
| 4846 | | last accepted | 4806 | | last accepted |
| 4847 | start of token currently read | 4807 | start of token currently read |
| 4848 | 4808 | ||
| 4849 | which means that we have already read "abracad", that "abra" was accepted (that "abrac", "abraca" and "abracad" | 4809 | which means that we have already read "abracad", that "abra" was accepted (that "abrac", "abraca" and "abracad" |
| 4850 | were not accepted) and that we restart reading after "abracad". If we cannot accept a token longer | 4810 | were not accepted) and that we restart reading after "abracad". If we cannot accept a token longer |
| 4851 | - than "abra", accepted(s,0,4,c) will be returned (where c is the curent position of reading when the call returns) | ||
| 4852 | - and at the next call, we have to read form position 'last_accepted' in the state 's' which was current when this | ||
| 4853 | - token was accepted). | 4811 | + than "abra", accepted(s,0,4) will be returned. |
| 4854 | 4812 | ||
| 4855 | 4813 | ||
| 4856 | *** (13.3) Precompiled fast lexers. | 4814 | *** (13.3) Precompiled fast lexers. |
| @@ -4882,7 +4840,7 @@ public define PrecompiledFastLexerResult | @@ -4882,7 +4840,7 @@ public define PrecompiledFastLexerResult | ||
| 4882 | stored into a file for example, or send accross the network. It is also possible to | 4840 | stored into a file for example, or send accross the network. It is also possible to |
| 4883 | transform a precomplied fast lexer into an Anubis source text, since there is the | 4841 | transform a precomplied fast lexer into an Anubis source text, since there is the |
| 4884 | { ... } notation for 'lexical' byte arrays. This possibility is used | 4842 | { ... } notation for 'lexical' byte arrays. This possibility is used |
| 4885 | - in 'library/lexical_analysis/fast_lexer_5.anubis'. | 4843 | + in 'library/lexical_analysis/fast_lexer_2.anubis'. |
| 4886 | 4844 | ||
| 4887 | For retrieving a fast lexer from a precompiled fast lexer, use the following: | 4845 | For retrieving a fast lexer from a precompiled fast lexer, use the following: |
| 4888 | 4846 |
anubis_dev/library/syntactic_analysis/anubis_output.anubis
| @@ -27,7 +27,7 @@ | @@ -27,7 +27,7 @@ | ||
| 27 | *Public* | 27 | *Public* |
| 28 | 28 | ||
| 29 | read common.anubis | 29 | read common.anubis |
| 30 | -read tools/streams.anubis | 30 | +read tools/streams.anubis |
| 31 | 31 | ||
| 32 | 32 | ||
| 33 | 33 | ||
| @@ -1013,17 +1013,6 @@ define One | @@ -1013,17 +1013,6 @@ define One | ||
| 1013 | 1013 | ||
| 1014 | 1014 | ||
| 1015 | *** [3.1.5] Outputing the parser function. | 1015 | *** [3.1.5] Outputing the parser function. |
| 1016 | - | ||
| 1017 | -define String | ||
| 1018 | - comma_extra | ||
| 1019 | - ( | ||
| 1020 | - Maybe(Extra) mb_extra | ||
| 1021 | - ) = | ||
| 1022 | - if mb_extra is | ||
| 1023 | - { | ||
| 1024 | - failure then "", | ||
| 1025 | - success(e) then ","+name(e) | ||
| 1026 | - }. | ||
| 1027 | 1016 | ||
| 1028 | define One | 1017 | define One |
| 1029 | print_parser_function | 1018 | print_parser_function |
| @@ -1065,8 +1054,8 @@ define One | @@ -1065,8 +1054,8 @@ define One | ||
| 1065 | print(s," error(e) then error(e),\n"); | 1054 | print(s," error(e) then error(e),\n"); |
| 1066 | print(s," end_ret(r) then if r is start(value)\n"); | 1055 | print(s," end_ret(r) then if r is start(value)\n"); |
| 1067 | print(s," then ok(value)\n"); | 1056 | print(s," then ok(value)\n"); |
| 1068 | - print(s," else should_not_happen(error(syntactic(end_of_input(unique),[]"+comma_extra(mb_extra)+"))),\n"); | ||
| 1069 | - print(s," do_ret(_) then should_not_happen(error(syntactic(end_of_input(unique),[]"+comma_extra(mb_extra)+")))\n"); | 1057 | + print(s," else should_not_happen(error(syntactic(eof(unique),[]))),\n"); |
| 1058 | + print(s," do_ret(_) then should_not_happen(error(syntactic(eof(unique),[])))\n"); | ||
| 1070 | print(s," }."). | 1059 | print(s," }."). |
| 1071 | 1060 | ||
| 1072 | 1061 | ||
| @@ -1095,48 +1084,19 @@ define One | @@ -1095,48 +1084,19 @@ define One | ||
| 1095 | 1084 | ||
| 1096 | *** [3.2] Outputing the declaration of the function 'vmsg'. | 1085 | *** [3.2] Outputing the declaration of the function 'vmsg'. |
| 1097 | 1086 | ||
| 1098 | - When the 'trace' option is used, APG outputs terms of the form 'vmsg("...")' or 'vmsg(extra,"...")'. These | 1087 | + When the 'trace' option is used, APG outputs terms of the form 'vmsg("..."). These |
| 1099 | terms send messages which allow to follow the behavior of the parser. This is used only | 1088 | terms send messages which allow to follow the behavior of the parser. This is used only |
| 1100 | for debugging purpose. The function 'vmsg' must be provided by the user. The next | 1089 | for debugging purpose. The function 'vmsg' must be provided by the user. The next |
| 1101 | function outputs the declaration of 'vmsg'. | 1090 | function outputs the declaration of 'vmsg'. |
| 1102 | 1091 | ||
| 1103 | -define String | ||
| 1104 | - vmsgea // vmsg extra argument declaration | ||
| 1105 | - ( | ||
| 1106 | - Maybe(Extra) mb_e | ||
| 1107 | - ) = | ||
| 1108 | - if mb_e is | ||
| 1109 | - { | ||
| 1110 | - failure then "", | ||
| 1111 | - success(e) then if e is extra(type,name) then type+" "+name+", " | ||
| 1112 | - }. | ||
| 1113 | - | ||
| 1114 | -define String | ||
| 1115 | - vmsgen // vmsg extra name | ||
| 1116 | - ( | ||
| 1117 | - Maybe(Extra) mb_e | ||
| 1118 | - ) = | ||
| 1119 | - if mb_e is | ||
| 1120 | - { | ||
| 1121 | - failure then "", | ||
| 1122 | - success(e) then if e is extra(type,name) then name+", " | ||
| 1123 | - }. | ||
| 1124 | - | ||
| 1125 | - | ||
| 1126 | - | ||
| 1127 | define One | 1092 | define One |
| 1128 | print_vmsg_declaration | 1093 | print_vmsg_declaration |
| 1129 | ( | 1094 | ( |
| 1130 | - Stream s, | ||
| 1131 | - Maybe(Extra) mb_extra | 1095 | + Stream s |
| 1132 | ) = | 1096 | ) = |
| 1133 | print(s, | 1097 | print(s, |
| 1134 | "\n\n Declaration of 'vmsg'. This function must be provided by the user of APG. "); | 1098 | "\n\n Declaration of 'vmsg'. This function must be provided by the user of APG. "); |
| 1135 | - print(s,if mb_extra is | ||
| 1136 | - { | ||
| 1137 | - failure then "\n\ndefine One vmsg(String text).", | ||
| 1138 | - success(e) then "\n\ndefine One vmsg("+vmsgea(mb_extra)+"String text)." | ||
| 1139 | - }). | 1099 | + print(s,"\n\ndefine One vmsg(String text)."). |
| 1140 | 1100 | ||
| 1141 | 1101 | ||
| 1142 | 1102 | ||
| @@ -1207,7 +1167,7 @@ define One | @@ -1207,7 +1167,7 @@ define One | ||
| 1207 | [ ] then | 1167 | [ ] then |
| 1208 | print(s," ) =\n"); | 1168 | print(s," ) =\n"); |
| 1209 | (if trace:options | 1169 | (if trace:options |
| 1210 | - then print(s," vmsg("+vmsgen(mb_extra)+"\"Reducing using rule "+to_decimal(id)+"\");\n") | 1170 | + then print(s," vmsg(\"Reducing using rule "+to_decimal(id)+"\");\n") |
| 1211 | else unique); | 1171 | else unique); |
| 1212 | print(s," end_ret("+name+"("+val+")).\n"), | 1172 | print(s," end_ret("+name+"("+val+")).\n"), |
| 1213 | 1173 | ||
| @@ -1215,7 +1175,7 @@ define One | @@ -1215,7 +1175,7 @@ define One | ||
| 1215 | print_reduce_function_args(s,reverse(body),type_table); | 1175 | print_reduce_function_args(s,reverse(body),type_table); |
| 1216 | print(s," ) =\n"); | 1176 | print(s," ) =\n"); |
| 1217 | (if trace:options | 1177 | (if trace:options |
| 1218 | - then print(s," vmsg("+vmsgen(mb_extra)+"\"Reducing using rule "+to_decimal(id)+"\");\n") | 1178 | + then print(s," vmsg(\"Reducing using rule "+to_decimal(id)+"\");\n") |
| 1219 | else unique); | 1179 | else unique); |
| 1220 | print(s," "+put_do_ret(name+"("+val+")", | 1180 | print(s," "+put_do_ret(name+"("+val+")", |
| 1221 | length(symbols_only(body)))+".\n") | 1181 | length(symbols_only(body)))+".\n") |
| @@ -1463,13 +1423,13 @@ define One | @@ -1463,13 +1423,13 @@ define One | ||
| 1463 | [h . t] then | 1423 | [h . t] then |
| 1464 | print(s,"\n "+right_pad(h+"(value)",30)+" then"); | 1424 | print(s,"\n "+right_pad(h+"(value)",30)+" then"); |
| 1465 | (if trace:options | 1425 | (if trace:options |
| 1466 | - then print(s,"\n vmsg("+vmsgen(mb_extra)+"\"Got a '"+h+"'\");") | 1426 | + then print(s,"\n vmsg(\"Got a '"+h+"'\");") |
| 1467 | else unique); | 1427 | else unique); |
| 1468 | if find_transition(h,transitions) is | 1428 | if find_transition(h,transitions) is |
| 1469 | { | 1429 | { |
| 1470 | failure then if (state_id = 0 & h = "start") | 1430 | failure then if (state_id = 0 & h = "start") |
| 1471 | then print(s," end_ret(start(value))") | 1431 | then print(s," end_ret(start(value))") |
| 1472 | - else print(s," should_not_happen(error(syntactic(end_of_input(unique),[]"+comma_extra(mb_extra)+")))"), | 1432 | + else print(s," should_not_happen(error(syntactic(eof(unique),[])))"), |
| 1473 | 1433 | ||
| 1474 | success(target_id) then | 1434 | success(target_id) then |
| 1475 | with n = length(get_longuest_stack_for(h,scs)), | 1435 | with n = length(get_longuest_stack_for(h,scs)), |
| @@ -1528,7 +1488,7 @@ define One | @@ -1528,7 +1488,7 @@ define One | ||
| 1528 | print_restart_args(s,stack,type_table,0); | 1488 | print_restart_args(s,stack,type_table,0); |
| 1529 | print(s,"\n ) ="); | 1489 | print(s,"\n ) ="); |
| 1530 | (if trace:options | 1490 | (if trace:options |
| 1531 | - then unique // print(s,"\n vmsg("+vmsgen(mb_extra)+"\"Restarting\");") | 1491 | + then unique // print(s,"\n vmsg(\"Restarting\");") |
| 1532 | else unique); | 1492 | else unique); |
| 1533 | print(s,"\n if result is"); | 1493 | print(s,"\n if result is"); |
| 1534 | print(s,"\n {"); | 1494 | print(s,"\n {"); |
| @@ -1667,9 +1627,9 @@ define One | @@ -1667,9 +1627,9 @@ define One | ||
| 1667 | if find_reduction(token,scs) is | 1627 | if find_reduction(token,scs) is |
| 1668 | { | 1628 | { |
| 1669 | failure then (if trace:options | 1629 | failure then (if trace:options |
| 1670 | - then print(s," vmsg("+vmsgen(mb_extra)+"\"Unexpected token '"+token+"'\");\n") | 1630 | + then print(s," vmsg(\"Unexpected token '"+token+"'\");\n") |
| 1671 | else unique); | 1631 | else unique); |
| 1672 | - print(s," error(syntactic(next,token_list_"+state_id+comma_extra(mb_extra)+"))"), | 1632 | + print(s," error(syntactic(next,token_list_"+state_id+"))"), |
| 1673 | 1633 | ||
| 1674 | success(sc) then if sc is scenario(rid,_,bd,_,_,_,_) then | 1634 | success(sc) then if sc is scenario(rid,_,bd,_,_,_,_) then |
| 1675 | print(s,"\n unput_token(input)(next);\n"); | 1635 | print(s,"\n unput_token(input)(next);\n"); |
| @@ -1747,7 +1707,7 @@ define One | @@ -1747,7 +1707,7 @@ define One | ||
| 1747 | failure then print_reduce_body(s,tok1,scs,state_id,options,mb_extra), | 1707 | failure then print_reduce_body(s,tok1,scs,state_id,options,mb_extra), |
| 1748 | success(target_state_id) then | 1708 | success(target_state_id) then |
| 1749 | (if trace:options | 1709 | (if trace:options |
| 1750 | - then print(s," vmsg("+vmsgen(mb_extra)+"\"Shifting token '"+tok1+"'\");\n") | 1710 | + then print(s," vmsg(\"Shifting token '"+tok1+"'\");\n") |
| 1751 | else unique); | 1711 | else unique); |
| 1752 | with n = length(get_longuest_stack_for(tok1,scs)), | 1712 | with n = length(get_longuest_stack_for(tok1,scs)), |
| 1753 | print(s,"\n if state_"+target_state_id+"("+ | 1713 | print(s,"\n if state_"+target_state_id+"("+ |
| @@ -1770,10 +1730,10 @@ define One | @@ -1770,10 +1730,10 @@ define One | ||
| 1770 | }+"input,value1"+ | 1730 | }+"input,value1"+ |
| 1771 | (if m = 0 then "" else ",")+ | 1731 | (if m = 0 then "" else ",")+ |
| 1772 | format_restart_case_args(m-1)+"),\n") | 1732 | format_restart_case_args(m-1)+"),\n") |
| 1773 | - else print(s," end_ret(value1) then should_not_happen(error(syntactic(end_of_input(unique),[]"+comma_extra(mb_extra)+"))),\n")); | 1733 | + else print(s," end_ret(value1) then should_not_happen(error(syntactic(eof(unique),[]))),\n")); |
| 1774 | print(s," do_ret(value1) then "); | 1734 | print(s," do_ret(value1) then "); |
| 1775 | (if trace:options | 1735 | (if trace:options |
| 1776 | - then unique //print(s,"vmsg("+vmsgen(mb_extra)+"\"Ignoring state "+state_id+ | 1736 | + then unique //print(s,"vmsg(\"Ignoring state "+state_id+ |
| 1777 | // "\");\n ") | 1737 | // "\");\n ") |
| 1778 | else unique); | 1738 | else unique); |
| 1779 | print(s,"value1\n"); | 1739 | print(s,"value1\n"); |
| @@ -1828,14 +1788,14 @@ define One | @@ -1828,14 +1788,14 @@ define One | ||
| 1828 | print_state_function_beginning(s,state_id,parser_name,symbols_only(stack),type_table,mb_extra); | 1788 | print_state_function_beginning(s,state_id,parser_name,symbols_only(stack),type_table,mb_extra); |
| 1829 | print(s," =\n"); | 1789 | print(s," =\n"); |
| 1830 | (if trace:options | 1790 | (if trace:options |
| 1831 | - then print(s," vmsg("+vmsgen(mb_extra)+"\"Entering state "+state_id+"\");\n") | 1791 | + then print(s," vmsg(\"Entering state "+state_id+"\");\n") |
| 1832 | else unique); | 1792 | else unique); |
| 1833 | if has_immediate_action(scs) is | 1793 | if has_immediate_action(scs) is |
| 1834 | { | 1794 | { |
| 1835 | failure then unique, | 1795 | failure then unique, |
| 1836 | success(text) then print(s," // immediate action\n"); | 1796 | success(text) then print(s," // immediate action\n"); |
| 1837 | (if trace:options | 1797 | (if trace:options |
| 1838 | - then print(s," vmsg("+vmsgen(mb_extra)+"\"Executing immediate command: "+ | 1798 | + then print(s," vmsg(\"Executing immediate command: "+ |
| 1839 | inhibit_double_quotes(text)+"\");\n") | 1799 | inhibit_double_quotes(text)+"\");\n") |
| 1840 | else unique); | 1800 | else unique); |
| 1841 | print(s," ("+text+");\n") | 1801 | print(s," ("+text+");\n") |
| @@ -1846,7 +1806,7 @@ define One | @@ -1846,7 +1806,7 @@ define One | ||
| 1846 | print(s," ok(next) then "); | 1806 | print(s," ok(next) then "); |
| 1847 | ( | 1807 | ( |
| 1848 | if trace:options | 1808 | if trace:options |
| 1849 | - then unique // print(s,"vmsg("+vmsgen(mb_extra)+"\"Reading token: '\"+token_name_"+parser_name+"(next)+\"'\");\n ") | 1809 | + then unique // print(s,"vmsg(\"Reading token: '\"+token_name_"+parser_name+"(next)+\"'\");\n ") |
| 1850 | else unique | 1810 | else unique |
| 1851 | ); | 1811 | ); |
| 1852 | print(s,"if next is\n"); | 1812 | print(s,"if next is\n"); |
| @@ -1912,21 +1872,13 @@ define One | @@ -1912,21 +1872,13 @@ define One | ||
| 1912 | define One | 1872 | define One |
| 1913 | print_apg_error_type | 1873 | print_apg_error_type |
| 1914 | ( | 1874 | ( |
| 1915 | - Stream s, | ||
| 1916 | - String parser_name, | ||
| 1917 | - Maybe(Extra) mb_extra | 1875 | + Stream s, |
| 1876 | + String parser_name | ||
| 1918 | ) = | 1877 | ) = |
| 1919 | print(s,"\n\npublic type APG_Error_"+parser_name+"($LE):\n"); | 1878 | print(s,"\n\npublic type APG_Error_"+parser_name+"($LE):\n"); |
| 1920 | print(s," lexical ($LE lexical_error),\n"); | 1879 | print(s," lexical ($LE lexical_error),\n"); |
| 1921 | print(s," syntactic (Token_Value_"+parser_name+" token_read,\n"); | 1880 | print(s," syntactic (Token_Value_"+parser_name+" token_read,\n"); |
| 1922 | - if mb_extra is | ||
| 1923 | - { | ||
| 1924 | - failure then | ||
| 1925 | - print(s," List(Token_"+parser_name+") expected).\n") | ||
| 1926 | - success(e) then | ||
| 1927 | - print(s," List(Token_"+parser_name+") expected,\n"); | ||
| 1928 | - print(s," "+type(e)+" "+name(e)+").\n") | ||
| 1929 | - }. | 1881 | + print(s," List(Token_"+parser_name+") expected).\n"). |
| 1930 | 1882 | ||
| 1931 | 1883 | ||
| 1932 | 1884 | ||
| @@ -2045,7 +1997,7 @@ define One | @@ -2045,7 +1997,7 @@ define One | ||
| 2045 | mb_extra, | 1997 | mb_extra, |
| 2046 | postambule) then | 1998 | postambule) then |
| 2047 | with non_terminals = (List(String))["start" . all_non_terminals(rules)], | 1999 | with non_terminals = (List(String))["start" . all_non_terminals(rules)], |
| 2048 | - all_tokens = (List(String))["end_of_input" . all_symbols(rules) - non_terminals], | 2000 | + all_tokens = (List(String))["eof" . all_symbols(rules) - non_terminals], |
| 2049 | prec_table = make_precedence_table(prec_decs), | 2001 | prec_table = make_precedence_table(prec_decs), |
| 2050 | assoc_table = make_association_table(prec_decs), | 2002 | assoc_table = make_association_table(prec_decs), |
| 2051 | _A = if get_rule(1,rules) is grammar_rule(_,_A,_,_) then _A, | 2003 | _A = if get_rule(1,rules) is grammar_rule(_,_A,_,_) then _A, |
| @@ -2071,17 +2023,9 @@ define One | @@ -2071,17 +2023,9 @@ define One | ||
| 2071 | print(s,private_preambule); | 2023 | print(s,private_preambule); |
| 2072 | print(s,"\n --- End of private preambule ---\n"); | 2024 | print(s,"\n --- End of private preambule ---\n"); |
| 2073 | 2025 | ||
| 2074 | - //print(ds,"\n\npublic type Token_"+parser_name+":..."); | ||
| 2075 | - //print(ds,"\npublic type Token_Value_"+parser_name+":...\n"); | ||
| 2076 | - //print(ds,"\npublic type APG_Error_"+parser_name+"($LE):...\n"); | ||
| 2077 | - print(ds,"\n\n The type of tokens without the values:"); | ||
| 2078 | - print_token_type(ds,parser_name,all_tokens); | ||
| 2079 | - | ||
| 2080 | - print(ds,"\n\n The same one with the values:"); | ||
| 2081 | - print_token_value_type(ds,parser_name,all_tokens,type_table); | ||
| 2082 | - | ||
| 2083 | - print(ds,"\n\n A type for lexical and syntactic errors:"); | ||
| 2084 | - print_apg_error_type(ds,parser_name,mb_extra); | 2026 | + print(ds,"\n\npublic type Token_"+parser_name+":..."); |
| 2027 | + print(ds,"\npublic type Token_Value_"+parser_name+":...\n"); | ||
| 2028 | + print(ds,"\npublic type APG_Error_"+parser_name+"($LE):...\n"); | ||
| 2085 | 2029 | ||
| 2086 | if mb_properties is | 2030 | if mb_properties is |
| 2087 | { | 2031 | { |
| @@ -2115,7 +2059,7 @@ define One | @@ -2115,7 +2059,7 @@ define One | ||
| 2115 | print_type_Ret(s,parser_name); | 2059 | print_type_Ret(s,parser_name); |
| 2116 | print_Lexer_type(s,parser_name); | 2060 | print_Lexer_type(s,parser_name); |
| 2117 | 2061 | ||
| 2118 | - (if trace:options then print_vmsg_declaration(s,mb_extra) else unique); | 2062 | + (if trace:options then print_vmsg_declaration(s) else unique); |
| 2119 | 2063 | ||
| 2120 | print_reduce_functions(s, | 2064 | print_reduce_functions(s, |
| 2121 | [grammar_rule(0,symbol_value("start","_0"), | 2065 | [grammar_rule(0,symbol_value("start","_0"), |
| @@ -2154,6 +2098,15 @@ define One | @@ -2154,6 +2098,15 @@ define One | ||
| 2154 | 2098 | ||
| 2155 | print(s,postambule); | 2099 | print(s,postambule); |
| 2156 | 2100 | ||
| 2101 | + print(ds,"\n\n The type of tokens without the values:"); | ||
| 2102 | + print_token_type(ds,parser_name,all_tokens); | ||
| 2103 | + | ||
| 2104 | + print(ds,"\n\n The same one with the values:"); | ||
| 2105 | + print_token_value_type(ds,parser_name,all_tokens,type_table); | ||
| 2106 | + | ||
| 2107 | + print(ds,"\n\n A type for lexical and syntactic errors:"); | ||
| 2108 | + print_apg_error_type(ds,parser_name); | ||
| 2109 | + | ||
| 2157 | (if verbose:options | 2110 | (if verbose:options |
| 2158 | then print("Done. \n") | 2111 | then print("Done. \n") |
| 2159 | else unique); | 2112 | else unique); |
anubis_dev/library/syntactic_analysis/make_automaton.anubis
| @@ -151,7 +151,7 @@ define List(FirstEntry) | @@ -151,7 +151,7 @@ define List(FirstEntry) | ||
| 151 | List(String) tokens, // list of all tokens | 151 | List(String) tokens, // list of all tokens |
| 152 | List(String) non_terminals // list of all non terminals | 152 | List(String) non_terminals // list of all non terminals |
| 153 | ) = | 153 | ) = |
| 154 | - [first_entry("end_of_input",["end_of_input"])] + | 154 | + [first_entry("eof",["eof"])] + |
| 155 | map((String s) |-> first_entry(s,[s]),tokens) + | 155 | map((String s) |-> first_entry(s,[s]),tokens) + |
| 156 | map((String s) |-> first_entry(s,[ ]),non_terminals). | 156 | map((String s) |-> first_entry(s,[ ]),non_terminals). |
| 157 | 157 | ||
| @@ -1119,7 +1119,7 @@ define One | @@ -1119,7 +1119,7 @@ define One | ||
| 1119 | 1119 | ||
| 1120 | start -> .A | 1120 | start -> .A |
| 1121 | 1121 | ||
| 1122 | - for which the set of lookaheads is ["end_of_input"]. | 1122 | + for which the set of lookaheads is ["eof"]. |
| 1123 | 1123 | ||
| 1124 | We must also consider immediate actions (written $(<action>) in a grammar rule) as | 1124 | We must also consider immediate actions (written $(<action>) in a grammar rule) as |
| 1125 | transparent. | 1125 | transparent. |
| @@ -1160,7 +1160,7 @@ define One | @@ -1160,7 +1160,7 @@ define One | ||
| 1160 | [sc1 . others] then | 1160 | [sc1 . others] then |
| 1161 | if sc1 is scenario(_,head,bd,ad,prop,hg,lh_v) then | 1161 | if sc1 is scenario(_,head,bd,ad,prop,hg,lh_v) then |
| 1162 | if (head = "start" & bd = []) | 1162 | if (head = "start" & bd = []) |
| 1163 | - then lh_v <- ["end_of_input"] | 1163 | + then lh_v <- ["eof"] |
| 1164 | else add_initial_lookahead(others) | 1164 | else add_initial_lookahead(others) |
| 1165 | }. | 1165 | }. |
| 1166 | 1166 |
anubis_dev/library/syntactic_analysis/parser_generator.anubis
| @@ -32,7 +32,7 @@ | @@ -32,7 +32,7 @@ | ||
| 32 | *Description* This is the parser generator itself as a command line tool. It is | 32 | *Description* This is the parser generator itself as a command line tool. It is |
| 33 | invoked by the following command line: | 33 | invoked by the following command line: |
| 34 | 34 | ||
| 35 | - `anbexec apg [options] <filename>` | 35 | + `apg [options] <filename>` |
| 36 | 36 | ||
| 37 | The argument `<filename>` is the name of the file containing the grammar. This file | 37 | The argument `<filename>` is the name of the file containing the grammar. This file |
| 38 | name normally has the extension `.apg` (for Anubis Parser Generator). The precise | 38 | name normally has the extension `.apg` (for Anubis Parser Generator). The precise |
anubis_dev/library/syntactic_analysis/read_grammar.anubis
| @@ -168,7 +168,7 @@ | @@ -168,7 +168,7 @@ | ||
| 168 | ) = | 168 | ) = |
| 169 | if tok is | 169 | if tok is |
| 170 | { | 170 | { |
| 171 | - end_of_input(_0) then false, | 171 | + eof(_0) then false, |
| 172 | ... | 172 | ... |
| 173 | _gaga(_0) then true, | 173 | _gaga(_0) then true, |
| 174 | ... | 174 | ... |
| @@ -181,7 +181,7 @@ | @@ -181,7 +181,7 @@ | ||
| 181 | ) = | 181 | ) = |
| 182 | if tok is | 182 | if tok is |
| 183 | { | 183 | { |
| 184 | - end_of_input(_0) then "none", | 184 | + eof(_0) then "none", |
| 185 | ... | 185 | ... |
| 186 | _gaga(_0) then "none", | 186 | _gaga(_0) then "none", |
| 187 | ... | 187 | ... |
anubis_dev/library/tools/ANSI-colors.anubis
| @@ -22,9 +22,7 @@ | @@ -22,9 +22,7 @@ | ||
| 22 | Not all ANSI sequences are supported by all terminals. We made a selection of most common | 22 | Not all ANSI sequences are supported by all terminals. We made a selection of most common |
| 23 | and useful things. | 23 | and useful things. |
| 24 | 24 | ||
| 25 | -read tools/basis.anubis | ||
| 26 | -read tools/printable_tree.anubis | ||
| 27 | - | 25 | + |
| 28 | The following functions can be nested: | 26 | The following functions can be nested: |
| 29 | 27 | ||
| 30 | Foreground color: | 28 | Foreground color: |
| @@ -56,7 +54,7 @@ public define String blink (String s). | @@ -56,7 +54,7 @@ public define String blink (String s). | ||
| 56 | public define Printable_tree green (String s). | 54 | public define Printable_tree green (String s). |
| 57 | public define Printable_tree yellow (String s). | 55 | public define Printable_tree yellow (String s). |
| 58 | public define Printable_tree blue (String s). | 56 | public define Printable_tree blue (String s). |
| 59 | -public define Printable_tree magenta (Printable_tree t). | 57 | + public define Printable_tree magenta (String s). |
| 60 | public define Printable_tree cyan (String s). | 58 | public define Printable_tree cyan (String s). |
| 61 | public define Printable_tree white (String s). | 59 | public define Printable_tree white (String s). |
| 62 | 60 | ||
| @@ -103,21 +101,4 @@ public define String bold (String s) = "[1m"+s+"[0m". | @@ -103,21 +101,4 @@ public define String bold (String s) = "[1m"+s+"[0m". | ||
| 103 | public define String blink (String s) = "[5m"+s+"[25m". | 101 | public define String blink (String s) = "[5m"+s+"[25m". |
| 104 | 102 | ||
| 105 | 103 | ||
| 106 | -define Printable_tree | ||
| 107 | - map_color | ||
| 108 | - ( | ||
| 109 | - String -> String color, | ||
| 110 | - Printable_tree t | ||
| 111 | - ) = | ||
| 112 | - if t is | ||
| 113 | - { | ||
| 114 | - [] then [], | ||
| 115 | - str_pt(_0,_1) then [color(_0),map_color(color,_1)], | ||
| 116 | - ba_pt(_0,_1) then [color(to_string(_0)),map_color(color,_1)], | ||
| 117 | - int_pt(_0,_1) then [color(to_decimal(_0)),map_color(color,_1)], | ||
| 118 | - pt_pt(_0,_1) then [map_color(color,_0),map_color(color,_1)] | ||
| 119 | - }. | ||
| 120 | - | ||
| 121 | -public define Printable_tree | ||
| 122 | - magenta (Printable_tree t) = map_color(magenta,t). | ||
| 123 | 104 |
anubis_dev/library/widgets4/desktop_example.anubis
| @@ -169,8 +169,7 @@ global define One | @@ -169,8 +169,7 @@ global define One | ||
| 169 | with support4 = support(200, 200, my_support("flowers.jpg"), var(show)), | 169 | with support4 = support(200, 200, my_support("flowers.jpg"), var(show)), |
| 170 | forget( | 170 | forget( |
| 171 | open_host_window( | 171 | open_host_window( |
| 172 | - //transient, | ||
| 173 | - managed(resizable), | 172 | + transient, |
| 174 | create_desktop(var(sw),var(sh), | 173 | create_desktop(var(sw),var(sh), |
| 175 | color(rgb(100,200,0)), | 174 | color(rgb(100,200,0)), |
| 176 | (One u) |-> u, | 175 | (One u) |-> u, |
anubis_dev/manuals/en/Anubis-doc-1-14.pdf
No preview for this file type
anubis_dev/manuals/en/Anubis-doc-1-14.tex
| @@ -637,7 +637,7 @@ in the same program written in another language. | @@ -637,7 +637,7 @@ in the same program written in another language. | ||
| 637 | 637 | ||
| 638 | How such a safety is achieved is explained in this manual, but the best way to understand | 638 | How such a safety is achieved is explained in this manual, but the best way to understand |
| 639 | the reasons why it works is to practice Anubis programming. The safety has several interesting | 639 | the reasons why it works is to practice Anubis programming. The safety has several interesting |
| 640 | -consequences. First of all, it is agreable for the programmer because in general the programmer doesn't like | 640 | +consequences. First of all, it is agreable for the programmer because in general he doesn't like |
| 641 | to debug. Of course, writting Anubis programs may require some efforts, or at least some forbearance, | 641 | to debug. Of course, writting Anubis programs may require some efforts, or at least some forbearance, |
| 642 | just because the language paradigm of Anubis is more demanding than most other paradigms, but the counterpart is that in most | 642 | just because the language paradigm of Anubis is more demanding than most other paradigms, but the counterpart is that in most |
| 643 | cases your program works well after the first successful compilation. So, programming with Anubis is cool. Another | 643 | cases your program works well after the first successful compilation. So, programming with Anubis is cool. Another |
| @@ -673,97 +673,6 @@ the safety of the Anubis programming paradigm. Hence, it is just forbidden. | @@ -673,97 +673,6 @@ the safety of the Anubis programming paradigm. Hence, it is just forbidden. | ||
| 673 | 673 | ||
| 674 | 674 | ||
| 675 | 675 | ||
| 676 | -\chapter{Main features of the Anubis programming language} | ||
| 677 | -The main objective which led to the creation of the Anubis language is \emph{safety}, in other words a design which | ||
| 678 | -forbids programming errors (bugs) as much as possible. This is acheived through several principles. | ||
| 679 | - | ||
| 680 | - | ||
| 681 | -\section{The type system} | ||
| 682 | -The most important one is to have a well behaved type system. It is well known that the simple fact of introducing types | ||
| 683 | -in a programming language leads to the automatic elimination of many possible errors, typically half of them. It's not | ||
| 684 | -difficult to understand why. For example, typing forbids the application of a function to a datum which is meaningless | ||
| 685 | -for this function. In general, if you use a non typed language, such an error is detected only during the execution of | ||
| 686 | -the program, that is to say at a moment where it's actually \emph{too late}. Detecting such an error at compile time is | ||
| 687 | -of course much better. | ||
| 688 | - | ||
| 689 | -The type system of Anubis is directly comming from the theory of \emph{bicartesian closed categories}. This | ||
| 690 | -documentation is not the place for explaining this theory,(\footnote{This theory is explained in full details (but in | ||
| 691 | - French) in my Master 2 course in categorical logic ({\tt http://www.logique.jussieu.fr/$\sim$alp/cours\_2010.pdf}), | ||
| 692 | - where the link with functional programming languages is explained in section 2.2.6.}) | ||
| 693 | -but I'm going to give an idea of it using words which are commonly | ||
| 694 | -used by programmers. | ||
| 695 | - | ||
| 696 | -From a theoretical point of view, there are in Anubis essentially three ways of constructing new types, which are | ||
| 697 | -the possibility to define types with \emph{alternatives}, i.e. types containing data of several different types, the | ||
| 698 | -possibility of aggregating data of different types (this is similar to the notion of \emph{structure} in the language C), | ||
| 699 | - and the possibility to define functional types (types whose data are functions). | ||
| 700 | -They correspond | ||
| 701 | -to the categorical notions of \emph{sum}, \emph{product} and \emph{exponentials}. A category with products is called | ||
| 702 | -\emph{cartesian}, a category with sums is called \emph{cocartesian}, a category with both sums and products is called | ||
| 703 | -\emph{bicartesian}, and if furthermore it has exponentials, it is called \emph{bicartesian closed}. | ||
| 704 | - | ||
| 705 | -The reason why | ||
| 706 | -category theory is pertinent as far as programming languages are concerned is that category theory defines concepts | ||
| 707 | -by uniquely characterizing their \emph{behavior} instead of explicitely constructing them. This approach implies that the | ||
| 708 | -concepts are defined abstractly regardeless of any manner of implementing them, and this ensures that no tool can be | ||
| 709 | -forgotten concerning their use, because of this \emph{unique} characterization. Here, by \emph{unique characterization} | ||
| 710 | -we mean that that any two realizations of the concept are behavioristically equivalent.(\footnote{The situation is even | ||
| 711 | - better than this because category theory shows that this equivalence is \emph{canonical}. Such a characterization | ||
| 712 | - is called a \emph{universal problem}.}) | ||
| 713 | - | ||
| 714 | -It appears that the categorical notion of sum is \emph{dual} to the categorical notion of product. Without entering too | ||
| 715 | -many details, it roughly means that a sum is something like \emph{a product seen trough a mirror}. In other words, a sum | ||
| 716 | -cannot be more complicated than a product, but because it is seen topsy-turvy, it looks quite strange and more difficult to | ||
| 717 | -understand intuitively. Actually, I really think that category theory, because of its natural notion of \emph{duality}, is the only | ||
| 718 | -way for really understanding sums, and it is a fact that most programmers, and even most programming language designers, don't | ||
| 719 | -actually understand sums. It must be noted that there are sum types in most functionnal programming languages, but that | ||
| 720 | -the compilers of these languages don't treat them as categorical sums. | ||
| 721 | - | ||
| 722 | - | ||
| 723 | -\suc | ||
| 724 | - | ||
| 725 | - | ||
| 726 | -\section{Anubis abhors a vacuum} | ||
| 727 | -Just like mother nature, Anubis abhors a vacuum. This means that Anubis will never let you create a datum which is only | ||
| 728 | -\emph{partly constructed}. The reason is that a partly constructed datum (a datum with missing parts) must be | ||
| 729 | -considered as \emph{meaningless}. How Anubis acheives the obligation to construct only \emph{complete} data is simple. | ||
| 730 | -The various \emph{parts} needed for constructing the datum must be constructed \emph{before} the datum itself is | ||
| 731 | -constructed, and the datum itself is then constructed by a single (atomic) operation. | ||
| 732 | - | ||
| 733 | -So, in Anubis, you can never have something like a \emph{dandeling reference}, for example a pointer which points to non | ||
| 734 | -significant data. In the language C for example, you can create pointers of type {\tt void*}. This means pointers pointing | ||
| 735 | -to \emph{nothing}. They are clearly partly defined data, in the sens that they are waiting for a cast which will give | ||
| 736 | -them an actual meaning. | ||
| 737 | -A C programmer (including myself) uses such a pointer only after a cast to some | ||
| 738 | -significant pointer type. This is indeed necessary in C to use such pointers of type {\tt void*} in many situations. | ||
| 739 | -However, the reason why it is necessary in C but not in Anubis is that C has no good notion of sum type (C unions are | ||
| 740 | - not sum types). | ||
| 741 | - | ||
| 742 | -As another example, consider a \emph{variable}, i.e. some position in memory where a datum can be written and read. | ||
| 743 | -In the language C, you can declare such a variable without giving it an \emph{initial value}. Such an \emph{uninstantiated | ||
| 744 | -variable} is of course a meaningless object. It becomes meaningfull only when an actual datum (of the right type) is | ||
| 745 | -written into it. | ||
| 746 | - | ||
| 747 | -In Anubis, there is only one sort of such variables. They are called \emph{dynamic variables} and are created at run | ||
| 748 | -time. These variables can be read and written. However, you cannot create such a variable without providing an initial | ||
| 749 | -value for it. Thus, a dynamic variable is never incomplete, i.e. there is no vacuum in it. You can also never write into | ||
| 750 | -a dynamic variable a datum which is not of the right type (this is actually also the case in C, unless you use a cast). | ||
| 751 | - | ||
| 752 | -As another example, consider the following function taken from {\tt predefined.anubis}~: | ||
| 753 | - | ||
| 754 | - | ||
| 755 | - | ||
| 756 | -\section{Memory management} | ||
| 757 | -Memory managment in Anubis is automatic. You never have to worry about it. This feature was necessary in order to ensure | ||
| 758 | -that meaningless data can never be seen in a program. | ||
| 759 | - | ||
| 760 | - | ||
| 761 | - | ||
| 762 | - | ||
| 763 | - | ||
| 764 | - | ||
| 765 | - | ||
| 766 | - | ||
| 767 | \chapter{Quick start} | 676 | \chapter{Quick start} |
| 768 | When you learn a programming language you need to test each new concept immediately. | 677 | When you learn a programming language you need to test each new concept immediately. |
| 769 | Hence, we begin by explaining how to use the Anubis compiler. | 678 | Hence, we begin by explaining how to use the Anubis compiler. |
| @@ -3655,7 +3564,7 @@ EXPR(x*y): EXPR(x) times EXPR(y) | @@ -3655,7 +3564,7 @@ EXPR(x*y): EXPR(x) times EXPR(y) | ||
| 3655 | Let’s consider for example the rule \cod{EXPR(x+y): EXPR(x) plus EXPR(y).} which was originally written \cod{EXPR: | 3564 | Let’s consider for example the rule \cod{EXPR(x+y): EXPR(x) plus EXPR(y).} which was originally written \cod{EXPR: |
| 3656 | EXPR plus EXPR.}. We have declared names for the values of some symbols of the body (\cod{EXPR} was replaced | 3565 | EXPR plus EXPR.}. We have declared names for the values of some symbols of the body (\cod{EXPR} was replaced |
| 3657 | either by \cod{EXPR(x)} or \cod{EXPR(y)}), and we have written a formula \cod{(x+y)} for computing a value for the head of rule. | 3566 | either by \cod{EXPR(x)} or \cod{EXPR(y)}), and we have written a formula \cod{(x+y)} for computing a value for the head of rule. |
| 3658 | -At the time the automaton reduces via this rule, it computes the sum of the values of \cod{x} and \cod{y}, and the result | 3567 | +At the time the automaton reduces via this rule, it computes the sum of the values of \cod{x} and \cod{y}, and he result |
| 3659 | will be the value of the head of rule. | 3568 | will be the value of the head of rule. |
| 3660 | 3569 | ||
| 3661 | In this example, of course, we do not construct a syntax tree. We compute only numerical values for the | 3570 | In this example, of course, we do not construct a syntax tree. We compute only numerical values for the |
anubis_dev/vm/src/anbexec.cpp
| @@ -803,7 +803,7 @@ void schedul(void) | @@ -803,7 +803,7 @@ void schedul(void) | ||
| 803 | } | 803 | } |
| 804 | 804 | ||
| 805 | /* generate a tick if needed */ | 805 | /* generate a tick if needed */ |
| 806 | - gettimeofday(¤t_time,NULL); | 806 | +/* gettimeofday(¤t_time,NULL); |
| 807 | if (timevalless(&next_tick,¤t_time)) | 807 | if (timevalless(&next_tick,¤t_time)) |
| 808 | { | 808 | { |
| 809 | #ifdef _WITH_GRAPHISM_ | 809 | #ifdef _WITH_GRAPHISM_ |
| @@ -818,7 +818,7 @@ void schedul(void) | @@ -818,7 +818,7 @@ void schedul(void) | ||
| 818 | next_tick.tv_usec -= 1000000; | 818 | next_tick.tv_usec -= 1000000; |
| 819 | } | 819 | } |
| 820 | } | 820 | } |
| 821 | - | 821 | +*/ |
| 822 | #ifdef _WITH_GRAPHISM_ | 822 | #ifdef _WITH_GRAPHISM_ |
| 823 | /* get all window events and dispatch them to the windows */ | 823 | /* get all window events and dispatch them to the windows */ |
| 824 | if (the_primary_module.flags & mf_using_graphism) | 824 | if (the_primary_module.flags & mf_using_graphism) |
| @@ -955,7 +955,7 @@ void schedul(void) | @@ -955,7 +955,7 @@ void schedul(void) | ||
| 955 | waiting_for_completion_machines++; | 955 | waiting_for_completion_machines++; |
| 956 | 956 | ||
| 957 | TheAnubisProcessList->SetRunningProcess(NULL); | 957 | TheAnubisProcessList->SetRunningProcess(NULL); |
| 958 | - } // end of the loop running all processes once | 958 | + } |
| 959 | 959 | ||
| 960 | 960 | ||
| 961 | if(compute_perf) | 961 | if(compute_perf) |
anubis_dev/vm/src/syscall.cpp
| @@ -11975,7 +11975,7 @@ Note: the string is read from the end towards the beginning. */ | @@ -11975,7 +11975,7 @@ Note: the string is read from the end towards the beginning. */ | ||
| 11975 | 11975 | ||
| 11976 | public type FastLexerOutput: | 11976 | public type FastLexerOutput: |
| 11977 | rejected(Word16 where, Int start, Int end), | 11977 | rejected(Word16 where, Int start, Int end), |
| 11978 | - accepted(Word16 where, Int start, Int end, Int current), | 11978 | + accepted(Word16 where, Int start, Int end), |
| 11979 | ignored_to_end. | 11979 | ignored_to_end. |
| 11980 | 11980 | ||
| 11981 | */ | 11981 | */ |
| @@ -12002,17 +12002,7 @@ public type FastLexerOutput: | @@ -12002,17 +12002,7 @@ public type FastLexerOutput: | ||
| 12002 | U32 last_accepted_state = 0; // idem | 12002 | U32 last_accepted_state = 0; // idem |
| 12003 | 12003 | ||
| 12004 | #ifdef debug_fast_lexer | 12004 | #ifdef debug_fast_lexer |
| 12005 | - // print behaviors: | ||
| 12006 | - { | ||
| 12007 | - U32 i; | ||
| 12008 | - printf("\nBehaviors: (0=rejecting, 1=accepting, 2=ignoring)"); | ||
| 12009 | - for(i = 0; i < ((U32*)(*(MAM(m_SP)-1)))[1]; i++) | ||
| 12010 | - { | ||
| 12011 | - if ((i&15) == 0) printf("\n "); | ||
| 12012 | - printf("%d:%d ",i,behaviors[i]); | ||
| 12013 | - } | ||
| 12014 | - printf("\n"); | ||
| 12015 | - } | 12005 | + printf("\nrun_fast_lexer: last_accepted:%d",last_accepted); |
| 12016 | #endif | 12006 | #endif |
| 12017 | 12007 | ||
| 12018 | /* record last accepted position and state (if any). Recall that: | 12008 | /* record last accepted position and state (if any). Recall that: |
| @@ -12043,22 +12033,22 @@ public type FastLexerOutput: | @@ -12043,22 +12033,22 @@ public type FastLexerOutput: | ||
| 12043 | 12033 | ||
| 12044 | public type FastLexerOutput: | 12034 | public type FastLexerOutput: |
| 12045 | rejected(Word16 where, Int start, Int end), | 12035 | rejected(Word16 where, Int start, Int end), |
| 12046 | - accepted(Word16 where, Int start, Int end, Int current), | 12036 | + accepted(Word16 where, Int start, Int end), |
| 12047 | ignored_to_end. | 12037 | ignored_to_end. |
| 12048 | 12038 | ||
| 12049 | 12039 | ||
| 12050 | - * (accepted or rejected) (largest alternative is 'accepted') | 12040 | + * (accepted or rejected) (larges alternatives) |
| 12051 | | | 12041 | | |
| 12052 | V | 12042 | V |
| 12053 | - +---------+-----+-------+-------+-------+ | ||
| 12054 | - | cnt |where| start | end | curre | | ||
| 12055 | - +---------+-----+-------+-------+-------+ | ||
| 12056 | - 0 4 6 10 14 18 | 12043 | + +---------+-----+-------+-------+ |
| 12044 | + | cnt |where| start | end | | ||
| 12045 | + +---------+-----+-------+-------+ | ||
| 12046 | + 0 4 6 10 14 | ||
| 12057 | 12047 | ||
| 12058 | - 18 byte => requires 5 words (20 bytes). | 12048 | + 14 byte => requires 4 words (16 bytes). |
| 12059 | 12049 | ||
| 12060 | */ | 12050 | */ |
| 12061 | - if ((result = MAM(m_R) = MAM(m_allocator)->AllocateDataSegment(5)) == 0) | 12051 | + if ((result = MAM(m_R) = MAM(m_allocator)->AllocateDataSegment(4)) == 0) |
| 12062 | { | 12052 | { |
| 12063 | MAM(m_status) = need_more_memory; | 12053 | MAM(m_status) = need_more_memory; |
| 12064 | { MAM(m_steps) = 0; return; } | 12054 | { MAM(m_steps) = 0; return; } |
| @@ -12154,11 +12144,9 @@ public type FastLexerOutput: | @@ -12154,11 +12144,9 @@ public type FastLexerOutput: | ||
| 12154 | printf("\n*** The lexer (word16_lexer_length:%d) ***\n",word16_lexer_length); | 12144 | printf("\n*** The lexer (word16_lexer_length:%d) ***\n",word16_lexer_length); |
| 12155 | for (i = 0; i < (word16_lexer_length>>8); i ++) | 12145 | for (i = 0; i < (word16_lexer_length>>8); i ++) |
| 12156 | { | 12146 | { |
| 12157 | - printf("\n------- state %d (%s) ---\n",i, | ||
| 12158 | - behaviors[i]==0 ? "rejecting" : behaviors[i]==1 ? "accepting" : "ignoring"); | 12147 | + printf("\n------- state %d ---\n",i); |
| 12159 | for (j = 32; j < 126; j++) | 12148 | for (j = 32; j < 126; j++) |
| 12160 | - if (lexer[(i<<8)+j] != 65535) | ||
| 12161 | - printf("%c:%d ",j,lexer[(i<<8)+j]); | 12149 | + printf("%c:%d ",j,lexer[(i<<8)+j]); |
| 12162 | } | 12150 | } |
| 12163 | printf("\n"); | 12151 | printf("\n"); |
| 12164 | fflush(stdout); | 12152 | fflush(stdout); |
| @@ -12186,8 +12174,7 @@ public type FastLexerOutput: | @@ -12186,8 +12174,7 @@ public type FastLexerOutput: | ||
| 12186 | *((U16 *)(((U8 *)result)+4)) = (U16)last_accepted_state; | 12174 | *((U16 *)(((U8 *)result)+4)) = (U16)last_accepted_state; |
| 12187 | *((U32 *)(((U8 *)result)+6)) = (token_start<<2)|1; /* Word32 to Int */ | 12175 | *((U32 *)(((U8 *)result)+6)) = (token_start<<2)|1; /* Word32 to Int */ |
| 12188 | *((U32 *)(((U8 *)result)+10)) = (last_accepted_position<<2)|1; /* Word32 to Int */ | 12176 | *((U32 *)(((U8 *)result)+10)) = (last_accepted_position<<2)|1; /* Word32 to Int */ |
| 12189 | - *((U32 *)(((U8 *)result)+14)) = (start<<2)|1; /* Word32 to Int */ | ||
| 12190 | - MAM(m_R) |= 1; /* accepted */ | 12177 | + MAM(m_R) |= 1; |
| 12191 | MAM(m_IP) += 1+2; | 12178 | MAM(m_IP) += 1+2; |
| 12192 | /* accepted */ | 12179 | /* accepted */ |
| 12193 | return; | 12180 | return; |
| @@ -12197,7 +12184,6 @@ public type FastLexerOutput: | @@ -12197,7 +12184,6 @@ public type FastLexerOutput: | ||
| 12197 | *((U16 *)(((U8 *)result)+4)) = (U16)old_state; | 12184 | *((U16 *)(((U8 *)result)+4)) = (U16)old_state; |
| 12198 | *((U32 *)(((U8 *)result)+6)) = (token_start<<2)|1; /* Word32 to Int */ | 12185 | *((U32 *)(((U8 *)result)+6)) = (token_start<<2)|1; /* Word32 to Int */ |
| 12199 | *((U32 *)(((U8 *)result)+10)) = ((start+1)<<2)|1; /* Word32 to Int */ | 12186 | *((U32 *)(((U8 *)result)+10)) = ((start+1)<<2)|1; /* Word32 to Int */ |
| 12200 | - /* rejected */ | ||
| 12201 | MAM(m_IP) += 1+2; | 12187 | MAM(m_IP) += 1+2; |
| 12202 | /* rejected */ | 12188 | /* rejected */ |
| 12203 | return; | 12189 | return; |
| @@ -12207,17 +12193,33 @@ public type FastLexerOutput: | @@ -12207,17 +12193,33 @@ public type FastLexerOutput: | ||
| 12207 | *((U16 *)(((U8 *)result)+4)) = (U16)old_state; | 12193 | *((U16 *)(((U8 *)result)+4)) = (U16)old_state; |
| 12208 | *((U32 *)(((U8 *)result)+6)) = (token_start<<2)|1; /* Word32 to Int */ | 12194 | *((U32 *)(((U8 *)result)+6)) = (token_start<<2)|1; /* Word32 to Int */ |
| 12209 | *((U32 *)(((U8 *)result)+10)) = (start<<2)|1; /* Word32 to Int */ | 12195 | *((U32 *)(((U8 *)result)+10)) = (start<<2)|1; /* Word32 to Int */ |
| 12210 | - *((U32 *)(((U8 *)result)+14)) = (start<<2)|1; /* Word32 to Int */ | ||
| 12211 | - MAM(m_R) |= 1; /* accepted */ | 12196 | + MAM(m_R) |= 1; |
| 12212 | MAM(m_IP) += 1+2; | 12197 | MAM(m_IP) += 1+2; |
| 12213 | /* accepted */ | 12198 | /* accepted */ |
| 12214 | return; | 12199 | return; |
| 12215 | 12200 | ||
| 12216 | case 2: /* ignoring and no transition */ | 12201 | case 2: /* ignoring and no transition */ |
| 12202 | + /* inhibited this case because the longest lexeme prevails even if it is to be ignored | ||
| 12203 | + and the shortest one accepted. */ | ||
| 12204 | +#if 0 | ||
| 12205 | + if (has_last_accepted) | ||
| 12206 | + { | ||
| 12207 | + *((U16 *)(((U8 *)result)+4)) = (U16)last_accepted_state; | ||
| 12208 | + *((U32 *)(((U8 *)result)+6)) = (token_start<<2)|1; /* Word32 to Int */ | ||
| 12209 | + *((U32 *)(((U8 *)result)+10)) = (last_accepted_position<<2)|1; /* Word32 to Int */ | ||
| 12210 | + MAM(m_R) |= 1; | ||
| 12211 | + MAM(m_IP) += 1+2; | ||
| 12212 | +#ifdef debug_fast_lexer | ||
| 12213 | + printf("ignoring no transition with last accepted\n"); fflush(stdout); | ||
| 12214 | +#endif | ||
| 12215 | + return; | ||
| 12216 | + } | ||
| 12217 | + else | ||
| 12218 | +#endif | ||
| 12217 | { | 12219 | { |
| 12218 | /* ignoring and no last accepted: restart from state 0 */ | 12220 | /* ignoring and no last accepted: restart from state 0 */ |
| 12219 | state = 0; | 12221 | state = 0; |
| 12220 | - has_last_accepted = 0; | 12222 | + // has_last_accepted = 0; // redondant |
| 12221 | token_start = start; | 12223 | token_start = start; |
| 12222 | #ifdef debug_fast_lexer | 12224 | #ifdef debug_fast_lexer |
| 12223 | printf("continuing after ignoring (new token start = %u)\n",start); | 12225 | printf("continuing after ignoring (new token start = %u)\n",start); |
| @@ -12225,8 +12227,7 @@ public type FastLexerOutput: | @@ -12225,8 +12227,7 @@ public type FastLexerOutput: | ||
| 12225 | continue; | 12227 | continue; |
| 12226 | } | 12228 | } |
| 12227 | 12229 | ||
| 12228 | - default: printf("state = %d, behaviors[state] = %d\n",state,behaviors[state]); | ||
| 12229 | - internal_error("Invalid behavior (should be 0, 1 or 2)\n"); | 12230 | + default: assert(0); |
| 12230 | } | 12231 | } |
| 12231 | } | 12232 | } |
| 12232 | /* we have transited into a new state */ | 12233 | /* we have transited into a new state */ |
| @@ -12255,14 +12256,14 @@ public type FastLexerOutput: | @@ -12255,14 +12256,14 @@ public type FastLexerOutput: | ||
| 12255 | case 0: /* rejecting and at end of input */ | 12256 | case 0: /* rejecting and at end of input */ |
| 12256 | if (has_last_accepted) | 12257 | if (has_last_accepted) |
| 12257 | { | 12258 | { |
| 12258 | - *((U16 *)(((U8 *)result)+4)) = (U16)last_accepted_state; | 12259 | + *((U16 *)(((U8 *)result)+4)) = (U16)state; |
| 12259 | *((U32 *)(((U8 *)result)+6)) = (token_start<<2)|1; /* Word32 to Int */ | 12260 | *((U32 *)(((U8 *)result)+6)) = (token_start<<2)|1; /* Word32 to Int */ |
| 12260 | *((U32 *)(((U8 *)result)+10)) = (last_accepted_position<<2)|1; /* Word32 to Int */ | 12261 | *((U32 *)(((U8 *)result)+10)) = (last_accepted_position<<2)|1; /* Word32 to Int */ |
| 12261 | - *((U32 *)(((U8 *)result)+14)) = (start<<2)|1; /* Word32 to Int */ | ||
| 12262 | - MAM(m_R) |= 1; /* accepted */ | 12262 | + MAM(m_R) |= 1; |
| 12263 | MAM(m_IP) += 1+2; | 12263 | MAM(m_IP) += 1+2; |
| 12264 | + /* accepted */ | ||
| 12264 | #ifdef debug_fast_lexer | 12265 | #ifdef debug_fast_lexer |
| 12265 | - printf("rejecting state at end of input with last accepted (accepting)\n"); fflush(stdout); | 12266 | + printf("accepting at end of input with last accepted\n"); fflush(stdout); |
| 12266 | #endif | 12267 | #endif |
| 12267 | return; | 12268 | return; |
| 12268 | } | 12269 | } |
| @@ -12283,8 +12284,7 @@ public type FastLexerOutput: | @@ -12283,8 +12284,7 @@ public type FastLexerOutput: | ||
| 12283 | *((U16 *)(((U8 *)result)+4)) = (U16)state; | 12284 | *((U16 *)(((U8 *)result)+4)) = (U16)state; |
| 12284 | *((U32 *)(((U8 *)result)+6)) = (token_start<<2)|1; /* Word32 to Int */ | 12285 | *((U32 *)(((U8 *)result)+6)) = (token_start<<2)|1; /* Word32 to Int */ |
| 12285 | *((U32 *)(((U8 *)result)+10)) = (start<<2)|1; /* Word32 to Int */ | 12286 | *((U32 *)(((U8 *)result)+10)) = (start<<2)|1; /* Word32 to Int */ |
| 12286 | - *((U32 *)(((U8 *)result)+14)) = (start<<2)|1; /* Word32 to Int */ | ||
| 12287 | - MAM(m_R) |= 1; /* accepted */ | 12287 | + MAM(m_R) |= 1; |
| 12288 | MAM(m_IP) += 1+2; | 12288 | MAM(m_IP) += 1+2; |
| 12289 | /* accepted */ | 12289 | /* accepted */ |
| 12290 | #ifdef debug_fast_lexer | 12290 | #ifdef debug_fast_lexer |
| @@ -12295,11 +12295,10 @@ public type FastLexerOutput: | @@ -12295,11 +12295,10 @@ public type FastLexerOutput: | ||
| 12295 | case 2: /* ignoring state */ | 12295 | case 2: /* ignoring state */ |
| 12296 | if (has_last_accepted) | 12296 | if (has_last_accepted) |
| 12297 | { | 12297 | { |
| 12298 | - *((U16 *)(((U8 *)result)+4)) = (U16)last_accepted_state; | 12298 | + *((U16 *)(((U8 *)result)+4)) = (U16)state; |
| 12299 | *((U32 *)(((U8 *)result)+6)) = (token_start<<2)|1; /* Word32 to Int */ | 12299 | *((U32 *)(((U8 *)result)+6)) = (token_start<<2)|1; /* Word32 to Int */ |
| 12300 | *((U32 *)(((U8 *)result)+10)) = (last_accepted_position<<2)|1; /* Word32 to Int */ | 12300 | *((U32 *)(((U8 *)result)+10)) = (last_accepted_position<<2)|1; /* Word32 to Int */ |
| 12301 | - *((U32 *)(((U8 *)result)+14)) = (start<<2)|1; /* Word32 to Int */ | ||
| 12302 | - MAM(m_R) |= 1; /* accepted */ | 12301 | + MAM(m_R) |= 1; |
| 12303 | MAM(m_IP) += 1+2; | 12302 | MAM(m_IP) += 1+2; |
| 12304 | /* accepted */ | 12303 | /* accepted */ |
| 12305 | #ifdef debug_fast_lexer | 12304 | #ifdef debug_fast_lexer |