nobase_dist_doc_DATA += examples/netconf/comments.json
nobase_dist_doc_DATA += examples/netconf/simple-dhcp4.json
nobase_dist_doc_DATA += examples/netconf/simple-dhcp6.json
+
+grammar:
+if GENERATE_DOCS
+if GENERATE_PARSER
+ mkdir $(abs_top_srcdir)/doc/sphinx/grammar
+ $(abs_top_srcdir)/tools/extract_bnf.sh $(abs_top_srcdir)/src/bin/dhcp4/dhcp4_parser > $(abs_top_srcdir)/doc/sphinx/grammar/grammar-dhcp4-parser.txt
+ $(abs_top_srcdir)/tools/extract_bnf.sh $(abs_top_srcdir)/src/bin/dhcp6/dhcp6_parser > $(abs_top_srcdir)/doc/sphinx/grammar/grammar-dhcp6-parser.txt
+ $(abs_top_srcdir)/tools/extract_bnf.sh $(abs_top_srcdir)/src/bin/d2/d2_parser > $(abs_top_srcdir)/doc/sphinx/grammar/grammar-d2-parser.txt
+ $(abs_top_srcdir)/tools/extract_bnf.sh $(abs_top_srcdir)/src/bin/agent/agent_parser > $(abs_top_srcdir)/doc/sphinx/grammar/grammar-ca-parser.txt
+ $(abs_top_srcdir)/tools/extract_bnf.sh $(abs_top_srcdir)/src/bin/netconf/netconf_parser > $(abs_top_srcdir)/doc/sphinx/grammar/grammar-netconf-parser.txt
+else
+ @echo "ERROR: You need to enable both docs (--enable-generate-docs) and parser (--enable-generate-parser)"
+ @echo "ERROR: to regenerate grammar documentation."
+ false
+endif
+else
+ @echo "ERROR: You need to enable both docs (--enable-generate-docs) and parser (--enable-generate-parser)"
+ @echo "ERROR: to regenerate grammar documentation."
+ false
+endif
--- /dev/null
+..
+ Copyright (C) 2021 Internet Systems Consortium, Inc. ("ISC")
+
+ This Source Code Form is subject to the terms of the Mozilla Public
+ License, v. 2.0. If a copy of the MPL was not distributed with this
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+ See the COPYRIGHT file distributed with this work for additional
+ information regarding copyright ownership.
+
+.. _bnf-grammar:
+
+BNF Grammar
+===========
+
+Here's the Backus-Naur form (BNF) https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form notation
+
+BNF Grammar for DHCPv4
+----------------------
+
+```
+.. include:: grammar-dhcp4-parser.txt
+```
+
+BNF Grammar for DHCPv6
+----------------------
+
+.. include:: grammar-dhcp6-parser.txt
+
+BNF Grammar for Control Agent
+-----------------------------
+
+.. include:: grammar-ca-parser.txt
+
+BNF Grammar for D2 (DHCP-DDNS)
+------------------------------
+
+.. include:: grammar-d2-parser.txt
+
+BNF Grammar for Kea-netconf
+---------------------------
+
+.. include:: grammar-netconf-parser.txt