Merge pull request #99 from Servostar/98-implement-standard-type-definitons

added standard type definitions
This commit is contained in:
servostar 2024-05-25 08:05:59 +00:00 committed by GitHub
commit e934bdbda8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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"