Add Missing Brackets

lua-users home
wiki

Add Missing Brackets

This is C code with many "{}();" characters missing.

#include <stdio.h>

int main  int argc, char **argv
    int i
    char name[]="Anchor"
    printf  "%s is C.\n",name
    for  i=5;i--;
        printf  "%i\n",i
    
    printf  "done!\n"
    return 0
Pretend to program in Python or Lua while actually writing in C (and possibly PHP, Java, D, C++). If code is indented, a free GPL program called "Anchor" (located on Freshmeat.net) automatically adds missing brackets.

Anchor is written in C and flex is needed to compile it. A challenging exercise would be to port it to Lua.

The commands are simple to add to .SciTEUser.properties

command.go.*.a.c=anch -run $(FileNameExt)
command.compile.*.a.c=anchor $(FileNameExt)|gcc -xc -&&./a.out
Now remember to save the Anchor projects with the ".a.c" extension.

Also integrates with Tinycc compiler (TCC) to create runnable C scripts.


RecentChanges · preferences
edit · history
Last edited November 13, 2010 7:45 am GMT (diff)