Dproc programming language compiler
Dproc is a data processing oriented language. It's intended to process and auto document its operations.
src/dproc.lex: token definition
src/dproc.grm: grammar
src/interpreter.sml: execution
In order to run it, you need to install SML:
Linux:
apt-get install smlnj
MacOS:
brew update
brew install smlnj
- Arithmetic: sum (+), subtraction (-), product (*) and division (/);
- Logical: greater (>), greater or equal (>=), less (<), less or equal (<=), equal (==) and different (!-);
- Boolean: and (and), or (or).
You can run dproc files as follows:
./dproc my_program.dproc
It's going to be executed and it will generate a log file called my_program.log
.
All the variables final values will be displayed.
Just call:
./dproc_tests
column a;
column b;
column c;
column d;
a = [5, 1, 2, 4, 3];
b = [2, 2, 1, 1, 2];
c = multiplicacao(b, 2);
d = logic_comp(a, ">", c, 1, 0);
Generates:
Running tests/test_log_comp.dproc
val it = () : unit
Varibles:
val it = ["a","b","c","d"] : string list
Their values:
val it =
[List [Int_v 5,Int_v 1,Int_v 2,Int_v 4,Int_v 3],
List [Int_v 2,Int_v 2,Int_v 1,Int_v 1,Int_v 2],
List [Int_v 4,Int_v 4,Int_v 2,Int_v 2,Int_v 4],
List [Int_v 1,Int_v 0,Int_v 0,Int_v 1,Int_v 0]] : Ast.Value list