summaryrefslogtreecommitdiff
path: root/minie
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2019-01-02 11:47:34 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2019-01-02 11:47:34 +0100
commitcab9a1bc807f4f119292a5d797dda471c668942d (patch)
tree2329e9cd9d754b81c44d8d0fd9bf3bceb4498290 /minie
parent41193613bdfd1dfba58a8153ae3c29711829e7d6 (diff)
downloadcompilertests-cab9a1bc807f4f119292a5d797dda471c668942d.tar.gz
compilertests-cab9a1bc807f4f119292a5d797dda471c668942d.tar.bz2
various small fixes
Diffstat (limited to 'minie')
-rwxr-xr-xminie/build.sh3
-rw-r--r--minie/e2c.c24
2 files changed, 9 insertions, 18 deletions
diff --git a/minie/build.sh b/minie/build.sh
index 56f0190..b039017 100755
--- a/minie/build.sh
+++ b/minie/build.sh
@@ -4,8 +4,7 @@ set -e
gcc -m32 -g -O0 -Wall -pedantic -std=c89 -Wno-return-type -o e2c e2c.c
tcc -o e2c e2c.c
-# broken, at least on ArchLinux and CVS version
-#pcc -o e2c e2c.c
+pcc -Wall -O0 -g -D__float128="long double" -o e2c e2c.c
clang -O0 -Wall -pedantic -std=c89 -Wno-return-type -o e2c e2c.c
./e2c < test1.e
set +e
diff --git a/minie/e2c.c b/minie/e2c.c
index b98c253..3a24f81 100644
--- a/minie/e2c.c
+++ b/minie/e2c.c
@@ -13,7 +13,8 @@ enum {
MAX_STRING_LEN = 64,
MAX_SYMBOLS = 32,
MAX_RECORD_MEMBERS = 8,
- MAX_PARAMETERS = 4
+ MAX_PARAMETERS = 4,
+ MAX_TYPE_DATA_SIZE = 128
};
/* SCANNER */
@@ -271,11 +272,6 @@ static Symbol getSym( void )
{
next:
skipWhite( );
- /*
- num = 0;
- ident[0] = '\0';
- str[0] = '\0';
- */
switch( look ) {
case '0':
case '1':
@@ -528,21 +524,21 @@ static BasicType strToBasicType( char *name )
}
typedef struct Type Type;
-
+
typedef struct ArrayType {
- char data[128];
+ char data[MAX_TYPE_DATA_SIZE];
Type *type;
int len;
} ArrayType;
typedef struct RecordType {
- char data[128*MAX_RECORD_MEMBERS];
+ char data[MAX_TYPE_DATA_SIZE*MAX_RECORD_MEMBERS];
struct Type *type[MAX_RECORD_MEMBERS];
int len;
} RecordType;
typedef struct FunctionType {
- char data[128*MAX_PARAMETERS];
+ char data[MAX_TYPE_DATA_SIZE*MAX_PARAMETERS];
struct Type *params[MAX_PARAMETERS];
struct Type *return_value;
int len;
@@ -1171,12 +1167,10 @@ static void variableDeclaration( void )
emitLn( "static %s %s[%d];",
basicTypeToCType( lastType.details.array.type->type ),
varName, num );
-/* emitLn( "static %s %s[%d];", typeName, varName, num );*/
} else {
emitLn( "static %s %s;",
basicTypeToCType( lastType.type ),
varName );
-/* emitLn( "static %s %s;", typeName, varName ); */
}
}
@@ -1245,10 +1239,7 @@ static void procedureDeclaration( void )
Expect( S_rparen );
if( sym == S_colon ) {
sym = getSym( );
- type( );
- /* TODO: handle more than just simple types here, or
- * do we only have VAR parameters vor complex types
- * because we run into allocation issues otherwise? */
+ simpleType( );
strncpy( return_type,
basicTypeToCType( lastType.type ),
MAX_IDENT_LEN );
@@ -1318,6 +1309,7 @@ static void importBlock( void )
sym = getSym( );
while( sym == S_comma ) {
identifier( );
+ sym = getSym( );
handleImport( );
sym = getSym( );
}