Specification
The exact langauge specification is work in progress and will be available later.
Refer to the examples.
Sum
Calculate $ 3+4 = #7 $.
Sum
a, b in { 2, 3, ..., 10 }
Calculate $ a+b = #(a+b) $.
Product #fundamentals #easy
a, n in { 2, 3, ..., 6 }
Calculate $ prod_(i=1)^n a = #a^n $
? Multiply $a*a*...*a$ ($n$ times).
sell =
title { code | text };
code =
"§CODE_START" { (code_prop | code_hint | assign | prog) "\n" } "§CODE_END";
code_prop =
"input" ("rows"|"cols") ":=" ("resizeable"|"static");
code_hint =
"?" text;
assign =
ID {"," ID} (":="|"=") expr
| ID {"," ID} "in" (matrix_def | set | expr)
| ID "[" expr "," expr "]" (":="|"=") expr
| ID "[" expr "," expr "]" "in" (matrix_def | set | expr)
| ID "(" ID {"," ID} ")" (":="|"=") symbolic_term;
expr =
or;
or =
and [ "or" and ];
and =
equal [ "and" equal ];
equal =
compare [ ("=="|"!=") compare ];
compare =
add [ ("<="|"<"|">="|">") add ];
add =
mul { ("+"|"-") mul };
mul =
pow { ("*"|"/"|"mod") pow };
pow =
unary { ("^") unary };
unary = (
| "-" unary;
| INT [ "." INT ]
| "true" | "false"
| "not" unary
| "i" | "j" | "T"
| function_call
| ID [ "(" add { "," add } ")" ]
| "..."
| matrix
| "(" expr ")"
) [ factorial ];
matrix =
"[" "[" expr {"," expr} "]" { "," "[" expr {"," expr} "]" } "]";
function_call =
("abs"|"binomial"|"integrate"|"conj"|"sqrt"|"xgcd"|"det"|"rank"|"inv"
|"eye"|"eigenvalues_sym"|"triu"|"sin"|"cos"|"asin"|"acos"|"tan"
|"atan"|"norm2"|"dot"|"cross"|"linsolve"| "is_zero")
ID "(" [ expr {"," expr} ] ")";
factorial =
"!";
matrix_def =
"MM" "(" expr "x" expr "|" expr [ {"," ("invertible"|"symmetric")} ] ")";
set =
"{" [ expr { "," expr } ] "}";
symbolic_term =
symbolic_term_add;
symbolic_term_expr =
symbolic_term_add;
symbolic_term_add =
symbolic_term_mul { ("+"|"-") symbolic_term_mul };
symbolic_term_mul =
symbolic_term_pow { ("*"|"/") symbolic_term_pow };
symbolic_term_pow =
symbolic_term_unary { "^" symbolic_term_unary };
symbolic_term_unary =
"(" symbolic_term_expr ")"
| INT ["!"]
| FLOAT
| ("exp"|"sin"|"cos"|"sqrt") "(" symbolic_term_expr ")"
| "diff" "(" symbolic_term_expr "," ID ")"
| ID
| ID "(" [ expr { "," epxr } ] ")"
| "-" symbolic_term_pow;
title =
{ ID | "#" ID | MISC } "\n";
text =
{ single_multiple_choice | itemize | inline_listing | listing
| inline_math | im_input | ID | MISC };
itemize =
"*";
single_multiple_choice =
"(" ("x"|expr) ")"
| "[" ("x"|expr) "]";
inline_listing =
"`" { MISC } "`";
listing =
"```" { MISC } "```";
inline_math =
"$" { im_expr } "$";
im_expr = /*similar to ASCII math*/
im_list;
im_list =
im_assign { (","|":"|"->"|"|->") } im_assign;
im_assign =
im_other_binary_op "=" im_other_binary_op;
im_other_binary_op =
im_relational { ("in"|"notin"|"uu"|"^^"|"vv"|"@") } im_relational;
im_relational =
im_add { ("<"|"<="|">"|">="|"!=") im_add };
im_add =
im_mul { ("+"|"-") im_mul };
im_mul =
im_pow { ("*"|"/") im_pow };
im_pow =
im_unary { "^" im_unary };
im_unary = (
im_input
| "text" "(" { MISC } ")"
| "augmented" "(" ID "|" ID ")"
| ("sum"|"prod"|"lim"|"int") [ "_" expr ] [ "^" expr ]
| "RR" | "ZZ" | "QQ" | "CC"
| "oo" | "infty"
| "equiv" | "mod"
| "EE" | "AA"
| "dx" | "dy" | "dz"
| "bar" im_unary
| "-" unary
| " "
| INT | FLOAT
| ID
| ID "[" (INT|":") "," (INT|":") "]"
| "\"" ID "\""
| "(" im_expr ")"
| "{" { im_expr } "}"
| "|"
| "\"
| "\\"
| "..."
| im_matrix
) [ "!" | {"'"} ];
im_matrix =
"[" "[" im_expr {"," im_expr} "]"
{ "," "[" im_expr {"," im_expr} "]" } "]";
| "(" "(" im_expr {"," im_expr} "]"
{ "," "[" im_expr {"," im_expr} ")" } ")";
im_input =
"#" [ "[" "diff" ID "]" ] (
ID
| "\"" (ID|INT) { "|" (ID|INT) } "\"" /* gap question text */
);
prog =
("JavaBlock"|"JavaMethod") ID "\n" "§CODE2_START" prog_assert "§CODE2_END";
prog_assert =
"assert" "'" ANY "'" "\n";