Next Previous Contents

7. Appendix 2 - Example of SHILKA description file

/* Keywords of ANSI C. */
%import {
   struct keyword {int kw; int primitive_type_flag;};
   typedef struct keyword *keyword_t;
}
%type keyword_t
%%
if            {static struct keyword res = {KR_if, 0}; return &res;}
do            {static struct keyword res = {KR_do, 0}; return &res;}
int           {static struct keyword res = {KR_int, 1}; return &res;}
for           {static struct keyword res = {KR_for, 0}; return &res;}
case          {static struct keyword res = {KR_case, 0}; return &res;}
char     1600 {static struct keyword res = {KR_char, 1}; return &res;}
auto          {static struct keyword res = {KR_auto, 0}; return &res;}
goto          {static struct keyword res = {KR_goto, 0}; return &res;}
else     5700 {static struct keyword res = {KR_else, 0}; return &res;}
long          {static struct keyword res = {KR_long, 0}; return &res;}
void     8200 {static struct keyword res = {KR_void, 1}; return &res;}
enum          {static struct keyword res = {KR_void, 0}; return &res;}
float         {static struct keyword res = {KR_float, 1}; return &res;}
short         {static struct keyword res = {KR_short, 0}; return &res;}
union         {static struct keyword res = {KR_union, 0}; return &res;}
break         {static struct keyword res = {KR_break, 0}; return &res;}
while         {static struct keyword res = {KR_while, 0}; return &res;}
const         {static struct keyword res = {KR_const, 0}; return &res;}
double        {static struct keyword res = {KR_double, 0}; return &res;}
static   7300 {static struct keyword res = {KR_static, 0}; return &res;}
extern        {static struct keyword res = {KR_extern, 0}; return &res;}
struct        {static struct keyword res = {KR_struct, 0}; return &res;}
return   1000 {static struct keyword res = {KR_return, 0}; return &res;}
sizeof   1100 {static struct keyword res = {KR_sizeof, 0}; return &res;}
switch        {static struct keyword res = {KR_switch, 0}; return &res;}
signed        {static struct keyword res = {KR_signed, 0}; return &res;}
typedef       {static struct keyword res = {KR_typedef, 0}; return &res;}
default       {static struct keyword res = {KR_default, 0}; return &res;}
unsigned      {static struct keyword res = {KR_unsigned, 0}; return &res;}
continue      {static struct keyword res = {KR_continue, 0}; return &res;}
register      {static struct keyword res = {KR_register, 0}; return &res;}
volatile      {static struct keyword res = {KR_volatile, 0}; return &res;}
%other        {return NULL;}                                                  


Next Previous Contents