2

This is one of the more confusing things regarding tikz. You can find various usage examples for the \path or \draw commands online and each of those will be unique in its own way. I wonder if there is a Backus–Naur form (BNF) grammar available for these commands that shows how the arguments should be passed.

  • 5
    There is no BNF grammar for anything TeX-related, because TeX is not context-free. – Henri Menke Jun 02 '18 at 01:54
  • @HenriMenke Interesting point, what would be the alternative then? – Paghillect Jun 02 '18 at 06:12
  • 2
    @DarthPaghius The alternative is the documentation (as the excellent pgfmanual). – Paul Gaborit Jun 02 '18 at 06:41
  • @PaulGaborit Almost no modern programming language is context-free but does it prevent you from having a BNF for a specific subset of their syntax? No. You assume a set of rules (no macros, etc) and write a BNF or something similar which gives you a compact representation of some otherwise complicated syntax which would take a dozen pages to document. Anyway I don't think what I want readily exists so maybe I should try and create one myself. – Paghillect Jun 02 '18 at 09:30
  • Can you give a couple of examples that threw you off? – percusse Jun 02 '18 at 11:02
  • 2
    @DarthPaghius The problem with formulating a grammar for TeX is the existance and importance of catcodes. Basically everything can be used to delimit everything. Not even the primitives are fixed, just make any character active and assign the primitive to it. On top you also have different modes where catcodes can be different. That said, the pgfmanual already presents the syntax in a form similar to a grammar, e.g. the \path command is presented as \path <specification>. – Henri Menke Jun 02 '18 at 11:49
  • Related https://tex.stackexchange.com/questions/153912/is-it-possible-to-produce-a-context-free-grammar-for-tikz-path-node – Symbol 1 Jun 03 '18 at 17:30

0 Answers0