...
This commit is contained in:
@@ -1,5 +1,16 @@
|
||||
import c;
|
||||
|
||||
global func main() {
|
||||
printf("something %s\n", "your mom");
|
||||
struct Human {
|
||||
age: i64;
|
||||
name: string;
|
||||
}
|
||||
|
||||
global func main() {
|
||||
me = new Human
|
||||
{
|
||||
age = 21;
|
||||
name = "Oliver";
|
||||
};
|
||||
|
||||
printf("My name is %s and i am %d years old\n", me.name, me.age);
|
||||
}
|
||||
@@ -42,9 +42,11 @@ public class Generator
|
||||
return _builder.ToString();
|
||||
}
|
||||
|
||||
private string QbeTypeName(NubType type)
|
||||
private static string QbeTypeName(NubType type)
|
||||
{
|
||||
if (type is NubPrimitiveType primitiveType)
|
||||
switch (type)
|
||||
{
|
||||
case NubPrimitiveType primitiveType:
|
||||
{
|
||||
switch (primitiveType.Kind)
|
||||
{
|
||||
@@ -69,13 +71,22 @@ public class Generator
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
case NubCustomType nubCustomType:
|
||||
{
|
||||
return "l";
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int QbeTypeSize(NubType type)
|
||||
private static int QbeTypeSize(NubType type)
|
||||
{
|
||||
if (type is NubPrimitiveType primitiveType)
|
||||
switch (type)
|
||||
{
|
||||
case NubPrimitiveType primitiveType:
|
||||
{
|
||||
switch (primitiveType.Kind)
|
||||
{
|
||||
@@ -100,9 +111,16 @@ public class Generator
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
case NubCustomType nubCustomType:
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void GenerateFuncDefinition(LocalFuncDefinitionNode node)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user