Skip to content

Latest commit

 

History

History
43 lines (29 loc) · 1.06 KB

README.md

File metadata and controls

43 lines (29 loc) · 1.06 KB

GridC

GridC gives GridLang a nice, C-ish syntax.

Online editor/compiler

http://lessandro.com/gridc/

Dependencies

Instructions

  1. If you just installed cabal, run cabal update
  2. On the gridc project folder, run cabal install
  3. The executable should be in ~/.cabal/gridc
  4. ./gridc input.gridc > output.gridlang

GridC

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!