f++

## Nift's in-built scripting language f++

f++ is Nift's in-built scripting language. The ++ comes from the language being developed in c++, while the f comes from functions playing a central role basically everywhere in the language and can be thought of as standing for any of the following:

• frankenstein++ (f++/n++/Lua/ExprTK)
• functions++
• functions everywhere
• functions with superpowers
[contents]

#### f++ interpreter

Nift has an f++ interpreter that you can start with either nsm interp or nift interp (it is the default language for the interpeter mode).

In the interpreter mode the prompt will just tell you which language you are using. If you would like the prompt to also display the present working directory (up to using half the width of the console) you can switch to the shell mode using nsm_mode("sh"). You can switch back again with nsm_mode("interp").

You can switch to one of the other languages available in Nift's interpreter using nsm_lang(langStr) where langStr is one of f++, n++, lua or exprtk.

#### f++ shell

Nift has an f++ shell that you can start with either nsm sh or nift sh (it is the default language for the shell mode).

The f++ shell attempts to work as an extension of the shell it is running from, ie. should work almost identically to the shell it is running from while having a number of additional features (and is often faster than the shell it is running from).

In the shell mode the prompt will tell you which language you are using and the present working directory (up to using half the width of the console). If you would like the prompt to just display the language you can switch to the interpreter mode using nsm_mode("interp"). You can switch back again with nsm_mode("sh").

You can switch to one of the other languages available in Nift using nsm_lang(langStr) where langStr is one of f++, n++, lua or exprtk.

#### Running f++ scripts

If you have an f++ script saved in a file path/script-name.f you can run it with either of the following:

nsm run path/script-name.f
nift run path/script-name.f


If the script has a different extension, say .ext, you can run the script with either of the following:

nsm run -f++ path/script-name.ext
nift run -f++ path/script-name.ext


#### f++ from n++

You can run f++ code from n++ using either of the following:

@f++(/* single line of f++ code */)


@f++
{
// block of f++ code
}


#### Nift functions

All of Nift's hard-coded functions (including functions for defining variables, functions and structs) are available in your f++ code. The syntax for calling a function is as follows:

funcName{options}(params)


Note: One of the main differences between f++ and n++ are that function calls in n++ must start with an @ in front of the function name. However it is okay for there to be an @ in front of the function name for a function call in f++. Consequently quite often valid n++ code is valid f++ code, which among other things allows us to conveniently use f++ for things like n++ if/else-if/else/while/for/etc. conditions and if the developer accidentally uses n++ for the condition it will most often run without any syntax or semantic errors.