Fun 0.41.5
The programming language that makes You have fun
Loading...
Searching...
No Matches
not.c File Reference

Implements the OP_NOT opcode for logical NOT in the VM. More...

Go to the source code of this file.

Functions

 free_value (v)
 push_value (vm, make_bool(res))

Variables

case OP_NOT
int res = !value_is_truthy(&v)
 break

Detailed Description

Implements the OP_NOT opcode for logical NOT in the VM.

This file handles the OP_NOT instruction, which performs a logical NOT operation on a boolean value. The value is popped from the stack, and the result is pushed back.

Behavior:

  • Pops a boolean value from the stack.
  • Performs a logical NOT operation.
  • Pushes the result (1 or 0) onto the stack.

Error Handling:

  • Exits with an error if the operand is not a boolean value.

Example: // Bytecode: OP_NOT // Stack before: [0] // Stack after: [1]

Definition in file not.c.

Function Documentation

◆ free_value()

free_value(v)

◆ push_value()

push_value(vm,
make_bool(res) )

Variable Documentation

◆ break

break

Definition at line 36 of file not.c.

◆ OP_NOT

case OP_NOT

Definition at line 31 of file not.c.

◆ res

int res = !value_is_truthy(&v)

Definition at line 33 of file not.c.