Author: kjs
Date: Tue Apr 10 02:16:05 2007
New Revision: 18109
Added:
trunk/compilers/pirc/t/macro.pir
Modified:
trunk/compilers/pirc/src/jsonout.c
trunk/compilers/pirc/t/stmts.pir
Log:
compilers/pirc:
* fix pod errror in json backend
* add test for macros
* expand t/stmts.pir
Modified: trunk/compilers/pirc/src/jsonout.c
==============================================================================
--- trunk/compilers/pirc/src/jsonout.c (original)
+++ trunk/compilers/pirc/src/jsonout.c Tue Apr 10 02:16:05 2007
@@ -64,14 +64,21 @@
=head1 HELPER METHODS
+=over 4
=cut
*/
+/*
+
+=item new_target()
+
+=cut
-target *
+*/
+static target *
new_target(char *name) {
target *t = (target *)malloc(sizeof(target));
t->name = name;
@@ -79,6 +86,14 @@
return t;
}
+/*
+
+=item add_target()
+
+=cut
+
+*/
+
static void
add_target(emit_data *data, target *t) {
t->next = data->targets;
@@ -87,8 +102,12 @@
/*
+=back
+
=head1 VTABLE METHODS
+=over 4
+
=cut
*/
@@ -286,8 +305,12 @@
/*
+=item json_destroy()
+
Destructor for emit_data structure
+=cut
+
*/
static void
json_destroy(emit_data *data) {
@@ -349,7 +372,13 @@
return vtable;
}
+/*
+
+=back
+=cut
+
+*/
Added: trunk/compilers/pirc/t/macro.pir
==============================================================================
--- (empty file)
+++ trunk/compilers/pirc/t/macro.pir Tue Apr 10 02:16:05 2007
@@ -0,0 +1,6 @@
+.macro INC()
+.endm
+
+.macro Hi()
+ print "hello"
+.endm
Modified: trunk/compilers/pirc/t/stmts.pir
==============================================================================
--- trunk/compilers/pirc/t/stmts.pir (original)
+++ trunk/compilers/pirc/t/stmts.pir Tue Apr 10 02:16:05 2007
@@ -1,17 +1,44 @@
+# test include statement
+.include "subflags.pir"
+
+# test .HLL statement
+.HLL "PIRC", "pircgroup"
+
+
+
.sub main
+# test local declarations
.local pmc x, y, z
.local string a, b, c
.local int i, j
.local num pi
+# test simple expressions
+ i = 42
pi = 3.14
+ a = "Hello World"
+ b = 'hello world'
+# test conditional statements
if x < y goto X
+ unless y > x goto Y
+# test multiple labels
X:
+Y:
+Z:
+# test simple function call
+ foo(1,2,3)
.end
-
+#
+# comments
.sub foo
+ .param pmc args :slurpy
+ .local int i
+ i = args[0]
+ print i
+
+
.end