Next batch, LLgen no longuer have warning under linux/clang.

This commit is contained in:
Manoel Trapier 2013-03-07 18:13:58 +01:00 committed by Manoël Trapier
parent d28368333a
commit f1cd17c51e
8 changed files with 103 additions and 189 deletions

View File

@ -84,13 +84,7 @@ extern LLnc_recover();
# include "assert.h"
# include "cclass.h"
# ifndef NORCSID
static string rcsid = "$Id$";
# endif
p_mem alloc(), ralloc();
string store();
p_gram search();
long ftell();
#include "LLgen.h"
static int acount; /* count #of global actions */
static p_term t_list;
@ -106,15 +100,9 @@ static int max_rules;
#define RULEINCR 32
/* Here are defined : */
STATIC newnorder();
STATIC newtorder();
STATIC mkalt();
STATIC mkterm();
STATIC p_gram copyrule();
/* and of course LLparse() */
STATIC
newnorder(index) {
STATIC void newnorder(int index) {
static int porder;
if (norder != -1) {
@ -125,8 +113,7 @@ newnorder(index) {
nonterms[porder].n_next = -1;
}
STATIC
newtorder(index) {
STATIC void newtorder(int index) {
static int porder;
if (torder != -1) {
@ -137,7 +124,7 @@ newtorder(index) {
tokens[porder].t_next = -1;
}
p_init()
void p_init()
{
alt_table = (p_gram )alloc(ALTINCR*sizeof(t_gram));
n_alts = 0;
@ -295,9 +282,9 @@ LL_NOSCANDONE(C_IDENT);
ff->ff_name = p;
ff->ff_next = start;
start = ff;
while (ff = ff->ff_next) {
while ((ff = ff->ff_next)) {
if (! strcmp(p, ff->ff_name)) {
error(linecount, "\"%s\" already used in a %%start", p);
error(linecount, "\"%s\" already used in a %%start", p, NULL);
break;
}
}
@ -313,7 +300,7 @@ LL_NOSCANDONE(C_IDENT);
{ if (!lexical) {
lexical = store(lextoken.t_string);
}
else error(linecount,"Duplicate %%lexical");
else error(linecount,"Duplicate %%lexical", NULL, NULL);
}
LLtdecr(24);
LL_NOSCANDONE(';');
@ -327,11 +314,11 @@ LL_NOSCANDONE(C_IDENT);
prefix = store(lextoken.t_string);
if (strlen(prefix) > 6) {
error(linecount,
"%%prefix too long");
"%%prefix too long", NULL, NULL);
prefix[6] = 0;
}
}
else error(linecount,"Duplicate %%prefix");
else error(linecount,"Duplicate %%prefix", NULL, NULL);
}
LLtdecr(24);
LL_NOSCANDONE(';');
@ -344,14 +331,14 @@ LL_NOSCANDONE(C_IDENT);
{
#ifdef NON_CORRECTING
if (non_corr) {
warning(linecount, "%%onerror conflicts with -n option");
warning(linecount, "%%onerror conflicts with -n option", NULL, NULL);
}
else
#endif
if (! onerror) {
onerror = store(lextoken.t_string);
}
else error(linecount,"Duplicate %%onerror");
else error(linecount,"Duplicate %%onerror", NULL, NULL);
}
LLtdecr(24);
LL_NOSCANDONE(';');
@ -407,7 +394,7 @@ LL_SAFE(C_IDENT);
p = &nonterms[g_getcont(temp)];
if (p->n_rule) {
error(linecount,
"Nonterminal %s already defined", lextoken.t_string);
"Nonterminal %s already defined", lextoken.t_string, NULL);
}
/*
* Remember the order in which the nonterminals
@ -441,7 +428,7 @@ LL_SAFE(C_PARAMS);
{ if (lextoken.t_num > 0) {
p->n_flags |= PARAMS;
if (lextoken.t_num > 15) {
error(linecount,"Too many parameters");
error(linecount,"Too many parameters", NULL, NULL);
}
else setntparams(p,lextoken.t_num);
}
@ -538,7 +525,7 @@ LL6_simpleproduction(
if (t & DEF) {
if (haddefault) {
error(n_lc,
"More than one %%default in alternation");
"More than one %%default in alternation", NULL, NULL);
}
haddefault = 1;
}
@ -569,7 +556,7 @@ break;
# line 282 "LLgen.g"
{ if (conflres & (COND|PREFERING|AVOIDING)) {
error(n_lc,
"Resolver on last alternative not allowed");
"Resolver on last alternative not allowed", NULL, NULL);
}
mkalt(*p,conflres,n_lc,&alt_table[n_alts++]);
altcnt++;
@ -585,7 +572,7 @@ LLtdecr(26);
# line 292 "LLgen.g"
{ if (conflres & (COND|PREFERING|AVOIDING)) {
error(o_lc,
"No alternation conflict resolver allowed here");
"No alternation conflict resolver allowed here", NULL, NULL);
}
/*
if (conflres & DEF) {
@ -604,8 +591,7 @@ goto L_3;
# line 306 "LLgen.g"
STATIC
mkalt(prod,condition,lc,res) p_gram prod; register p_gram res; {
STATIC void mkalt(p_gram prod, int condition, int lc, p_gram res) {
/*
* Create an alternation and initialise it.
*/
@ -759,7 +745,7 @@ LL_SAFE(C_ILLEGAL);
rule_table[n_rules++] =
*search(TERMINAL, "LLILLEGAL", BOTH);
if (*conflres & DEF) {
error(linecount, "%%illegal not allowed in %%default rule");
error(linecount, "%%illegal not allowed in %%default rule", NULL, NULL);
}
#endif
}
@ -877,7 +863,7 @@ goto L_10;
if ((q->t_flags & RESOLVER) &&
(kind == PLUS || kind == FIXED)) {
error(linecount,
"%%while not allowed in this term");
"%%while not allowed in this term", NULL, NULL);
}
/*
* A persistent fixed term is the same
@ -921,8 +907,7 @@ break;
# line 454 "LLgen.g"
STATIC
mkterm(prod,flags,lc,result) p_gram prod; register p_gram result; {
STATIC void mkterm(p_gram prod, int flags, int lc, p_gram result) {
/*
* Create a term, initialise it and return
* a grammar element containing it
@ -1086,7 +1071,7 @@ LL_SSCANDONE(C_IDENT);
if (erroneous) {
if (g_gettype(pres) != TERMINAL){
warning(linecount,
"Erroneous only allowed on terminal");
"Erroneous only allowed on terminal", NULL, NULL);
erroneous = 0;
}
else
@ -1124,11 +1109,11 @@ LLtdecr(6);
LL_SAFE(C_PARAMS);
# line 522 "LLgen.g"
{ if (lextoken.t_num > 15) {
error(linecount,"Too many parameters");
error(linecount,"Too many parameters", NULL, NULL);
} else g_setnpar(pres,lextoken.t_num);
if (g_gettype(pres) == TERMINAL) {
error(linecount,
"Terminal with parameters");
"Terminal with parameters", NULL, NULL);
}
}
LLread();
@ -1216,7 +1201,7 @@ LL_NOSCANDONE(C_IDENT);
ff = g_getsubparse(pres);
while (ff) {
if (ff->ff_nont == g_getcont(temp)) {
warning(linecount, "\"%s\" used twice in %%substart", lextoken.t_string);
warning(linecount, "\"%s\" used twice in %%substart", lextoken.t_string, NULL);
break;
}
ff = ff->ff_next;
@ -1348,7 +1333,7 @@ LL_SAFE(C_NUMBER);
# line 621 "LLgen.g"
{ *t = lextoken.t_num;
if (*t <= 0 || *t >= 8192) {
error(linecount,"Illegal number");
error(linecount,"Illegal number", NULL, NULL);
}
}
}

View File

@ -26,13 +26,7 @@
# include "assert.h"
# include "cclass.h"
# ifndef NORCSID
static string rcsid = "$Id$";
# endif
p_mem alloc(), ralloc();
string store();
p_gram search();
long ftell();
#include "LLgen.h"
static int acount; /* count #of global actions */
static p_term t_list;
@ -48,15 +42,9 @@ static int max_rules;
#define RULEINCR 32
/* Here are defined : */
STATIC newnorder();
STATIC newtorder();
STATIC mkalt();
STATIC mkterm();
STATIC p_gram copyrule();
/* and of course LLparse() */
STATIC
newnorder(index) {
STATIC void newnorder(int index) {
static int porder;
if (norder != -1) {
@ -67,8 +55,7 @@ newnorder(index) {
nonterms[porder].n_next = -1;
}
STATIC
newtorder(index) {
STATIC void newtorder(int index) {
static int porder;
if (torder != -1) {
@ -79,7 +66,7 @@ newtorder(index) {
tokens[porder].t_next = -1;
}
p_init()
void p_init()
{
alt_table = (p_gram )alloc(ALTINCR*sizeof(t_gram));
n_alts = 0;

View File

@ -92,7 +92,7 @@ void correct_prefix(void);
/* LLgen.c */
void newnorder(int index);
void newtorder(int index);
int p_init(void);
void p_init(void);
void LL0_spec(void);
void mkalt(p_gram prod, int condition, int lc, p_gram res);
void mkterm(p_gram prod, int flags, int lc, p_gram result);
@ -126,7 +126,7 @@ void copyfile(char *file);
void install(char *target, char *source);
/* name.c */
int name_init(void);
void name_init(void);
p_entry newentry(char * str, p_entry next);
char * store(char * s);
int hash(char * str);
@ -138,24 +138,24 @@ void reachable(p_nont p);
void reachwalk(p_gram p);
/* sets.c */
int setinit(int nt_needed);
void setinit(int nt_needed);
p_set get_set(void);
p_set setalloc(void);
int setunion(p_set a, p_set b);
int setintersect(p_set a, p_set b);
int setminus(p_set a, p_set b);
void setminus(p_set a, p_set b);
int setempty(p_set p);
int findindex(p_set set);
int setcount(p_set set, int *saved);
/* tokens.c */
void copyact(int ch1, int ch2, int flag, int level);
void copyact(char ch1, char ch2, int flag, int level);
int scanner(void);
int input(void);
int unput(int c);
int skipcomment(int flag);
void unput(int c);
void skipcomment(int flag);
char * vallookup(int s);
char * cpy(int s, char * p, int inserted);
int LLmessage(int d);
void LLmessage(int d);
#endif /* LLGEN_H */

View File

@ -17,6 +17,9 @@
* initialising routine.
*/
#include <stdlib.h>
#include <string.h>
# include "types.h"
# include "extern.h"
# include "assert.h"
@ -125,19 +128,19 @@ search(type,str,option) register string str; {
if (type == TERMINAL) {
error(linecount,
"%s: is already a nonterminal",
str);
str, NULL);
continue;
}
else if (type == NONTERM) {
error(linecount,
"%s : is already a token",
str);
str, NULL);
continue;
}
}
if (option==ENTERING) {
error(linecount,
"%s : is already defined",str);
"%s : is already defined",str, NULL);
}
p->h_type.g_lineno = linecount;
return &(p->h_type);
@ -180,7 +183,7 @@ search(type,str,option) register string str; {
val = '\\';
break;
default :
error(linecount,e_literal);
error(linecount,e_literal, NULL, NULL);
}
} else {
/*
@ -189,7 +192,7 @@ search(type,str,option) register string str; {
if (str[1] > '3' || str[1] < '0' ||
str[2] > '7' || str[2] < '0' ||
str[3] > '7' || str[3] < '0' ||
str[4] != '\0') error(linecount,e_literal);
str[4] != '\0') error(linecount,e_literal, NULL, NULL);
val = 64*str[1] - 73*'0' +
8*str[2] + str[3];
}
@ -198,7 +201,7 @@ search(type,str,option) register string str; {
* No escape in literal
*/
if (str[1] == '\0') val = str[0];
else error(linecount,e_literal);
else error(linecount,e_literal, NULL, NULL);
}
pt->t_tokno = val;
g_settype(&(p->h_type), LITERAL);

View File

@ -32,17 +32,15 @@
# include "assert.h"
# include "sets.h"
#include "LLgen.h"
#define LLALT 9999
static int nt_highest;
extern int nbytes;
extern p_mem alloc();
extern p_set start_firsts;
extern p_set setalloc();
extern p_gram search();
STATIC save_rule();
STATIC save_set();
STATIC void save_rule(p_gram p, int tail);
STATIC void save_set(p_set p);
/* t_list will contain terms to be `flattened' */
static struct t_list {
@ -69,7 +67,7 @@ static FILE *fgram;
used when LLgen called with -n -s options */
int act_nt;
save_grammar(f) FILE *f; {
void save_grammar(FILE *f) {
/*
* Save the grammar
*/
@ -131,7 +129,7 @@ save_grammar(f) FILE *f; {
if (! p->n_rule) { /* undefined */
f_input = p->n_string;
error(p->n_lineno,"Nonterminal %s not defined",
p->n_name);
p->n_name, NULL);
}
/* Save the first_set and follow set */
@ -244,7 +242,7 @@ save_grammar(f) FILE *f; {
if (check == 0)
warning((sub_list + i)->sub_action->g_lineno,
"\"%s\" is not a startsymbol",
(&nonterms[ff->ff_nont])->n_name);
(&nonterms[ff->ff_nont])->n_name, NULL);
}
save_set(temp_set);
save_set(temp_set);
@ -267,8 +265,7 @@ save_grammar(f) FILE *f; {
fprintf(fgram, "#define LLNNONTERMINALS %d\n", nt_highest - assval + 1);
}
STATIC
save_rule(p, tail) register p_gram p; int tail; {
STATIC void save_rule(p_gram p, int tail) {
/*
Walk through rule p, saving it. The non-terminal tail is
appended to the rule. It needs to be appended in this function
@ -363,8 +360,7 @@ save_rule(p, tail) register p_gram p; int tail; {
}
}
STATIC
save_set(p) p_set p; {
STATIC void save_set(p_set p) {
register int k;
register unsigned i;
int j;

View File

@ -16,34 +16,24 @@
* Set manipulation and allocation routines.
*/
#include <stdlib.h>
#include <stdio.h>
# include "types.h"
# include "extern.h"
# include "sets.h"
# include "assert.h"
# ifndef NORCSID
static string rcsid9 = "$Id$";
# endif
#include "LLgen.h"
/* In this file the following routines are defined: */
extern setinit();
extern p_set setalloc();
extern p_set get_set();
extern int setunion();
extern int setintersect();
extern setminus();
extern int setempty();
extern int findindex();
extern int setcount();
int nbytes;
static int setsize;
int tsetsize;
p_set *setptr, *maxptr;
static t_info set_info;
p_mem alloc();
setinit(nt_needed) {
void setinit(int nt_needed) {
/*
* Initialises some variables needed for setcomputations
*/
@ -61,8 +51,7 @@ setinit(nt_needed) {
set_info.i_incr = 20;
}
p_set
get_set() {
p_set get_set() {
/*
* Allocate a set that cannot be freed
*/
@ -80,8 +69,7 @@ get_set() {
return p;
}
p_set
setalloc() {
p_set setalloc() {
/*
* Allocate a set which can later be freed.
*/
@ -95,8 +83,7 @@ setalloc() {
return p;
}
int
setunion(a,b) register p_set a,b; {
int setunion(p_set a, p_set b) {
/*
* a = a union b.
* Return 1 if the set a changed
@ -115,8 +102,7 @@ setunion(a,b) register p_set a,b; {
return nsub;
}
int
setintersect(a,b) register p_set a,b; {
int setintersect(p_set a, p_set b) {
/*
* a = a intersect b.
* return 1 if the result is empty
@ -132,7 +118,7 @@ setintersect(a,b) register p_set a,b; {
return nempty;
}
setminus(a,b) register p_set a,b; {
void setminus(p_set a, p_set b) {
/*
* a = a setminus b
*/
@ -144,8 +130,7 @@ setminus(a,b) register p_set a,b; {
} while (--i);
}
int
setempty(p) register p_set p; {
int setempty(p_set p) {
/*
* Return 1 if the set p is empty
*/
@ -158,8 +143,7 @@ setempty(p) register p_set p; {
return 1;
}
int
findindex(set) p_set set; {
int findindex(p_set set) {
/*
* The set "set" will serve as a recovery set.
* Search for it in the table. If not present, enter it.
@ -204,8 +188,7 @@ findindex(set) p_set set; {
return nbytes * (maxptr++ - setptr);
}
int
setcount(set, saved) register p_set set; int *saved; {
int setcount(p_set set, int *saved) {
register int i, j;
for (j = 0, i = 0; i < ntokens; i++) {

View File

@ -15,6 +15,9 @@
#define LL_assert(x) /* nothing */
#endif
#include <stdio.h>
#include <string.h>
extern int LLsymb;
#define LL_SAFE(x) /* Nothing */
@ -83,23 +86,9 @@ extern LLnc_recover();
# include "assert.h"
# include "cclass.h"
# ifndef NORCSID
static string rcsidc = "$Id$";
# endif
#include "LLgen.h"
/* Here are defined : */
extern int scanner();
extern LLmessage();
extern int input();
extern unput();
extern skipcomment();
# ifdef LINE_DIRECTIVE
STATIC linedirective();
# endif
STATIC string cpy();
STATIC string vallookup();
STATIC copyact();
static int nparams;
# line 75 "tokens.g"
@ -144,8 +133,7 @@ static t_token savedtok; /* to save lextoken in case of an insertion */
static int nostartline; /* = 0 if at the start of a line */
# endif
STATIC
copyact(ch1,ch2,flag,level) char ch1,ch2; {
STATIC void copyact(char ch1, char ch2, int flag, int level) {
/*
* Copy an action to file f. Opening bracket is ch1, closing bracket
* is ch2.
@ -186,7 +174,7 @@ copyact(ch1,ch2,flag,level) char ch1,ch2; {
case ')':
case '}':
case ']':
error(linecount,"Parentheses mismatch");
error(linecount,"Parentheses mismatch", NULL, NULL);
break;
case '(':
text_seen = 1;
@ -217,7 +205,7 @@ copyact(ch1,ch2,flag,level) char ch1,ch2; {
text_seen = 0;
nparams++;
if (ch == ',' && (flag & 2)) {
warning(linecount, "Parameters may not be separated with a ','");
warning(linecount, "Parameters may not be separated with a ','", NULL, NULL);
ch = ';';
}
}
@ -238,7 +226,7 @@ copyact(ch1,ch2,flag,level) char ch1,ch2; {
ch = input();
}
if (ch == '\n') {
error(linecount,"Newline in string");
error(linecount,"Newline in string", NULL, NULL);
unput(match);
}
putc(ch,f);
@ -246,7 +234,7 @@ copyact(ch1,ch2,flag,level) char ch1,ch2; {
if (ch == match) break;
/* Fall through */
case EOF :
if (!level) error(saved,"Action does not terminate");
if (!level) error(saved,"Action does not terminate", NULL, NULL);
strip_grammar = sav_strip;
return;
default:
@ -256,7 +244,7 @@ copyact(ch1,ch2,flag,level) char ch1,ch2; {
}
}
scanner() {
int scanner() {
/*
* Lexical analyser, what else
*/
@ -306,7 +294,7 @@ scanner() {
for (;;) {
ch = input();
if (ch == '\n' || ch == EOF) {
error(linecount,"Missing '");
error(linecount,"Missing '", NULL, NULL);
break;
}
if (ch == '\'') break;
@ -370,7 +358,7 @@ scanner() {
}
w++;
}
error(linecount,"Illegal reserved word");
error(linecount,"Illegal reserved word", NULL, NULL);
}
lextoken.t_string = ltext;
return C_IDENT;
@ -381,13 +369,13 @@ scanner() {
static int backupc; /* for unput() */
static int nonline; /* = 1 if last char read was a newline */
input() {
int input() {
/*
* Low level input routine, used by all other input routines
*/
register c;
if (c = backupc) {
if ((c = backupc)) {
/* Last char was "unput()". Deliver it again
*/
backupc = 0;
@ -412,14 +400,14 @@ input() {
return c;
}
unput(c) {
void unput(int c) {
/*
* "unread" c
*/
backupc = c;
}
skipcomment(flag) {
void skipcomment(int flag) {
/*
* Skip comment. If flag != 0, the comment is inside a fragment
* of C-code, so keep it.
@ -428,7 +416,7 @@ skipcomment(flag) {
int saved; /* line count on which comment starts */
saved = linecount;
if (input() != '*') error(linecount,"Illegal comment");
if (input() != '*') error(linecount,"Illegal comment", NULL, NULL);
if (flag) putc('*', fact);
do {
ch = input();
@ -439,12 +427,11 @@ skipcomment(flag) {
if (ch == '/') return;
}
} while (ch != EOF);
error(saved,"Comment does not terminate");
error(saved,"Comment does not terminate", NULL, NULL);
}
# ifdef LINE_DIRECTIVE
STATIC
linedirective() {
STATIC void linedirective() {
/*
* Read a line directive
*/
@ -461,7 +448,7 @@ linedirective() {
ch = input();
} while (ch != '\n' && c_class[ch] != ISDIG);
if (ch == '\n') {
error(linecount,s_error);
error(linecount, s_error, NULL, NULL);
return;
}
i = 0;
@ -476,7 +463,7 @@ linedirective() {
*c++ = ch = input();
} while (ch != '"' && ch != '\n');
if (ch == '\n') {
error(linecount,s_error);
error(linecount, s_error, NULL, NULL);
return;
}
*--c = '\0';
@ -492,8 +479,7 @@ linedirective() {
}
# endif
STATIC string
vallookup(s) {
STATIC string vallookup(int s) {
/*
* Look up the keyword that has token number s
*/
@ -506,8 +492,7 @@ vallookup(s) {
return 0;
}
STATIC string
cpy(s,p,inserted) register string p; {
STATIC string cpy(int s, char *p, int inserted) {
/*
* Create a piece of error message for token s and put it at p.
* inserted = 0 if the token s was deleted (in which case we have
@ -577,9 +562,7 @@ cpy(s,p,inserted) register string p; {
return p;
}
string strcpy();
LLmessage(d) {
void LLmessage(int d) {
/*
* d is either 0, in which case the current token has been deleted,
* or non-zero, in which case it represents a token that is inserted
@ -621,7 +604,7 @@ LLmessage(d) {
#ifdef LLNONCORR
else
#endif
error(linecount, "%s", buf);
error(linecount, "%s", buf, NULL);
/* Don't change this line to
* error(linecount, buf).
* The string in "buf" might contain '%' ...

View File

@ -24,23 +24,6 @@
# include "assert.h"
# include "cclass.h"
# ifndef NORCSID
static string rcsidc = "$Id$";
# endif
/* Here are defined : */
extern int scanner();
extern LLmessage();
extern int input();
extern unput();
extern skipcomment();
# ifdef LINE_DIRECTIVE
STATIC linedirective();
# endif
STATIC string cpy();
STATIC string vallookup();
STATIC copyact();
static int nparams;
}
/* Classes */
@ -114,8 +97,7 @@ static t_token savedtok; /* to save lextoken in case of an insertion */
static int nostartline; /* = 0 if at the start of a line */
# endif
STATIC
copyact(ch1,ch2,flag,level) char ch1,ch2; {
STATIC void copyact(char ch1, char ch2, int flag, int level) {
/*
* Copy an action to file f. Opening bracket is ch1, closing bracket
* is ch2.
@ -226,7 +208,7 @@ copyact(ch1,ch2,flag,level) char ch1,ch2; {
}
}
scanner() {
int scanner() {
/*
* Lexical analyser, what else
*/
@ -351,11 +333,11 @@ scanner() {
static int backupc; /* for unput() */
static int nonline; /* = 1 if last char read was a newline */
input() {
int input() {
/*
* Low level input routine, used by all other input routines
*/
register c;
int c;
if (c = backupc) {
/* Last char was "unput()". Deliver it again
@ -382,14 +364,14 @@ input() {
return c;
}
unput(c) {
void unput(c) {
/*
* "unread" c
*/
backupc = c;
}
skipcomment(flag) {
void skipcomment(flag) {
/*
* Skip comment. If flag != 0, the comment is inside a fragment
* of C-code, so keep it.
@ -413,8 +395,7 @@ skipcomment(flag) {
}
# ifdef LINE_DIRECTIVE
STATIC
linedirective() {
STATIC void linedirective() {
/*
* Read a line directive
*/
@ -462,8 +443,7 @@ linedirective() {
}
# endif
STATIC string
vallookup(s) {
STATIC string vallookup(s) {
/*
* Look up the keyword that has token number s
*/
@ -476,8 +456,7 @@ vallookup(s) {
return 0;
}
STATIC string
cpy(s,p,inserted) register string p; {
STATIC string cpy(int s,string p, int inserted) {
/*
* Create a piece of error message for token s and put it at p.
* inserted = 0 if the token s was deleted (in which case we have
@ -547,9 +526,7 @@ cpy(s,p,inserted) register string p; {
return p;
}
string strcpy();
LLmessage(d) {
void LLmessage(int d) {
/*
* d is either 0, in which case the current token has been deleted,
* or non-zero, in which case it represents a token that is inserted