Skip to content

Add byte and short data types - #106

Merged
krimbopple merged 10 commits into
Team-X3D:mainfrom
MaxStar5:main
Oct 30, 2026
Merged

krimbopple merged 10 commits into
Team-X3D:mainfrom
MaxStar5:main

Conversation

@MaxStar5

Copy link
Copy Markdown
Contributor

The syntax is really similar to BlitzMax because I plan to expand it further by adding signed & unsigned variants of other data types.
And I plan to add other c++ data types like vectors & maps.

The syntax would probably look similar to this:

Type Player
     ...
End Type

Global Players:Vector[Player]
Global Map:unordered_map[string, string]

Players.push_back(...)
Map["..."] = "..."

Byte and short example:

Dim Short1:Short(65536)
Global Byte1:Byte[257]

Type Player
	Field Health:Short
	Field HasNVG:Byte
	Field HasArmor:Byte
End Type

Global Players.Player[1]
Players[0] = new Player
Players[0]\Health = -1
Players[0]\HasNVG = 300
Players[0]\HasArmor = 1000

Function Main:Byte()
	For i = 0 to 65536
		Short1(i) = i
	Next
	For i = 0 to 257
		Byte1[i] = i
	next
	
	Return -1
End Function

Global X:Byte = Main()

DebugLog X ; 255
DebugLog Short1(65536) ; 0
DebugLog Byte1[257] ; 1

DebugLog Players[0]\Health ; 65535
DebugLog Players[0]\HasNVG ; 44
DebugLog Players[0]\HasArmor ; 232

End

@krimbopple

Copy link
Copy Markdown
Collaborator

sus

@krimbopple

Copy link
Copy Markdown
Collaborator

I'm not at my main pc right now.. But this seems fairly buggy & I will probably work on fixing it alongside the LLVM implementation

@krimbopple krimbopple closed this Oct 30, 2026
@krimbopple krimbopple reopened this Oct 30, 2026
@krimbopple

Copy link
Copy Markdown
Collaborator

jarvis kill this man, anyway, will probably merge it into it's own branch and work on it from there

@Team-X3D Team-X3D deleted a comment from github-actions Bot Oct 30, 2026
@krimbopple
krimbopple merged commit 586c9f6 into Team-X3D:main Oct 30, 2026
5 checks passed
@MaxStar5

Copy link
Copy Markdown
Contributor Author

Types, globals, dims, arrays and locals work fine when i tested it. (x86 compiler)

@byte-chan byte-chan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suboptimal

Comment thread compiler/parser.cpp
case '$':toker->next(); return "$";
case '@':toker->next(); return "@";
case '.':toker->next(); return parseIdent();
case ':':toker->next(); return parseIdent();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This simple, innocent-looking change potentially breaks perfectly reasonable code like this:

MouseXSpeed : MouseYSpeed : MouseZSpeed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krimbopple please remove this line when you can

krimbopple added a commit that referenced this pull request Oct 30, 2026
MaxStar5 added a commit to MaxStar5/BlitzX3D that referenced this pull request Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants