||5 months ago|
|.gitattributes||5 months ago|
|.gitignore||5 months ago|
|Program.fs||5 months ago|
|Readme.md||5 months ago|
|fskalc||5 months ago|
|fskalc.fsproj||5 months ago|
|release.sh||5 months ago|
- Have dotnet-sdk installed
- Go to the directory where fskalc is located
dotnet restoreto restore the
dotnet runfor debug run
./release.shfor release run, the binary will be found in bin/Release/net[version]/[platform]/publish/fskalc, and also will be copied to the active directory
The following is an informal overview of FSKalc's capabilties.
Will print an error message if variable is undefined. The
ans variable implicitly refers to the result of the last expression statement.
Parentheses for precedence
Parentheses increase precedence.
Functions are called with !.
Multile arguments need to be separated with commas.
logx! 5, 3
The following operators are valid, in decreasing precedence:
^power; right associative
-unary negation; note that multiple negations next to eachother are invalid!
- factor precedence:
*multiplication; left associative
/division; left associative
//integer (flooring) division; left associative
%modulo; left associative
- if no binary operator is found, multiplication is assumed
- term precedence:
+addition; left associative
-subtraction; left associative
Statements are the top level construct. Every line in an FSKalc program has to be a statement.
Any valid expression is also a valid statement. The result of expression statements is printed to the screen, and also assigned to the variable names
Variable assignments have the following syntax:
identifier = expression
Where the identifier is a string of characters containing only letters and underscores.
Existing variables or functions can be overwritten by new variables/functions.
Function declaration has the following syntax, demonstrated by an example below.
double x = x * 2
Multiple parameters need to be declared with commas separating.
sum x, y = x + y
Warning! as there are no scopes in FSKalc, passing arguments to functions will modify the global scope.
- tau (pi * 2)
- e (euler's number)
- inf (infinity)
- nan (not a number)
- sin, cos, tan - they take 1 argument, in radians
- arcsin, arccos, arctan - they take 1 argument, they return in radians
- sqrt - returns square root
- log - logarithm base of 10
- ln - natural logarithm
- exp - returns e to the power of the argument
- rtx - returns the xth root (1st argument: base, 2nd argument: val)
- logx - returns the base x log (1st argument: base, 2nd argument: val)
Comments can be inside matching