summaryrefslogtreecommitdiff
path: root/yacc
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1995-06-18 14:47:57 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1995-06-18 14:47:57 +0000
commit09b2d4a5d5bc7175e6cffcada45ee063f911f1ca (patch)
tree9b1e6600f1fa21ef8b6e3704b1bfbf7601e1ef3c /yacc
parent9878bcbfc49deb21c779a2fe0e5734049ea03090 (diff)
downloadocaml-09b2d4a5d5bc7175e6cffcada45ee063f911f1ca.tar.gz
Suite au changement de representation des constructeurs constants,
on coupe le tableau transl en deux: transl_const et transl_block. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@47 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'yacc')
-rw-r--r--yacc/output.c11
-rw-r--r--yacc/reader.c6
-rw-r--r--yacc/skeleton.c3
3 files changed, 15 insertions, 5 deletions
diff --git a/yacc/output.c b/yacc/output.c
index 5ebc5b26ba..ff32462049 100644
--- a/yacc/output.c
+++ b/yacc/output.c
@@ -717,9 +717,16 @@ output_transl()
{
int i;
- fprintf(code_file, "let yytransl = [|\n");
+ fprintf(code_file, "let yytransl_const = [|\n");
for (i = 0; i < ntokens; i++) {
- if (symbol_true_token[i]) {
+ if (symbol_true_token[i] && symbol_tag[i] == NULL) {
+ fprintf(code_file, " %3d (* %s *);\n", symbol_value[i], symbol_name[i]);
+ }
+ }
+ fprintf(code_file, " 0|]\n\n");
+ fprintf(code_file, "let yytransl_block = [|\n");
+ for (i = 0; i < ntokens; i++) {
+ if (symbol_true_token[i] && symbol_tag[i] != NULL) {
fprintf(code_file, " %3d (* %s *);\n", symbol_value[i], symbol_name[i]);
}
}
diff --git a/yacc/reader.c b/yacc/reader.c
index 621f9ad8fc..80e9146f17 100644
--- a/yacc/reader.c
+++ b/yacc/reader.c
@@ -961,8 +961,10 @@ output_token_type()
fprintf(interface_file, " %c %s", n == 0 ? ' ' : '|', bp->name);
fprintf(output_file, " %c %s", n == 0 ? ' ' : '|', bp->name);
if (bp->tag) {
- fprintf(interface_file, " of %s", bp->tag);
- fprintf(output_file, " of %s", bp->tag);
+ /* Print the type expression in parentheses to make sure
+ that the constructor is unary */
+ fprintf(interface_file, " of (%s)", bp->tag);
+ fprintf(output_file, " of (%s)", bp->tag);
}
fprintf(interface_file, "\n");
fprintf(output_file, "\n");
diff --git a/yacc/skeleton.c b/yacc/skeleton.c
index 41ecb4e5c2..e7149dc051 100644
--- a/yacc/skeleton.c
+++ b/yacc/skeleton.c
@@ -10,7 +10,8 @@ char *define_tables[] =
{
"let yytables =",
" { actions=yyact;",
- " transl=yytransl;",
+ " transl_const=yytransl_const;",
+ " transl_block=yytransl_block;",
" lhs=yylhs;",
" len=yylen;",
" defred=yydefred;",