Commit 6230aac8 authored by Philip Carns's avatar Philip Carns

remove generated files from repo

parent 3d42903f
......@@ -4,6 +4,16 @@
$(AM_V_GEN)$(LEX) --header-file=$(@:.c=.h) -o $(@:.h=.c) $< \
|| ( $(RM) $(basename $@).h $(basename $@).c ; exit 1)
#
# specific rule for codesparser generation; we want the header to land in
# the codes/ directory because it will be installed for use by other repos
src/iokernellang/codesparser.c codes/codesparser.h: src/iokernellang/codesparser.y
mkdir -p codes
@test "x$(bison_ok)" != "yes" || echo "*** WARNING *** Bison version might be too old"
$(AM_V_GEN)$(YACC) --defines=codes/codesparser.h -o src/iokernellang/codesparser.c $< \
|| ( $(RM) $(basename $@).h $(basename $@).c ; exit 1)
%.c %.h: %.y
@test "x$(bison_ok)" != "yes" || echo "*** WARNING *** Bison version might be too old"
$(AM_V_GEN)$(YACC) --defines=$(@:.c=.h) -o $(@:.h=.c) $< \
......
/* A Bison parser, made by GNU Bison 2.5. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
This program 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/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
INTEGER = 258,
VARIABLE = 259,
WHILE = 260,
IF = 261,
PRINT = 262,
WRITE = 263,
WRITEAT = 264,
WRITE_ALL = 265,
WRITEAT_ALL = 266,
READ = 267,
READAT = 268,
READ_ALL = 269,
READAT_ALL = 270,
SYNC = 271,
SLEEP = 272,
OPEN = 273,
CLOSE = 274,
DELETE = 275,
FLUSH = 276,
SEEK = 277,
EXIT = 278,
IFX = 279,
ELSE = 280,
NE = 281,
EQ = 282,
LE = 283,
GE = 284,
GETNUMGROUPS = 285,
GETGROUPID = 286,
GETCURTIME = 287,
GETGROUPSIZE = 288,
GETGROUPRANK = 289,
UMINUS = 290
};
#endif
/* Tokens. */
#define INTEGER 258
#define VARIABLE 259
#define WHILE 260
#define IF 261
#define PRINT 262
#define WRITE 263
#define WRITEAT 264
#define WRITE_ALL 265
#define WRITEAT_ALL 266
#define READ 267
#define READAT 268
#define READ_ALL 269
#define READAT_ALL 270
#define SYNC 271
#define SLEEP 272
#define OPEN 273
#define CLOSE 274
#define DELETE 275
#define FLUSH 276
#define SEEK 277
#define EXIT 278
#define IFX 279
#define ELSE 280
#define NE 281
#define EQ 282
#define LE 283
#define GE 284
#define GETNUMGROUPS 285
#define GETGROUPID 286
#define GETCURTIME 287
#define GETGROUPSIZE 288
#define GETGROUPRANK 289
#define UMINUS 290
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
/* Line 2068 of yacc.c */
#line 37 "src/iokernellang/codesparser.y"
int64_t iValue; /* integer value */
int64_t sIndex; /* symbol table index */
nodeType *nPtr; /* node pointer */
/* Line 2068 of yacc.c */
#line 128 "src/iokernellang/codesparser.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
typedef struct YYLTYPE
{
int first_line;
int first_column;
int last_line;
int last_column;
} YYLTYPE;
# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
# define YYLTYPE_IS_DECLARED 1
# define YYLTYPE_IS_TRIVIAL 1
#endif
#ifndef YYPUSH_DECLS
# define YYPUSH_DECLS
struct CodesIOKernel_pstate;
typedef struct CodesIOKernel_pstate CodesIOKernel_pstate;
enum { YYPUSH_MORE = 4 };
#if defined __STDC__ || defined __cplusplus
int CodesIOKernel_push_parse (CodesIOKernel_pstate *yyps, int yypushed_char, YYSTYPE const *yypushed_val, YYLTYPE const *yypushed_loc, CodesIOKernelContext * context);
#else
int CodesIOKernel_push_parse ();
#endif
#if defined __STDC__ || defined __cplusplus
CodesIOKernel_pstate * CodesIOKernel_pstate_new (void);
#else
CodesIOKernel_pstate * CodesIOKernel_pstate_new ();
#endif
#if defined __STDC__ || defined __cplusplus
void CodesIOKernel_pstate_delete (CodesIOKernel_pstate *yyps);
#else
void CodesIOKernel_pstate_delete ();
#endif
#endif
......@@ -102,15 +102,8 @@ AS_IF([test "x$enable_valgrind_clean" = "xyes"], [
AC_DEFINE([VALGRIND], [1], [If enabling valgrind-clean build])
])
#
# To reactivate rewriting of the codesparser.y file,
# uncomment next line.
#
# NOTE: this will force the latest bison for building,
# even when building from a dist.
#
#
dnl AC_CONFIG_FILES([src/iokernellang/codesparser.y])
AC_CONFIG_FILES([src/iokernellang/codesparser.y])
AC_CONFIG_FILES([Makefile])
......
......@@ -25,14 +25,14 @@ maintainer-clean-local::
src/modelconfig/configparser.h: src/modelconfig/configparser.y
src/modelconfig/configlex.h: src/modelconfig/configlex.l
BUILT_SOURCES += src/iokernellang/codesparser.h \
BUILT_SOURCES += codes/codesparser.h \
src/iokernellang/codesparser.c \
src/iokernellang/codeslexer.h \
codes/codeslexer.h
#src/iokernellang/codesparser.y: src/iokernellang/codesparser.y.in Makefile
src/iokernellang/codesparser.c src/iokernellang/codesparser.h: src/iokernellang/codesparser.y
src/iokernellang/codesparser.c codes/codesparser.h: src/iokernellang/codesparser.y
codes/codeslexer.h: src/iokernellang/codeslexer.h
mkdir -p codes
......
This diff is collapsed.
%{
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "codes/CodesIOKernelTypes.h"
#include "codes/CodesIOKernelContext.h"
/* prototypes */
nodeType *opr(int64_t oper, int64_t nops, ...);
nodeType *id(int64_t i);
nodeType *con(int64_t value);
void freeNode(nodeType *p);
int64_t ex(nodeType *p);
int64_t * sym = NULL; /* symbol table */
int64_t * var = NULL;
int * inst_ready = NULL;
int * group_rank = NULL;
int * group_size = NULL;
%}
/* start autogenerated code from CODES build system */
%pure-parser
%define api.push_pull "push"
/* end autogenerated code from CODES build system */
%name-prefix="CodesIOKernel_"
%locations
%defines
%error-verbose
%parse-param { CodesIOKernelContext * context }
%lex-param { void * scanner }
%union {
int64_t iValue; /* integer value */
int64_t sIndex; /* symbol table index */
nodeType *nPtr; /* node pointer */
};
%token <iValue> INTEGER
%token <sIndex> VARIABLE
%token WHILE IF PRINT
%token WRITE WRITEAT WRITE_ALL WRITEAT_ALL READ READAT READ_ALL READAT_ALL SYNC SLEEP OPEN CLOSE DELETE FLUSH SEEK EXIT
%nonassoc IFX
%nonassoc ELSE
%left GE LE EQ NE '>' '<'
%left '+' '-'
%left '*' '/' '%'
%left GETGROUPRANK GETGROUPSIZE GETCURTIME GETGROUPID GETNUMGROUPS
%nonassoc UMINUS
%type <nPtr> stmt expr stmt_list
%{
#include "codes/CodesIOKernelContext.h"
int CodesIOKernel_lex(YYSTYPE * lvalp, YYLTYPE * llocp, void * scanner);
void CodesIOKernel_error(YYLTYPE * locp, CodesIOKernelContext * context, const char * err)
{
fprintf(stderr, "%i error = %s\n", locp->first_line, err);
}
#define scanner context->scanner_
%}
%%
program:
function { /*exit(0)*/; }
;
function:
function stmt { ex($2); freeNode($2); }
| /* NULL */
;
stmt:
';' { $$ = opr(';', 2, NULL, NULL); }
| expr ';' { $$ = $1; }
| EXIT expr ';' { $$ = opr(EXIT, 1, $2); }
| PRINT expr ';' { $$ = opr(PRINT, 1, $2); }
| WRITE expr ',' expr ';' { $$ = opr(WRITE, 2, $2, $4); }
| WRITE_ALL expr ',' expr ';' { $$ = opr(WRITE_ALL, 2, $2, $4); }
| WRITEAT expr ',' expr ',' expr ';' { $$ = opr(WRITEAT, 3, $2, $4, $6); }
| WRITEAT_ALL expr ',' expr ',' expr ';' { $$ = opr(WRITEAT_ALL, 3, $2, $4, $6); }
| READ expr ',' expr ';' { $$ = opr(READ, 2, $2, $4); }
| READ_ALL expr ',' expr ';' { $$ = opr(READ_ALL, 2, $2, $4); }
| READAT expr ',' expr ',' expr ';' { $$ = opr(READAT, 3, $2, $4, $6 ); }
| READAT_ALL expr ',' expr ',' expr ';' { $$ = opr(READAT_ALL, 3, $2, $4, $6 ); }
| SYNC expr ';' { $$ = opr(SYNC, 1, $2); }
| SLEEP expr ';' { $$ = opr(SLEEP, 1, $2); }
| OPEN expr ';' { $$ = opr(OPEN, 1, $2); }
| CLOSE expr ';' { $$ = opr(CLOSE, 1, $2); }
| DELETE expr ';' { $$ = opr(DELETE, 1, $2); }
| FLUSH expr ';' { $$ = opr(FLUSH, 1, $2); }
| SEEK expr ',' expr ';' { $$ = opr(SEEK, 2, $2, $4); }
| VARIABLE '=' expr ';' { $$ = opr('=', 2, id($1), $3); }
| WHILE '(' expr ')' stmt { $$ = opr(WHILE, 2, $3, $5); }
| IF '(' expr ')' stmt %prec IFX { $$ = opr(IF, 2, $3, $5); }
| IF '(' expr ')' stmt ELSE stmt { $$ = opr(IF, 3, $3, $5, $7); }
| '{' stmt_list '}' { $$ = $2; }
;
stmt_list:
stmt { $$ = $1; }
| stmt_list stmt { $$ = opr(';', 2, $1, $2); }
;
expr:
INTEGER { $$ = con($1); }
| VARIABLE { $$ = id($1); }
| '-' expr %prec UMINUS { $$ = opr(UMINUS, 1, $2); }
| expr '+' expr { $$ = opr('+', 2, $1, $3); }
| expr '-' expr { $$ = opr('-', 2, $1, $3); }
| expr '*' expr { $$ = opr('*', 2, $1, $3); }
| expr '/' expr { $$ = opr('/', 2, $1, $3); }
| expr '%' expr { $$ = opr('%', 2, $1, $3); }
| expr '<' expr { $$ = opr('<', 2, $1, $3); }
| expr '>' expr { $$ = opr('>', 2, $1, $3); }
| expr GE expr { $$ = opr(GE, 2, $1, $3); }
| expr LE expr { $$ = opr(LE, 2, $1, $3); }
| expr NE expr { $$ = opr(NE, 2, $1, $3); }
| expr EQ expr { $$ = opr(EQ, 2, $1, $3); }
| GETGROUPRANK expr { $$ = opr(GETGROUPRANK, 1, $2); }
| GETGROUPSIZE expr { $$ = opr(GETGROUPSIZE, 1, $2); }
| GETCURTIME { $$ = opr(GETCURTIME, 0); }
| GETGROUPID { $$ = opr(GETGROUPID, 0); }
| GETNUMGROUPS { $$ = opr(GETNUMGROUPS, 0); }
| '(' expr ')' { $$ = $2; }
;
%%
#define SIZEOF_NODETYPE ((char *)&p->con - (char *)p)
nodeType * con(int64_t value)
{
nodeType *p;
size_t nodeSize;
/* allocate node */
nodeSize = SIZEOF_NODETYPE + sizeof(conNodeType);
if((p = malloc(nodeSize)) == NULL)
{
fprintf(stderr, "out of memory\n");
}
/* copy information */
p->type = typeCon;
p->con.value = value;
return p;
}
nodeType * id(int64_t i)
{
nodeType *p;
size_t nodeSize;
/* allocate node */
nodeSize = SIZEOF_NODETYPE + sizeof(idNodeType);
if((p = malloc(nodeSize)) == NULL)
{
fprintf(stderr, "out of memory\n");
}
/* copy information */
p->type = typeId;
p->id.i = i;
return p;
}
nodeType * opr(int64_t oper, int64_t nops, ...)
{
va_list ap;
nodeType *p;
size_t nodeSize;
int64_t i;
/* allocate node */
nodeSize = SIZEOF_NODETYPE + sizeof(oprNodeType) +
(nops - 1) * sizeof(nodeType*);
if ((p = malloc(nodeSize)) == NULL)
{
fprintf(stderr, "out of memory\n");
}
/* copy information */
p->type = typeOpr;
p->opr.oper = oper;
p->opr.nops = nops;
va_start(ap, nops);
for (i = 0; i < nops; i++)
{
p->opr.op[i] = va_arg(ap, nodeType*);
}
va_end(ap);
return p;
}
void freeNode(nodeType *p)
{
int64_t i;
if (!p)
{
return;
}
if(p->type == typeOpr)
{
for(i = 0; i < p->opr.nops; i++)
{
freeNode(p->opr.op[i]);
}
}
free(p);
}
......@@ -56,7 +56,7 @@ int * group_size = NULL;
%type <nPtr> stmt expr stmt_list
%{
#include "CodesIOKernelContext.h"
#include "codes/CodesIOKernelContext.h"
int CodesIOKernel_lex(YYSTYPE * lvalp, YYLTYPE * llocp, void * scanner);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment