GridC gives GridLang a nice, C-ish syntax.
- Haskell Platform
- Or you can just install GHC7 and Cabal.
- If you just installed cabal, run
cabal update
- On the gridc project folder, run
cabal install
- The executable should be in
~/.cabal/gridc
./gridc input.gridc > output.gridlang
int factorial(n)
{
if (n == 0) {
return 1;
}
f = factorial(n - 1);
return n * f;
}
The language works as you expect it to work, with a few caveats:
- Type declarations don't matter.
- Everything is a number (int or float).
- There are no void functions.
- Functions without a return statement return 0.
- Variables are created on assignment.
- The compiler does not check function calls.
Have fun writing GridC!