scyther/src/tac.h

78 lines
1.2 KiB
C
Raw Normal View History

2004-04-23 11:58:43 +01:00
#ifndef TAC_H
#define TAC_H
#include "symbol.h"
2004-04-23 11:58:43 +01:00
/*
* TAC instructions
*/
enum tactypes
{
TAC_UNDEF,
TAC_SYM,
TAC_TUPLE,
TAC_ENCRYPT,
TAC_VAR,
TAC_CONST,
TAC_READ,
TAC_SEND,
TAC_CLAIM,
TAC_FUNC,
TAC_STRING,
TAC_ROLE,
TAC_PROTOCOL,
2006-07-27 11:44:12 +01:00
TAC_KNOWS,
TAC_RUN,
TAC_ROLEREF,
TAC_SECRET,
TAC_INVERSEKEYS,
TAC_UNTRUSTED,
TAC_COMPROMISED,
TAC_USERTYPE
};
2004-04-23 11:58:43 +01:00
2006-01-02 21:06:08 +00:00
//! Structure to hold the compilation tree nodes
2004-04-23 11:58:43 +01:00
struct tacnode
{
2006-01-02 21:06:08 +00:00
struct tacnode *next; //!< pointer to previous node
struct tacnode *prev; //!< pointer to next node
2004-04-23 11:58:43 +01:00
struct tacnode *allnext;
2006-01-02 21:06:08 +00:00
int op; //!< operator for this node
int lineno; //!< line number of parser location in the input file
2004-04-23 11:58:43 +01:00
union
{
Symbol sym;
struct tacnode *tac;
char *str;
int value;
} t1;
union
2004-04-23 11:58:43 +01:00
{
Symbol sym;
struct tacnode *tac;
char *str;
int value;
} t2;
2004-04-23 11:58:43 +01:00
union
{
Symbol sym;
struct tacnode *tac;
char *str;
int value;
} t3;
2004-04-23 11:58:43 +01:00
};
typedef struct tacnode *Tac;
void tacInit (void);
void tacDone (void);
Tac tacCreate (int op);
Tac tacSymb (char *s);
Tac tacJoin (int op, Tac t1, Tac t2, Tac t3);
Tac tacTuple (Tac taclist);
Tac tacCat (Tac t1, Tac t2);
void tacPrint (Tac t);
#endif