[SCM] Lisaac compiler branch, master, updated. lisaac-0.12-554-g27bc073
Benoit Sonntag
sonntag at icps.u-strasbg.fr
Tue Dec 1 17:24:07 UTC 2009
The following commit has been merged in the master branch:
commit 27bc0736b47d328350a6bdac0536f84532159618
Author: Benoit Sonntag <sonntag at icps.u-strasbg.fr>
Date: Tue Dec 1 18:23:57 2009 +0100
section external bug ok
diff --git a/src/constant/character_cst.li b/src/constant/character_cst.li
index da65801..27feeb9 100644
--- a/src/constant/character_cst.li
+++ b/src/constant/character_cst.li
@@ -88,7 +88,7 @@ Section Public
- display buffer:STRING <-
(
buffer.add_last '\'';
- buffer.append text;
+ buffer.append text;
buffer.add_last '\'';
display_ref buffer;
);
diff --git a/src/dispatcher/node.li b/src/dispatcher/node.li
index f1928c1..f0eb0d4 100644
--- a/src/dispatcher/node.li
+++ b/src/dispatcher/node.li
@@ -271,7 +271,13 @@ Section Public
};
result
);
-
+
+ - genere buffer:STRING <-
+ (
+ "Genere NODE!\n".print;
+ crash;
+ );
+
Section NODE, DTA
diff --git a/src/lisaac.li b/src/lisaac.li
index aa332ca..5dc1a45 100644
--- a/src/lisaac.li
+++ b/src/lisaac.li
@@ -511,11 +511,7 @@ Section Private
TYPE_NULL.make_null;
TYPE_VOID.make_void;
TYPE_CONTEXT.make_context;
- TYPE_ID.make_type_id; // Pas utile !
- // Input.
- string_tmp.copy input_name;
- string_tmp.to_upper;
- type_input := ITM_TYPE_SIMPLE.get (ALIAS_STR.get string_tmp).to_run_for NULL.raw;
+ TYPE_ID.make_type_id; // Pas utile !
// Other prototype.
type_true := ITM_TYPE_STYLE.get (ALIAS_STR.prototype_true)
style (ALIAS_STR.keyword_expanded).to_run_for NULL.raw;
@@ -550,6 +546,10 @@ Section Private
type_gen := ALIAS_ARRAY(ITM_TYPE_MONO).alias type_gen;
type_n_a_n_a_character := ITM_TYPE_GENERIC.get (ALIAS_STR.prototype_native_array)
style NULL with type_gen.to_run_for NULL.raw;
+ // Input.
+ string_tmp.copy input_name;
+ string_tmp.to_upper;
+ type_input := ITM_TYPE_SIMPLE.get (ALIAS_STR.get string_tmp).to_run_for NULL.raw;
//
(debug_level_option != 0).if {
// Load for `print_char' and `die_with_code'
diff --git a/src/parser.li b/src/parser.li
index d479c11..87b085d 100644
--- a/src/parser.li
+++ b/src/parser.li
@@ -953,7 +953,9 @@ Section Private
};
last_section := SECTION_.get_name last_string;
(last_section.is_mapping).if {
- object.set_mapping;
+ object.set_mapping;
+ }.elseif {last_section.is_external} then {
+ object.set_external;
}.elseif {
(last_section.is_inherit_or_insert) &&
{object.last_slot != NULL} &&
diff --git a/src/profil.li b/src/profil.li
index d9abd10..373a7e3 100644
--- a/src/profil.li
+++ b/src/profil.li
@@ -413,6 +413,13 @@ Section Public
).if {
stat := stat | inlining_bit;
};
+ (
+ (is_external) &&
+ {argument_list.first != NULL} &&
+ {argument_list.first.ensure_count = 0}
+ ).if {
+ argument_list.put NULL to 0;
+ };
);
//
diff --git a/src/profil_list.li b/src/profil_list.li
index 6dd66dc..ce68f19 100644
--- a/src/profil_list.li
+++ b/src/profil_list.li
@@ -38,6 +38,8 @@ Section LISAAC
- life_limit:INTEGER;
+ - life_limit_base:INTEGER;
+
- current:INTEGER;
- swap i1:INTEGER with i2:INTEGER <-
@@ -50,9 +52,8 @@ Section LISAAC
- clean <-
(
reduce_profil := profil_list.upper >= life_limit;
- {profil_list.upper >= life_limit}.while_do {
- profil_list.last.remove;
- ! {profil_list.last.set_life_index (-1)};
+ {profil_list.upper >= life_limit}.while_do {
+ profil_list.last.remove;
profil_list.remove_last;
};
);
@@ -63,8 +64,17 @@ Section Public
- add p:PROFIL <-
(
- profil_list.add_last p;
- p.set_life_index (profil_list.upper);
+ (p.is_external).if {
+ profil_list.add_first p;
+ life_limit_base := life_limit_base + 1;
+ p.set_life_index (profil_list.lower);
+ (profil_list.lower+1).to (profil_list.upper) do { i:INTEGER;
+ profil_list.item i.set_life_index i;
+ };
+ } else {
+ profil_list.add_last p;
+ p.set_life_index (profil_list.upper);
+ };
);
- set_life p:PROFIL <-
@@ -134,7 +144,7 @@ Section Public
profil_list.item i.reset_recursive;
};
VARIABLE.update;
- life_limit := 0;
+ life_limit := life_limit_base;
PROFIL.set_mode_recursive TRUE;
profil_current := profil_slot := NULL;
list_current := NULL;
@@ -149,7 +159,7 @@ Section Public
- execute_pass <-
(
VARIABLE.update;
- life_limit := 0;
+ life_limit := life_limit_base;
profil_slot := NULL;
list_current := NULL;
list_main.execute;
diff --git a/src/profil_slot.li b/src/profil_slot.li
index 7a3659c..ec5e9a9 100644
--- a/src/profil_slot.li
+++ b/src/profil_slot.li
@@ -91,9 +91,8 @@ Section Public
+ item_lst:FAST_ARRAY(ITM_ARGUMENT);
+ result:FAST_ARRAY(WRITE);
+ tm:ITM_TYPE_MULTI;
- + ts:ITM_TYPE_MONO;
+ + ts:ITM_TYPE_MONO;
- PROFIL_LIST.add Self;
(is_graph).if {
set_call := HASHED_DICTIONARY(INTEGER,PROFIL).create;
set_back := HASHED_SET(PROFIL).create;
@@ -103,8 +102,10 @@ Section Public
} else {
name := ALIAS_STR.get_intern (s.name);
};
+
slot_code := s;
type_self := typ_self;
+ PROFIL_LIST.add Self;
//
list_current := LIST.create (s.position);
profil_current := profil_slot := Self;
@@ -150,11 +151,16 @@ Section Public
ts ?= s.result_type;
(ts != ITM_TYPE_SIMPLE.type_void).if {
typ := ts.to_run_for Self;
- result_list.add_last (typ.get (s.position) result 0);
+ result_list.add_last (typ.get (s.position) result 0);
+ (is_external).if {
+ result_list.last.set_ensure_count 1;
+ };
};
};
//
- result := write_argument call_lst;
+ (call_lst != NULL).if {
+ result := write_argument call_lst;
+ };
//
slot_code.create_code is_first;
//
diff --git a/src/type/prototype.li b/src/type/prototype.li
index dfa80db..ba88b43 100644
--- a/src/type/prototype.li
+++ b/src/type/prototype.li
@@ -88,6 +88,8 @@ Section Public
- init_slot_for typ:TYPE <-
( + cur:ITM_SLOT;
+ + slot:SLOT;
+ + slot_code:SLOT_CODE;
// Parent.
cur := first_slot;
@@ -98,12 +100,18 @@ Section Public
cur := cur.next;
};
// Mapping.
- (is_mapping).if {
+ ((is_mapping) || {is_external}).if {
{cur != NULL}.while_do {
- (cur.id_section.is_mapping).if {
- ? {cur.style = '+'};
+ ((cur.id_section.is_mapping) || {cur.id_section.is_external}).if {
typ.verify_itm_slot_parent cur;
- typ.slot_run.add_last (SLOT.create cur type typ);
+ slot := SLOT.create cur type typ;
+ typ.slot_run.add_last slot;
+ (cur.id_section.is_external).if {
+ slot_code ?= slot;
+ (slot_code != NULL).if {
+ slot_code.get_profil NULL self (typ.default);
+ };
+ };
};
cur := cur.next;
};
@@ -117,11 +125,18 @@ Section Public
+ type_style:STRING_CONSTANT; // Reference / Expanded / Strict.
+ is_mapping:BOOLEAN;
-
+
+ + is_external:BOOLEAN;
+
- set_mapping <-
(
is_mapping := TRUE;
);
+
+ - set_external <-
+ (
+ is_external := TRUE;
+ );
- set_type_style s:STRING_CONSTANT <-
(
diff --git a/src/variable/slot_code.li b/src/variable/slot_code.li
index 5b436ba..adaee60 100644
--- a/src/variable/slot_code.li
+++ b/src/variable/slot_code.li
@@ -64,92 +64,89 @@ Section Public
+ typ_list:TYPES_TMP;
+ pro_list:FAST_ARRAY(PROFIL_SLOT);
+ is_new:BOOLEAN;
-
- // Block Detect.
- j := args.lower;
- {(j <= args.upper) && {(typ = NULL) || {! typ.raw.is_block}}}.while_do {
- typ := args.item j.static_type;
- (typ.raw.is_block).if {
- typ_list := TYPES_TMP.new;
- args.item j.get_type typ_list;
- (typ_list.first = TYPE_NULL).if {
- (typ_list.count > 1).if {
- typ_block ?= typ_list.second;
- } else {
- typ := NULL;
- };
- } else {
- typ_block ?= typ_list.first;
- };
- typ_list.free;
- };
- j := j + 1;
- };
-
- (typ_block != NULL).if {
- pro_list := typ_block.profil_list;
- i := pro_list.lower;
- {(i <= pro_list.upper) && {result = NULL}}.while_do {
- pro := pro_list.item i;
- (
- (pro.slot = Self) && {
- (pro.type_self = NULL) || {pro.type_self == type_self}
- } // BSBS: il fo aussi tester les args comme plus bas...
- ).if {
- result := pro; // Rmq. : It's limit for dispatching (See...)
- };
- i := i + 1;
- };
-
- (result = NULL).if {
- result := PROFIL_SLOT.clone;
- result.set_context_sensitive;
- typ_block.profil_list.add_last result;
- is_new := TRUE;
- };
- } else {
- // Select classic Profil (no block).
- j := profil.lower;
- {(j <= profil.upper) && {result = NULL}}.while_do {
- pro := profil.item j;
- ((pro.type_self = NULL) || {pro.type_self == type_self}).if {
- result := pro;
- i := args.lower + 1;
- {(i <= args.upper) && {result != NULL}}.while_do {
- loc := pro.argument_list.item i;
- (
- (loc != NULL) && {loc.require_first != NULL} &&
- {args.item i.static_type != loc.require_first.value.static_type} &&
- {loc.type.raw != type_boolean}
- ).if {
- result := NULL;
- };
- i := i + 1;
+
+ (args = NULL).if {
+ // For auto-load external section.
+ result := PROFIL_SLOT.clone;
+ profil.add_last result;
+ is_new := TRUE;
+ } else {
+ // Block Detect.
+ j := args.lower;
+ {(j <= args.upper) && {(typ = NULL) || {! typ.raw.is_block}}}.while_do {
+ typ := args.item j.static_type;
+ (typ.raw.is_block).if {
+ typ_list := TYPES_TMP.new;
+ args.item j.get_type typ_list;
+ (typ_list.first = TYPE_NULL).if {
+ (typ_list.count > 1).if {
+ typ_block ?= typ_list.second;
+ } else {
+ typ := NULL;
+ };
+ } else {
+ typ_block ?= typ_list.first;
};
- };
- j := j + 1;
+ typ_list.free;
+ };
+ j := j + 1;
};
- (result = NULL).if {
- result := PROFIL_SLOT.clone;
- profil.add_last result;
- ((id_section.is_external) && {profil.count > 1}).if {
- semantic_error (position,"Polymorphic External slot is not possible.");
- };
- is_new := TRUE;
- } else {
- /*
- (name == "__infix_equal_equal").if {
- (type_self.raw.name == "STRING_CONSTANT").if {
- string_tmp.clear;
- typ := args.item 1.static_type;
- typ.display string_tmp;
- string_tmp.add_last '=';
- typ := pro.argument_list.item 1.type;
- typ.display string_tmp;
- string_tmp.add_last '\n';
- string_tmp.print;
+
+ (typ_block != NULL).if {
+ pro_list := typ_block.profil_list;
+ i := pro_list.lower;
+ {(i <= pro_list.upper) && {result = NULL}}.while_do {
+ pro := pro_list.item i;
+ (
+ (pro.slot = Self) && {
+ (pro.type_self = NULL) || {pro.type_self == type_self}
+ } // BSBS: il fo aussi tester les args comme plus bas...
+ ).if {
+ result := pro; // Rmq. : It s limit for dispatching (See...)
+ };
+ i := i + 1;
+ };
+
+ (result = NULL).if {
+ result := PROFIL_SLOT.clone;
+ result.set_context_sensitive;
+ typ_block.profil_list.add_last result;
+ is_new := TRUE;
+ };
+ } else {
+ // Select classic Profil (no block).
+ (id_section.is_external).if {
+ result := profil.first;
+ } else {
+ j := profil.lower;
+ {(j <= profil.upper) && {result = NULL}}.while_do {
+ pro := profil.item j;
+ ((pro.type_self = NULL) || {pro.type_self == type_self}).if {
+ result := pro;
+ i := args.lower + 1;
+ {(i <= args.upper) && {result != NULL}}.while_do {
+ loc := pro.argument_list.item i;
+ (
+ (loc != NULL) && {loc.require_first != NULL} &&
+ {args.item i.static_type != loc.require_first.value.static_type} &&
+ {loc.type.raw != type_boolean}
+ ).if {
+ result := NULL;
+ };
+ i := i + 1;
+ };
+ };
+ j := j + 1;
+ };
+ };
+ (result = NULL).if {
+ result := PROFIL_SLOT.clone;
+ profil.add_last result;
+ ((id_section.is_external) && {profil.count > 1}).if {
+ semantic_error (position,"Polymorphic External slot is not possible.");
};
- };*/
+ is_new := TRUE;
+ };
};
};
(is_new).if {
--
Lisaac compiler
More information about the Lisaac-commits
mailing list