summaryrefslogtreecommitdiff
path: root/minie
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2019-05-02 19:28:42 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2019-05-02 19:28:42 +0200
commitbb575ae3f8f560f0633c0fba5564161a15abf03f (patch)
tree1f1a2bdd16d6cd690b9fe65d81e6f71102200470 /minie
parent27e108db73c9c8d89fc5d15df73396abd7fa6a50 (diff)
downloadcompilertests-bb575ae3f8f560f0633c0fba5564161a15abf03f.tar.gz
compilertests-bb575ae3f8f560f0633c0fba5564161a15abf03f.tar.bz2
completly stuck in a rewrite in minie
Diffstat (limited to 'minie')
-rw-r--r--minie/DESIGN3
-rw-r--r--minie/TODOS4
-rw-r--r--minie/e2c.c34
3 files changed, 38 insertions, 3 deletions
diff --git a/minie/DESIGN b/minie/DESIGN
index a517964..1dabf9c 100644
--- a/minie/DESIGN
+++ b/minie/DESIGN
@@ -69,3 +69,6 @@ built on as many systems as possible. The goal is that N is self-hosting
using the toolchain of O.
Step 3: Write a native backend for N targetting system T'' or a for a simulator E(T'')
+
+TODO: Tombstone notation, can also be applied to more than just a compiler
+
diff --git a/minie/TODOS b/minie/TODOS
index d06e971..d57248d 100644
--- a/minie/TODOS
+++ b/minie/TODOS
@@ -279,8 +279,12 @@ set/bitset/enum
set: mutually exclusive
bitset: usable as switches, flags
+have a look at System/360 and how the grand-fathers and fathers did it:
+XPL/XCOM: strings af variable size with garbage collection
+
links
-----
https://hackernoon.com/considerations-for-programming-language-design-a-rebuttal-5fb7ef2fd4ba
https://en.wikibooks.org/wiki/Oberon/A2/Oberon.Strings.Mod
+https://en.wikipedia.org/wiki/Tombstone_diagram
diff --git a/minie/e2c.c b/minie/e2c.c
index 920c130..7ba88d5 100644
--- a/minie/e2c.c
+++ b/minie/e2c.c
@@ -1498,6 +1498,7 @@ static void procedureName( void )
static void procedureDeclaration( void )
{
+ char typeName[MAX_STRING_LEN];
char return_type[MAX_IDENT_LEN];
Symbol *symbol;
Type *funcType;
@@ -1527,10 +1528,37 @@ static void procedureDeclaration( void )
Abort( "Too many parameters in definition of procedure" );
}
identifier( );
- /* TODO from here */
- /* lookup types, define local variables as parameters */
- symbol->symbol.procedure.params[symbol->symbol.procedure.len]
+
+ /* NO: new way, remember all local names and types, eventually definiting
+ * new types. Then when entering the VAR section of the procedure, add
+ * the parameters as local variables BEFORE the definition of new locals!
+ */
+
+ /* define local variable of that type */
+ /* TODO: just in the case of a following block, otherwise we have a forward
+ * declaraition */
+ /* lookup types, define local variables as parameters */
+ /* define the procedure with pointers to eventually new (anonymous) types */
+
+ /* TODO from here */
+
+ /* new?
+ sprintf( typeName,
+
+ sprintf( typeName, "__array_%d_of_%s", num, ident );
+ type = get_type_symbol( current_scope, typeName );
+ if( type == NULL ) {
+ Symbol *symbol = insert_symbol( current_scope, typeName );
+ symbol->kind = SYMBOL_TYPE;
+ symbol->symbol.type.kind = TYPE_ARRAY;
+ symbol->symbol.type.type.array.len = num;
+ symbol->symbol.type.type.array.type = basicType;
+ type = &symbol->symbol.type;
+ }
+ */
+ symbol->symbol.procedure.params[symbol->symbol.procedure.len].kind = SYMBOL_TYPE;
+
funcType.details.function.params[funcType.details.function.len] = (Type *)( &funcType.details.function.data + sizeof( Type ) * funcType.details.function.len );
strncpy( funcType.details.function.params[funcType.details.function.len]->name, ident, MAX_IDENT_LEN );