Agent Manipulation Language (AML) is a simple programming languages that compiles to C. It support describing the behaviors of agents and the computation geometry.
AML is implemented in OCaml.There are some slides made by myself.
Now it looks like an unfinished course homework, welcome to help us to make it better.
How to get it
Build from source
- install glut // for mac, Xcode bring the glut
- opam install menhir
- clone with git
- make
- ./main.native [file]
Test
make test
Test things with openGL:
cd lib
g++ -o main demo_cpp_1.cpp -lglut -lGL // for ubuntu
g++ -framework OpenGL -framework GLUT -framework Foundation -o main demo_cpp_1.cpp // for mac OS
./main
Syntax
Assignment
int i = 1; double f = 1.0; string s = "1"; bool b = true; ang d = (1, 0); vec2f v = (1, 1);
Arithmetic
println(false, true, 42); println(1 + (4 + 6) * 3); println(8 - 3 % 2); println(-9 - 9); println((2 + 8) / 3);
Comment
/* This is a multi-line comment */ // This is a single-line comment
Loop
int sum; for(int i = 1; i <= 100; i = i + 1) { sum = sum + i; }
Condition
int a = 3; if (a > 2) println("Yes"); else { println("No"); }
Recursion
int fibonacci(int num) { if (num == 0) return(0); else if(num == 1) return(1); else return (fibonacci(num - 2) + fibonacci(num - 1)); }