mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-19 17:23:02 +00:00
examples: add an example of a push parser
Add an example to demonstrate the use of push parser. I'm pleasantly surprised: parse.error=detailed works like a charm with push parsers. * examples/c/local.mk, examples/c/pushcalc/Makefile * examples/c/pushcalc/README.md, examples/c/pushcalc/calc.test, * examples/c/pushcalc/calc.y, examples/c/pushcalc/local.mk: New.
This commit is contained in:
28
examples/c/pushcalc/Makefile
Normal file
28
examples/c/pushcalc/Makefile
Normal file
@@ -0,0 +1,28 @@
|
||||
# This Makefile is designed to be simple and readable. It does not
|
||||
# aim at portability. It requires GNU Make.
|
||||
|
||||
BASE = calc
|
||||
BISON = bison
|
||||
XSLTPROC = xsltproc
|
||||
|
||||
all: $(BASE)
|
||||
|
||||
%.c %.h %.xml %.gv: %.y
|
||||
$(BISON) $(BISONFLAGS) --defines --xml --graph=$*.gv -o $*.c $<
|
||||
|
||||
$(BASE): $(BASE).o
|
||||
$(CC) $(CFLAGS) -o $@ $^
|
||||
|
||||
run: $(BASE)
|
||||
@echo "Type arithmetic expressions. Quit with ctrl-d."
|
||||
./$<
|
||||
|
||||
html: $(BASE).html
|
||||
%.html: %.xml
|
||||
$(XSLTPROC) $(XSLTPROCFLAGS) -o $@ $$($(BISON) --print-datadir)/xslt/xml2xhtml.xsl $<
|
||||
|
||||
CLEANFILES = \
|
||||
$(BASE) *.o $(BASE).[ch] $(BASE).output $(BASE).xml $(BASE).html $(BASE).gv
|
||||
|
||||
clean:
|
||||
rm -f $(CLEANFILES)
|
||||
Reference in New Issue
Block a user