view src/expr.c @ 14:b28d7cb60779

checkpoint
author lost
date Thu, 23 Oct 2008 02:44:07 +0000
parents 05d4115b4860
children 1f598d89b9b0
line wrap: on
line source

/*
expr.c
Copyright © 2008 William Astle

This file is part of LWASM.

LWASM is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.

You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
*/

/*
This file contains implementations associated with the expression evaluator
used by LWASM.

*/

#include <malloc.h>

#define __expr_c_seen__
#include "expr.h"

LWVAL *lwval_construct_int(int value)
{
	LWVAL *v;
	
	v = malloc(sizeof(LWVAL));
	if (!v)
		return NULL;
	
	v -> lwval_type = LWVAL_TYPE_INT;
	v -> dt.lwval_int = value;
	
	return v;
}

void lwval_destroy(LWVAL *value)
{
	if (value)
		free(value);
}

// v1 + v2 -> v3, return v3
LWVAL *lwval_add(LWVAL *v1, LWVAL *v2, LWVAL *v3)
{
}

// v1 - v2 -> v3, return v3
LWVAL *lwval_sub(LWVAL *v1, LWVAL *v2, LWVAL *v3)
{
}

// v1 * v2 -> v3, return v3
LWVAL *lwval_mul(LWVAL *v1, LWVAL *v2, LWVAL *v3)
{
}

// v1 / v2 -> v3, return v3
LWVAL *lwval_div(LWVAL *v1, LWVAL *v2, LWVAL *v3)
{
}

// v1 % v2 -> v3, return v3
LWVAL *lwval_mod(LWVAL *v1, LWVAL *v2, LWVAL *v3)
{
}