Skip to content

ramsy0dev/manv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

ManV, an other compiled programming language intended for writing algorithms.

Development plan

  • Make ManV a compiled language (By generating assembly code)
  • Implement Constant/Variable declaration
  • Implement basic math operations (mul, div, add, sub)
  • Implement syscall keyword for interacting the system
  • Implement basic pointers
  • Implement binary operations like right shift, left shift ...etc
  • Implement memory manipulation
  • Implement if-else conditions
  • Implement while loops
  • Implement functions
  • Implement the 'include' keyword
  • Write the ManV stdlib
  • Port some C libraries (raylib) to ManV

Syntax

  • Basic data types

int         // Integer type
float       // Float type
str         // String sequence
array       // Arrays
  • Declare variables

int x = 1;
float y = 0.1;
int c;

// If we want to increase or decrease the variable's size
// we do the following:

size_inc x, 10;  // Increase the size by 10
size_dec y, 10; // Decrease the size by 10

// To empty or delete a variable from memory
emt x // Empty the variable x from its value
del x // Delete the variable x from memory
  • Basic operations

int x = 10;
int y = 2;

int mul_res: int;
int add_res: int;
float div_res: float;
int sub_res: int;

mul (x, y) into mul_res;     // Multiplication
add (x, y) into add_res;     // Addition
div (x, y) into div_res;     // Division
sub (x, y) into sub_res;     // Subtraction
  • Pointers

to create a pointer, you can use the ptr keyword:

int* x;

pointers passing law:

manv assembly
text [text]
&text text
*text [[text]]
  • Direct syscalls

ManV provides a keyword called syscall which you can use to directly make syscalls. the syntax for syscall is the following:

syscall SYS_NUM *args, ERR $ERR;

An example usage, this is a simple call to sys_exit:

int sys_exit = 60;       // sys_exit
int exit_ok int = 0;     // Exit code 0
int errVar;              // Error reporting

syscall sys_exit exit_ok, ERR errVar;

  • if-else condition

Conditions in ManV work the same in any other language.

int x = 10;
int errVar;

if (x == 10) {
    syscall 1 1 "Hello World" 11, ERR errVar;
}

About

An other compiled programming language.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published