summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7bb96ab)
raw | patch | inline | side by side (parent: 7bb96ab)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 30 Jul 2017 11:06:25 +0000 (14:06 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 30 Jul 2017 11:06:25 +0000 (14:06 +0300) |
jvm_test.sh | patch | blob | history | |
notes | patch | blob | history | |
rtl/Out.java | [new file with mode: 0644] | patch | blob |
src/backends/jvm/generator-jvm.c | patch | blob | history | |
src/test.c | patch | blob | history |
diff --git a/jvm_test.sh b/jvm_test.sh
index 6dcc9ad80d234870ab8b33036c7987dec029f247..0c94910fd7632fb183005bdb9c157990d5bfad51 100755 (executable)
--- a/jvm_test.sh
+++ b/jvm_test.sh
javac -d classes Launcher.java
jasmin -d classes *.j
+javac -d classes rtl/*.java
+
# -a -- for asm as comments
jad -o -b -noinner classes/*
index 3cc029712b28882beb17e8ea07e05d9bdbbbd1b3..2cfcb16fd6c024c7bd3df454f5e55456851fa8f7 100644 (file)
--- a/notes
+++ b/notes
R2 = RECORD r : R1 END;
R1 = RECORD END;
*)
+- Нужно изменить передачу информации о вызываемой процедуре в MODE_CALL
+ На данный момент конкретная процедура передаётся в поле var, вместо parent
+ Что не позволяет делать процедуры-переменные в полях записей, массивах и т.д.
+- Нужны средства создания биндингов. Хотя бы как заглушки для модулей.
-
-- нет символов и строк
- нужен автокаст int -> real для DIV. Да и вообще каст типов.
+- нет символов и строк
- нету операторов if, while и т.д.
diff --git a/rtl/Out.java b/rtl/Out.java
--- /dev/null
+++ b/rtl/Out.java
@@ -0,0 +1,24 @@
+import java.lang.System;
+
+public class Out
+{
+ public static void Open()
+ {
+
+ }
+
+ public static void Int(int i, int n)
+ {
+ System.out.print(i);
+ }
+
+ public static void Real(float x, int n)
+ {
+ System.out.print(x);
+ }
+
+ public static void Ln()
+ {
+ System.out.println();
+ }
+}
index f0768d8b69d5d9fda94829c343d116d44a2b0e7f..497b99ed278453c093a55685c29b1ceae6b523e4 100644 (file)
void
oberon_generate_call_proc(oberon_context_t * ctx, oberon_expr_t * desig)
{
- jvm_generate_call_proc(ctx -> gen_context -> current_m -> class -> p, desig);
+ jvm_generate_call_proc(ctx -> mod -> gen_mod -> class -> p, desig);
}
void
diff --git a/src/test.c b/src/test.c
index 18417ba34fa6241d16ae44c53733960a57e2be91..5939fb6d50dd5dafe933c31cdab8e73a27d37b0d 100644 (file)
--- a/src/test.c
+++ b/src/test.c
static char source_test[] =
"(* Main module *)"
"MODULE Test;"
+ "IMPORT Out;"
"TYPE"
" P = PROCEDURE;"
" F = PROCEDURE (x : INTEGER) : INTEGER;"
" f := Pow;"
" i := f(7);"
" p;"
+ " Out.Open;"
+ " Out.Int(i, 0); Out.Ln;"
+ " Out.Int(666, 0); Out.Ln;"
"END Test."
;
+// PROCEDURE Char* (ch : CHAR);
+// PROCEDURE String* (str : ARRAY OF CHAR);
+// PROCEDURE Int* (i, n : LONGINT); // Должно быть в таком виде
+// PROCEDURE LongReal* (x : LONGREAL; n : INTEGER);
+
static char source_out[] =
"MODULE Out;"
-// "(* Interface to outer program ;) *)"
-// "VAR"
-// " Open- : PROCEDURE;"
-// " Char- : PROCEDURE(ch : CHAR);"
-// " String- : PROCEDURE(str : ARRAY OF CHAR)"
-// " Int- : PROCEDURE(i, n : LONGINT);"
-// " Int- : PROCEDURE(i, n : INTEGER);"
-// " Real- : PROCEDURE(x : REAL; n : INTEGER);"
-// " LongReal- : PROCEDURE(x : LONGREAL; n : INTEGER);"
-// " Ln- : PROCEDURE;"
+ " PROCEDURE Open*;"
+ " END Open;"
+ ""
+ " PROCEDURE Int*(i, n : INTEGER);"
+ " END Int;"
+ ""
+ " PROCEDURE Real*(x : REAL; n : INTEGER);"
+ " END Real;"
+ ""
+ " PROCEDURE Ln*;"
+ " END Ln;"
+ ""
"END Out."
;