summaryrefslogtreecommitdiff
path: root/minie
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2018-10-17 21:18:42 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2018-10-17 21:18:42 +0200
commit2244c65cdb0bfa2cc88ebe04cfdeba7349251f33 (patch)
tree0a352399ed07a8da54dd56fda7bfbad2b31d9a34 /minie
parenta68c1c8e9c4dcf834ca2e89ab4f73a3eaaeab28e (diff)
downloadcompilertests-2244c65cdb0bfa2cc88ebe04cfdeba7349251f33.tar.gz
compilertests-2244c65cdb0bfa2cc88ebe04cfdeba7349251f33.tar.bz2
fixed parameter lists in e2c, added a system.halt function
Diffstat (limited to 'minie')
-rw-r--r--minie/e2c.c4
-rw-r--r--minie/ec.e1
2 files changed, 5 insertions, 0 deletions
diff --git a/minie/e2c.c b/minie/e2c.c
index 6a78b0b..f1ba44b 100644
--- a/minie/e2c.c
+++ b/minie/e2c.c
@@ -407,6 +407,7 @@ static void prologue( void )
{
emitLn( "/* generated with e2c */" );
emitLn( "#include <stdio.h>" );
+ emitLn( "#include <stdlib.h>" );
}
static void init( void )
@@ -567,6 +568,7 @@ static void parameterList( void )
/* TODO: no VAR parameters, strictly pass-by-value */
expression( );
while( sym == S_comma ) {
+ emit( ", " );
sym = getSym( );
/* TODO: no VAR parameters, strictly pass-by-value */
expression( );
@@ -588,6 +590,8 @@ static void statement( void )
/* TODO: add internal function maps as symbols and procedures */
if( strcmp( varName, "system.writeln" ) == 0 ) {
emit( "printf( " );
+ } else if( strcmp( varName, "system.halt" ) == 0 ) {
+ emit( "exit( " );
} else {
emit( "%s( ", varName );
}
diff --git a/minie/ec.e b/minie/ec.e
index 24c15f5..b51559b 100644
--- a/minie/ec.e
+++ b/minie/ec.e
@@ -17,4 +17,5 @@ end
begin
prologue( );
epilogue( );
+ system.halt( 0 );
end