added standard type definitions

This commit is contained in:
Sven Vogel 2024-05-25 09:59:38 +02:00
parent fc80e23917
commit ed008e0c7d
3 changed files with 71 additions and 0 deletions

25
lib/def/def.h Normal file
View File

@ -0,0 +1,25 @@
// Author: Sven Vogel
// Edited: 25.05.2024
// License: GPL-2.0
#ifndef GEMSTONE_STD_LIB_DEF_H_
#define GEMSTONE_STD_LIB_DEF_H_
#include <stdint.h>
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t i8;
typedef int16_t i16;
typedef int32_t i32;
typedef int64_t i64;
typedef float f32;
typedef double f64;
typedef u8* str;
#endif // GEMSTONE_STD_LIB_DEF_H_

34
lib/def/mod.gem Normal file
View File

@ -0,0 +1,34 @@
# Author: Sven Vogel
# Edited: 25.05.2024
# License: GPL-2.0
# ,----------------------------------------.
# | Standard Type definitions |
# `----------------------------------------`
# Unsigned integrals
type unsgined half half int: u8
type unsgined half int: u16
type unsgined int: u32
type unsgined double int: u64
type unsgined double double int: u128
# Signed integrals
type signed u8: i8
type signed u16: i16
type signed u32: i32
type signed u64: i64
type signed u128: i128
# IEEE-754 floating point
type signed half float: f16
type signed float: f32
type signed double float: f64
type signed double double float: f128
# String constant
type ref u8: str

12
lib/std.gem Normal file
View File

@ -0,0 +1,12 @@
# Author: Sven Vogel
# Edited: 25.05.2024
# License: GPL-2.0
# ,----------------------------------------.
# | Gemstone Standard Library |
# `----------------------------------------`
# standard type definitions
import "def/mod.gem"