C0H Implementation

From Rosetta Code
C0H Implementation is an implementation of C0H. Other implementations of C0H.

c0h is the implementation for the C0H language on Unix machines; porting to Windows and other platforms should be fairly easy.

In fact c0h is a simple shell script that efficiently uses the already available C compiler named cc: <lang c>#!/bin/bash

FILENAME=$1 FILESIZE=$(stat -f%z "$FILENAME") if [ $FILESIZE -eq 0 ] then

 cat << EOF > $FILENAME
  1. include <stdio.h>

int main(char args[]) {printf("Goodbye, World!\\n");} EOF fi

cc $FILENAME

if [ $FILESIZE -eq 0 ] then

 echo -n > $FILENAME

fi </lang>

A typical test session would look like: <lang bash> $ echo -n >c0.c $ ./c0h c0.c $ ./a.out Goodbye, World! </lang>