# File: indent_test.mk
myCFLAGS := -Wall -g -fplan9-extensions
CFLAGS := $(filter-out $(myCFLAGS),$(CFLAGS)) $(myCFLAGS)
- LDLIBS:= libparser.o libscanner.o libmdcode.o -licuuc
+ myLDLIBS:= libparser.o libscanner.o libmdcode.o -licuuc
+ LDLIBS := $(filter-out $(myLDLIBS),$(LDLIBS)) $(myLDLIBS)
all :: itest
itest.c itest.h : indent_test.mdc parsergen libparser.o libscanner.o libmdcode.o
./md2c indent_test.mdc
itest: itest.c
- tests:: itest itest.code
+ demos:: itest itest.code
./itest itest.code
# indent: header
exit(0);
}
-
# indent: grammar
~~~~~~
| NEWLINE }
Block -> Open Statementlist Close ${ $0 = $<2; }$
| Open SimpleStatements } ${ $0 = $<2; }$
- | : Statementlist ${ $0 = $2; $2 = NULL; }$
+ | : Statementlist ${ $0 = $<2; }$
SimpleStatements -> SimpleStatements ; SimpleStatement ${
{
$0->left = $<1;
$0->right = $<3;
}$
- | Term ${ $0 = $1; $1 = NULL; }$
+ | Term ${ $0 = $<1; }$
Term -> Term * Factor ${
$0 = calloc(1, sizeof(struct expression));
$0->op = $2.txt;
$0->left = $<1;
$0->right = $<3;
}$
- | Factor ${ $0 = $1; $1 = NULL; }$
+ | Factor ${ $0 = $<1; }$
Factor -> IDENTIFIER ${
$0 = calloc(1, sizeof(struct expression));
$0->op = $1.txt;