New programming language - Relax

Introduction

Hello everyone, I am the author of the Relax programming language. I am currently developing RVM (RelaxVirtualMachine) AND Relasm (Relax Assembly). The first attempts to make my own language began at the end of the summer of 2020, then I did not even think what to make a language - it is so difficult. The Relax project itself began on December 30, 2020. A month and a half has passed, and you can already write something simple on it.





the first logo of the language
the first logo of the language

How do I compile the code?

, relasm .rasm, - - .ree. 3 : Relasm.exe, RelaxVM.exe, QtCore.dll. : https://github.com/UnbelievableDevelopmentCompany/RVM/tree/master/x64/Release

https://github.com/UnbelievableDevelopmentCompany/Relasm/tree/master/x64/Release





, 3 , PATH( ). cmd Relasm :





Relasm main.rasm program.ree
RelaxVM program.ree
      
      



relasm -, .





Relasm

Relasm?





mclass MainClass
method public static void MainClass.Main():
	.maxstack 1
	push.str "hello world"
	callm std static Relax.Console.Write(Relax.String)
      
      



- hello world! . , Main( ). . - , . , , 1. "hello world" . . , Relasm. .





, hello world, - .





mclass MainClass
method public static void MainClass.Main():
	.maxstack 2
	;  
	local firstNum Relax.Int32
	local secondNum Relax.Int32
	local result Relax.Int32
	local op Relax.String

	;   
	callm std static Relax.Console.Read()
	callm std static Relax.Converter.StringToInt32(Relax.String)
	set firstNum

	;   
	callm std static Relax.Console.Read()
	set op

	;   
	callm std static Relax.Console.Read()
	callm std static Relax.Converter.StringToInt32(Relax.String)
	set secondNum

	;    

	;   
	get op
	push.str "+"
	callm std instance Relax.String.operator==(Relax.String)
	jmpif opAdd

	;   
	get op
	push.str "-"
	callm std instance Relax.String.operator==(Relax.String)
	jmpif opSub

	;   
	get op
	push.str "*"
	callm std instance Relax.String.operator==(Relax.String)
	jmpif opMul

	;   
	get op
	push.str "/"
	callm std instance Relax.String.operator==(Relax.String)
	jmpif opDiv


	opAdd: ;  
	get firstNum
	get secondNum
	add
	set result
	jmp end

	opSub: ;  
	get secondNum
	get firstNum
	sub
	set result
	jmp end

	opMul: ;  
	get firstNum
	get secondNum
	mul
	set result
	jmp end

	opDiv: ;  
	get secondNum
	get firstNum
	div
	set result
	jmp end



	end: ;    
	push.str "\nResult: "
	callm std static Relax.Console.Write(Relax.String)
	get result
	callm std static Relax.Console.Write(Relax.Int32)
      
      



. . . . 2 , result end, .





.





mclass MainClass

method public static void MainClass.Main():
	.maxstack 2
	;       
	push.int32 10
	push.str "Result - "

	;  
	callm usr static MainClass.StringPlusInt32(Relax.String, Relax.Int32)

	;     
	callm std static Relax.Console.Write(Relax.String)


method public static Relax.String MainClass.StringPlusInt32(Relax.String str, Relax.Int32 num):
	.maxstack 2
	get num
	callm std static Relax.Converter.Int32ToString(Relax.Int32) ;    
	get str
	callm std instance Relax.String.Concat(Relax.String) ;    str  
	return ;  
      
      



StringPlusInt32 , , Relax.Converter.Int32ToString str , . return. Main .





Relax is only a month and a half, but he can already do that. It will develop for a long time. But even now it is possible to write simple console programs.





Virtual machine repository (relasm documentation is there) - https://github.com/UnbelievableDevelopmentCompany/RVM



Relasm compiler repository - https://github.com/UnbelievableDevelopmentCompany/Relasm



Package for sublime text 3 - RelasmST3Package








All Articles