Melang

Logo

A script language of preemptive scheduling coroutine in single thread

View the Project on GitHub Water-Melon/Melang

Preprocess

Like preprocess in C, Melang supports simple preprocess.

macro

#define NAME 'John' //define macro
#NAME //use macro
#undef NAME //undefine macro

Name is equivalent to ‘John’. Melang just simply replace ‘NAME’ with ‘John’ in code.

condition

//example A
#if NAME
... //code A
#endif

//example B
#if NAME
... //code B
#else
... //code C
#endif

In example A, if NAME is defined, code A will be executed.

In example B, if NAME is defined, code B will be executed, otherwise execute code C.

include

Just like include in C, Melang also support it to load some script files into a file.

e.g.

#include '~/lib.mln'

The path should follow these rules: