Skip to content

Commit

Permalink
Rename ebnf dialect to iso-ebnf.
Browse files Browse the repository at this point in the history
  • Loading branch information
katef committed Feb 24, 2018
1 parent 556dacf commit 94137d5
Show file tree
Hide file tree
Showing 17 changed files with 74 additions and 71 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ PREFIX ?= /usr/local
SUBDIR += src/bnf
SUBDIR += src/dot
SUBDIR += src/abnf
SUBDIR += src/ebnf
SUBDIR += src/iso-ebnf
SUBDIR += src/rbnf
SUBDIR += src/sid
SUBDIR += src/wsn
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ${BUILD}/bin/kgt: ${BUILD}/src/ast.o
${BUILD}/bin/kgt: ${BUILD}/src/main.o
${BUILD}/bin/kgt: ${BUILD}/src/xalloc.o

.for part in ${PART:Mbnf} ${PART:Mabnf} ${PART:Mebnf} ${PART:Mrbnf} \
.for part in ${PART:Mbnf} ${PART:Mabnf} ${PART:Miso-ebnf} ${PART:Mrbnf} \
${PART:Msid} ${PART:Mdot} ${PART:Mwsn} \
${PART:Mrrd} ${PART:Mrrdot} ${PART:Mrrdump} \
${PART:Mrrparcon} ${PART:Mrrta} ${PART:Mrrtext}
Expand Down
34 changes: 0 additions & 34 deletions src/ebnf/Makefile

This file was deleted.

19 changes: 0 additions & 19 deletions src/ebnf/io.h

This file was deleted.

34 changes: 34 additions & 0 deletions src/iso-ebnf/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.include "../../share/mk/top.mk"

SRC += src/iso-ebnf/lexer.c
SRC += src/iso-ebnf/parser.c
SRC += src/iso-ebnf/output.c

LEXER += src/iso-ebnf/lexer.lx
PARSER += src/iso-ebnf/parser.sid

PART += iso-ebnf

.for src in ${LEXER:Msrc/iso-ebnf/lexer.lx}
LX_CFLAGS.${src} += -b dyn -e lx_iso_ebnf_ -t TOK_
.endfor

.for parser in ${PARSER:Msrc/iso-ebnf/parser.sid}
ACT.${parser} = src/parser.act
.endfor

.for src in ${SRC:Msrc/iso-ebnf/lexer.c}
CFLAGS.${src} += -D LX_HEADER='"lexer.h"'
DFLAGS.${src} += -D LX_HEADER='"lexer.h"'
.endfor

.for src in ${SRC:Msrc/iso-ebnf/parser.c}
CFLAGS.${src} += -D FORM='iso_ebnf'
DFLAGS.${src} += -D FORM='iso_ebnf'
.endfor

.for src in ${SRC:Msrc/iso-ebnf/*.c}
${BUILD}/lib/iso-ebnf.o: ${BUILD}/${src:R}.o
${BUILD}/lib/iso-ebnf.opic: ${BUILD}/${src:R}.opic
.endfor

19 changes: 19 additions & 0 deletions src/iso-ebnf/io.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright 2014-2017 Katherine Flavel
*
* See LICENCE for the full copyright terms.
*/

#ifndef KGT_ISO_EBNF_IO_H
#define KGT_ISO_EBNF_IO_H

struct ast_rule;

struct ast_rule *
iso_ebnf_input(int (*f)(void *opaque), void *opaque);

void
iso_ebnf_output(const struct ast_rule *grammar);

#endif

File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/ebnf/output.c → src/iso-ebnf/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ output_rule(const struct ast_rule *rule)
}

void
ebnf_output(const struct ast_rule *grammar)
iso_ebnf_output(const struct ast_rule *grammar)
{
const struct ast_rule *p;

Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/ebnf/parser.sid → src/iso-ebnf/parser.sid
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
<add-rule-to-list>(r, l);
};

ebnf: () -> (l :ast_rule) = {
iso-ebnf: () -> (l :ast_rule) = {
l = list-of-rules;
EOF;
##
Expand All @@ -233,5 +233,5 @@

%entry%

ebnf;
iso-ebnf;

26 changes: 13 additions & 13 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "bnf/io.h"
#include "wsn/io.h"
#include "abnf/io.h"
#include "ebnf/io.h"
#include "iso-ebnf/io.h"
#include "rbnf/io.h"
#include "sid/io.h"
#include "dot/io.h"
Expand All @@ -37,18 +37,18 @@ struct io {
struct ast_rule *(*in)(int (*f)(void *), void *);
void (*out)(const struct ast_rule *);
} io[] = {
{ "bnf", bnf_input, bnf_output },
{ "wsn", wsn_input, wsn_output },
{ "abnf", abnf_input, NULL },
{ "ebnf", ebnf_input, ebnf_output },
{ "rbnf", rbnf_input, rbnf_output },
{ "sid", NULL, sid_output },
{ "dot", NULL, dot_output },
{ "rrdot", NULL, rrdot_output },
{ "rrdump", NULL, rrdump_output },
{ "rrparcon", NULL, rrparcon_output },
{ "rrta", NULL, rrta_output },
{ "rrtext", NULL, rrtext_output }
{ "bnf", bnf_input, bnf_output },
{ "wsn", wsn_input, wsn_output },
{ "abnf", abnf_input, NULL },
{ "iso-ebnf", iso_ebnf_input, iso_ebnf_output },
{ "rbnf", rbnf_input, rbnf_output },
{ "sid", NULL, sid_output },
{ "dot", NULL, dot_output },
{ "rrdot", NULL, rrdot_output },
{ "rrdump", NULL, rrdump_output },
{ "rrparcon", NULL, rrparcon_output },
{ "rrta", NULL, rrta_output },
{ "rrtext", NULL, rrtext_output }
};

enum io_dir {
Expand Down
3 changes: 3 additions & 0 deletions src/parser.act
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
/* XXX: get rid of this; use same %entry% for all grammars */
#define FORM_ENTRY CAT(prod_, FORM)

/* XXX: workaround for SID's identifier escaping */
#define prod_iso_Hebnf FORM_ENTRY

#include "parser.h"
#include "lexer.h"

Expand Down

0 comments on commit 94137d5

Please sign in to comment.