The template part of the new syntax! Gotta go transform all of stdlib and the tests now and see if any other bugs pop up

This commit is contained in:
Nathan Braswell
2015-05-09 03:13:40 -04:00
parent 08431aa748
commit c22cadeed7
10 changed files with 94 additions and 93 deletions

View File

@@ -1,10 +0,0 @@
#include "test_negative_number_unary.krak.h"
/**
* Variable Declarations
*/
/**
* Function Definitions
*/

View File

@@ -1,27 +0,0 @@
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
/**
* Plain Typedefs
*/
/**
* Import Includes
*/
/**
* Top Level C Passthrough
*/
/**
* Extern Variable Declarations
*/
/**
* Class Structs
*/
/**
* Function Prototypes
*/

View File

@@ -1,2 +0,0 @@
#!/bin/sh
cc -std=c99 test_negative_number_unary.krak.c -o test_negative_number_unary.krak

View File

@@ -18,5 +18,3 @@ fun main() : int {
return 0
}

View File

@@ -0,0 +1,3 @@
yeah new syntax: 7, 6
yeah new syntax: 6, 7
yeah new syntax: 7, 6

View File

@@ -0,0 +1,36 @@
typedef Swapper<T> {
fun doit(a: T*, b: T*) : void {
var temp: T = *a;
*a = *b;
*b = temp;
}
}
fun swap<T>(a: T*, b: T*) : void {
var temp: T = *a
*a = *b
*b = temp;
}
fun print2int(a: int, b: int) : void {
simple_passthrough(a = a, b = b::) """
printf("yeah new syntax: %d, %d\n", a, b);
"""
}
fun main() : int {
var i: int = 7;
var j: int = 6;
print2int(i,j)
swap<int>(&i, &j)
print2int(i,j)
var it: Swapper<int>
it.doit(&i,&j);
print2int(i,j)
return 0
}