mud++0.35/etc/
mud++0.35/etc/guilds/
mud++0.35/help/propert/
mud++0.35/mudC/
mud++0.35/player/
mud++0.35/src/interface/
mud++0.35/src/os/cygwin32/
mud++0.35/src/os/win32/
mud++0.35/src/os/win32/bcppbuilder/
mud++0.35/src/osaddon/
mud++0.35/src/util/
/*
....[@@@..[@@@..............[@.................. MUD++ is a written from
....[@..[@..[@..[@..[@..[@@@@@....[@......[@.... scratch multi-user swords and
....[@..[@..[@..[@..[@..[@..[@..[@@@@@..[@@@@@.. sorcery game written in C++.
....[@......[@..[@..[@..[@..[@....[@......[@.... This server is an ongoing
....[@......[@..[@@@@@..[@@@@@.................. development project.  All 
................................................ contributions are welcome. 
....Copyright(C).1995.Melvin.Smith.............. Enjoy. 
------------------------------------------------------------------------------
Melvin Smith (aka Fusion)         msmith@hom.net
MUD++ development mailing list    mudpp@van.ml.org
------------------------------------------------------------------------------
parse.h
*/

/* Structures and functions for managing parse tree for
   syntax directed transation. Much of this is right out of the
   'Red Dragon' book. -Melvin 
*/

#ifndef _PARSE_H
#define _PARSE_H

#include "sym.h"
#include <malloc.h>

#define OP_DEFINE				0x0001
#define OP_DECLARE				0x0002
#define OP_CALL					0x0004
#define OP_ID					0x0008
#define OP_CONSTANT				0x0010
 
typedef struct __node
{
	int		op;
	int		type;	
	union
	{
		char		cval;
		long		lval;
		float		fval;
		struct __node *	args;
	} u;

	struct __node *	left;
	struct __node *	right;
	sym *	sym_ptr;
} node;


#define malloc_node() (node *)malloc( sizeof( node ) )
#define calloc_node() (node *)calloc( 1, sizeof( node ) )
#define free_node( x ) free( x )

/* unit[] is an array of parse trees, each tree representing
   a block of code which can be generating by evaluating the
   tree unit[i] and emmitting intermediate code.
*/
node * unit[];

node * mknode( int, sym *, node *, node * );
node * mkleaf_id( int, sym * );
node * mkleaf_declaration( int, sym * );
node * mkleaf_constant_int( long );
node * mkleaf_constant_float( float );
node * mkleaf_statement( node *, node * );
node * mkleaf_function_def( int, sym *, node * );
node * add_leaf_right( node *, node * );

int cur_unit;
void emit_asm();
int emit_statement( node * );

#endif