Main Page   File List   File Members  

mc.c File Reference

#include <string.h>
#include <gtk/gtk.h>
#include "mc.h"
#include "class.h"
#include "variable.h"
#include "turtle.h"
#include "debug.h"

Functions

void mc_init (void)
void mc_free (void)
gboolean mc_beginning_procedure (gchar *name)
void mc_ending_procedure (void)
gboolean mc_add_proc_parameter (gchar *name)
s_class * mc_add_variable (var_locality_t locality, gchar *varname)
s_class * mc_add_variable_reference (gchar *varname)
s_class * mc_add_noarg_op (op_t op)
s_class * mc_add_unary_op (op_t op, struct s_class *arg)
s_class * mc_add_binary_op (op_t op, struct s_class *arg1, struct s_class *arg2)
void mc_update_branch (struct s_instr *instr, struct s_instr *dest)
s_proc * mc_find_procedure (gchar *name)

Variables

s_turtle my_turtle

Detailed Description

Author:
Guillaume Bour. 2002
Version:
0.1
Date:
01/02/2002
middle-code for the logo compiler.


Function Documentation

struct s_class* mc_add_binary_op op_t    op,
struct s_class *    arg1,
struct s_class *    arg2
 

Add a binary expression (i.e "a + b").

visibility :: public

Parameters:
op  the operation
arg1  the first argument
arg2  the second argument
Returns:
the resulting expression

struct s_class* mc_add_noarg_op op_t    op
 

Add a expression with no argument (i.e "CS").

visibility :: public

Parameters:
op  the operation
Returns:
the resulting expression

gboolean mc_add_proc_parameter gchar *    name
 

Adding a parameter to the current procedure.

visibility :: public

@remarks: 1. the parameters when the procedure will be call shall be in the same order 2. parameter names must be unique

Parameters:
name  the parameter name
Returns:
<none>

struct s_class* mc_add_unary_op op_t    op,
struct s_class *    arg
 

Add a unary expression (i.e "TD 10").

visibility :: public

Parameters:
op  the operation
arg  the argument
Returns:
the resulting expression

struct s_class* mc_add_variable var_locality_t    locality,
gchar *    varname
 

!!! FAUX (l-expr)

Adding a variable reference (i.e. used in a right-expression).

visibility :: public

@remarks: 1. we must check that the variable exist (local variable, global variable or parameter)

Parameters:
name  its name
Returns:
the mc-instruction

gboolean mc_beginning_procedure gchar *    name
 

Entering a new procedure.

visibility :: public

Remarks:
1. procedures aren't recursives 1. procedure name must be unique
Parameters:
name  the procedure name
Returns:
<true> if ok, <false> if a same-name procedure ever exist.

void mc_ending_procedure void   
 

Leaving the current procedure.

visibility :: public

@remarks: 1. the default procedure is the main one

Returns:
<none>

void mc_init void   
 

Freeing and reinitializing all middle-code informations.

visibility :: public

Remarks:
1. you must call this function before any code compilation
Returns:
<none>

void mc_update_branch struct s_instr *    instr,
struct s_instr *    dest
 

Update the destination of a branch instruction.

visibility :: public

@remarks: 1. the destination of a branch is the first argument of the branch instruction (the second is the optional condition)

Parameters:
instr  the instruction to update
dest  the destination
Returns:
<none>


Generated on Tue Aug 6 13:21:20 2002 for lafontaine by doxygen1.2.15