index 7149026862087a8f63577916ffd361e8b89b08ef..6b6d335760a57a4fd9e5ca68af3c95b849c96d38 100644 (file)
--- a/test.c
+++ b/test.c
#include "oberon.h"
#include "oberon.h"
+#include "generator.h"
#include <assert.h>
#include <assert.h>
-static oberon_type_t integer = { "INTEGER", OBERON_TYPE_INTEGER, sizeof(int) };
-static oberon_type_t boolean = { "BOOLEAN", OBERON_TYPE_BOOLEAN, sizeof(int) };
-
static const char source[] =
"MODULE Test;"
static const char source[] =
"MODULE Test;"
+ "TYPE"
+ " Callback = PROCEDURE() : INTEGER;"
+ ""
"VAR"
"VAR"
- " k : INTEGER;"
+ " cb : Callback;"
" i : INTEGER;"
" i : INTEGER;"
- " b : BOOLEAN;"
+ ""
+ "PROCEDURE RelBack;"
"BEGIN"
"BEGIN"
- " k := 10;"
- " i := k;"
- " b := TRUE;"
+ " i := 666;"
+ "END RelBack;"
+ ""
+ "BEGIN;"
+ " i := ABS(-1);"
+ " i := cb();"
+ " RelBack;"
"END Test."
;
"END Test."
;
main(int argc, char ** argv)
{
ctx = oberon_create_context();
main(int argc, char ** argv)
{
ctx = oberon_create_context();
- oberon_register_global_type(ctx, &integer);
- oberon_register_global_type(ctx, &boolean);
mod = oberon_compile_module(ctx, source);
mod = oberon_compile_module(ctx, source);
+ //mod -> begin();
+ oberon_generator_dump(ctx, "dump.txt");
oberon_destroy_context(ctx);
return 0;
}
oberon_destroy_context(ctx);
return 0;
}