/*
 *	Dafny:-) codegenerator for tiny Haskell subset - modified from C one
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
 
#include "consthash.h"
#include "types.h"
#include "funchash.h"
#include "codegen.h"


extern BOOL verbose;


static void write_dafny_main( FILE *out, expr e )
{
	printf( "method Main()\n{\n\t" );
	printf( "var x := " );
	print_expr( stdout, e );
	printf( ";\n\t" );
	char *mesg1 = "print %cResult: %c, x, %c\\n%c ";
	printf( mesg1, '"', '"', '"', '"' );
	printf( ";\n}\n\n" );
}


void write_dafny_program( FILE *out, expr e )
{
	/*printf( "\n// this code started out as a haskell program, now it's dafny\n" );*/

	print_funchash( stdout );
	write_dafny_main( out, e );
}
