mlan

module
v0.0.0-...-1d1a010 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2024 License: GPL-3.0

README

mlan

Go Report Card

MLAN (Micro LANguage) is a scripting language (interpreter based) for embedding in Golang applications based on ANTLR4 grammar.

Why yet another scripting language?

Development of language was part of creation C2 framework - c2m, which we position as interface between operator and beacon. MLAN runtime used in operator's CLI to give possibility of extending stocked functionality of interaction with server and beacons, which we provided.

Speed was not a goal of this language, but it can be easily reached by mapping functions written on native Golang.

What about syntax?

We can charactarized MLAN as follows: syntax more like C way, typification and logic of processing like Python way.

This example is C like (a lot of brakets and semicolons):

fn fib(n) {
  if n < 2 {
    return n;
  } else {
    return fib(n-2) + fib(n-1);
  }
}

println(fib(35));

This example is Python like (dynimac typification of variable a):

a = 1;
a = [a, 2, 3, 4];
a = {"kek": a};
a = "hello";
a = a + " world";
println(a);

More info about syntax with examples.

What about data types?

All data types sit on top of abstration as object.

MLAN offered with next data types, which implements object's interface:

  • bool (bool in Golang)
  • dict (map in Golang, where key is string)
  • float (float64 in Golang)
  • int (int64 in Golang)
  • list (list of objects)
  • null (just empty object)
  • str (string in Golang, but operates using runes)
  • closures (special type of object, that can be called inline)

More info about data types with examples.

References

Here you can find some more information:

What's next?

  • Improve quality of documentation
  • Builtin methods for data types
  • Builtin functions to handle regexp
  • Builtin functions to handle network interaction
  • Extend builtin functions to handle FS interaction
  • Extend builtin functions for string processing
  • Tests of seprated critical components
  • Extend collection of samples with realization of different algos

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL