update docs, fix float jmp
This commit is contained in:
		
							parent
							
								
									457c77b6ab
								
							
						
					
					
						commit
						a741a0c992
					
				| 
						 | 
				
			
			@ -31,7 +31,7 @@
 | 
			
		|||
 | 
			
		||||
** Language Design
 | 
			
		||||
  - Strongly typed but with a friendly 'let' syntax.
 | 
			
		||||
  - =real= type (fixed point Q16.16 by default). 
 | 
			
		||||
  - =real= type (f32). 
 | 
			
		||||
  - =int= for integer numbers (i32).
 | 
			
		||||
  - =nat= for unsigned integer numbers (u32).
 | 
			
		||||
  - =byte= for interop (u8, i64, etc.).
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,12 +19,12 @@ typedef struct {
 | 
			
		|||
 | 
			
		||||
typedef enum {
 | 
			
		||||
  OP_HALT,           /* terminate execution */
 | 
			
		||||
  OP_LOADI,          /* loads an int from memory */
 | 
			
		||||
  OP_LOADU,          /* loads a uint from memory */
 | 
			
		||||
  OP_LOADF,          /* loads a float from memory */
 | 
			
		||||
  OP_STOREI,         /* stores a int to memory */
 | 
			
		||||
  OP_STOREU,         /* stores a uint to memory */
 | 
			
		||||
  OP_STOREF,         /* stores a float to memory */
 | 
			
		||||
  OP_LOADI,          /* dest = next memory location as int */
 | 
			
		||||
  OP_LOADU,          /* dest = next memory location as uint */
 | 
			
		||||
  OP_LOADF,          /* dest = next memory location as float */
 | 
			
		||||
  OP_STOREI,         /* next memory location = src1 as int */
 | 
			
		||||
  OP_STOREU,         /* next memory location = src1 as uint */
 | 
			
		||||
  OP_STOREF,         /* next memory location = src1 as float */
 | 
			
		||||
  OP_ADD_INT,        /* dest = src1 + src2  */
 | 
			
		||||
  OP_SUB_INT,        /* dest = src1 - src2  */
 | 
			
		||||
  OP_MUL_INT,        /* dest = src1 * src2  */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										8
									
								
								src/vm.c
								
								
								
								
							
							
						
						
									
										8
									
								
								src/vm.c
								
								
								
								
							| 
						 | 
				
			
			@ -139,16 +139,16 @@ uint32_t step_vm(VMFrame *frame, Value *memory) {
 | 
			
		|||
    COMPARE_AND_JUMP(int32_t, i, ==);
 | 
			
		||||
  }
 | 
			
		||||
  case OP_JGT_REAL: {
 | 
			
		||||
    COMPARE_AND_JUMP(int32_t, u, >);
 | 
			
		||||
    COMPARE_AND_JUMP(float, u, >);
 | 
			
		||||
  }
 | 
			
		||||
  case OP_JLT_REAL: {
 | 
			
		||||
    COMPARE_AND_JUMP(int32_t, u, <);
 | 
			
		||||
    COMPARE_AND_JUMP(float, u, <);
 | 
			
		||||
  }
 | 
			
		||||
  case OP_JGE_REAL: {
 | 
			
		||||
    COMPARE_AND_JUMP(int32_t, u, >=);
 | 
			
		||||
    COMPARE_AND_JUMP(float, u, >=);
 | 
			
		||||
  }
 | 
			
		||||
  case OP_JLE_REAL: {
 | 
			
		||||
    COMPARE_AND_JUMP(int32_t, u, <=);
 | 
			
		||||
    COMPARE_AND_JUMP(float, u, <=);
 | 
			
		||||
  }
 | 
			
		||||
  case OP_INT_TO_STRING: {
 | 
			
		||||
    int32_t a = (int32_t)frame->registers[src1].i;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue