TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Don't Use ISO/IEC 14977:1996 Extended Backus-Naur Form (EBNF) (2023)

39 pointsby gslin3 days ago

8 comments

Mofpofjisabout 7 hours ago
The complaints about ISO Prolog, and about ISO standards generally not being available publicly &#x2F; at no cost, resonate a lot with me. If you compare eg. the POSIX and the ISO C development workflows, and their respective end results, there&#x27;s a world of difference.<p>&quot;ISO&quot; (International Standards Organization), where you have &quot;national member bodies&quot;, should absolutely be a thing of the past <i>for programming languages</i> (or for anything related to computing). My country&#x27;s national body&#x27;s own homepage has a huge tirade, aiming to &quot;dispel myths&quot;, such as the &quot;myth&quot; that &quot;standards should be available free of charge&quot;. Meanwhile, <i>lots</i> of std orgs have published computing standards with various degrees of openness <i>already</i>.<p>ISO is a relic when it comes to computing. (So are other standards bodies that choose to remain proprietary; like those behind PCI, SCSI, ... Computing is ubiquitous and these bodies should be forced open by law, for the public interest.)
评论 #44038265 未加载
评论 #44036767 未加载
评论 #44038138 未加载
评论 #44036583 未加载
PJBakerabout 4 hours ago
&gt; <i>every single language document uses its own notation, which is more often than not, a dialect of the (Extended) Backus-Naur Form</i><p>I came across this recently while writing an article that references Lua, Go and Python (3.8) syntax. Each of them uses a slightly different form of EBNF.<p>To make them more easily comparable, I wanted to convert all three to the same format. Looking for something fairly standard (not entirely ad-hoc but also not as formal as ISO&#x2F;IEC EBNF or RFC 5234 ABNF), I came across Wirth Syntax Notation [0] [1]:<p><pre><code> syntax = { production } . production = identifier &quot;=&quot; expression &quot;.&quot; . expression = term { &quot;|&quot; term } . term = factor { factor } . factor = identifier | literal | &quot;(&quot; expression &quot;)&quot; | &quot;[&quot; expression &quot;]&quot; | &quot;{&quot; expression &quot;}&quot; . literal = &quot;\&quot;&quot; character {character} &quot;\&quot;&quot; . </code></pre> It turns out that the Go specification already uses WSN [2]. I converted Lua and Python, and then could work with all three language grammars in a consistent, machine-readable notation.<p>[0] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Wirth_syntax_notation" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Wirth_syntax_notation</a><p>[1] <a href="https:&#x2F;&#x2F;dl.acm.org&#x2F;doi&#x2F;10.1145&#x2F;359863.359883" rel="nofollow">https:&#x2F;&#x2F;dl.acm.org&#x2F;doi&#x2F;10.1145&#x2F;359863.359883</a><p>[2] <a href="https:&#x2F;&#x2F;go.dev&#x2F;ref&#x2F;spec#Notation" rel="nofollow">https:&#x2F;&#x2F;go.dev&#x2F;ref&#x2F;spec#Notation</a>
评论 #44037346 未加载
egberts1about 4 hours ago
Still use EBNF, so some of my tools, citations, and sources are:<p>Here is a list of all variants of EBNFs as well as Vim syntax highlighter for EBNF variants:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;egberts&#x2F;vim-syntax-ebnf">https:&#x2F;&#x2F;github.com&#x2F;egberts&#x2F;vim-syntax-ebnf</a><p>And a EBNF format detector:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;egberts&#x2F;filetype-ebnf-grammars">https:&#x2F;&#x2F;github.com&#x2F;egberts&#x2F;filetype-ebnf-grammars</a><p>And a master list of all variants of EBNF:<p><a href="http:&#x2F;&#x2F;www.cs.man.ac.uk&#x2F;~pjj&#x2F;bnf&#x2F;ebnf.html" rel="nofollow">http:&#x2F;&#x2F;www.cs.man.ac.uk&#x2F;~pjj&#x2F;bnf&#x2F;ebnf.html</a>
评论 #44037425 未加载
HarHarVeryFunnyabout 7 hours ago
&gt; One of the most common operations in a grammar, by far, is concatenation (aka sequencing). ISO&#x2F;IEC 14977:1996 requires that a comma be used for every concatenation, so any sequence of N symbols will have N-1 commas.<p>It seems they were trying really hard to make EBNF NOT look like the grammar it is representing.<p>&gt; ISO&#x2F;IEC 14977:1996 represents “one or more” as { symbol }- which means “0 or more symbols, and then subtract the empty set<p>It&#x27;s almost as if they were looking for a special syntax to express &quot;1 or more&quot;.<p>Bizarre ... just bizarre.
dwheelerabout 8 hours ago
I&#x27;m the author. Ask me anything!
评论 #44036825 未加载
评论 #44035905 未加载
评论 #44036777 未加载
评论 #44035618 未加载
评论 #44037078 未加载
userbinatorabout 6 hours ago
IMHO ABNF is just as annoying to read, especially its insistence on &#x27;&#x2F;&#x27; instead of &#x27;|&#x27; for alternation (when | has universally become the &quot;OR&quot; symbol in other languages) and &quot;%x&quot; for hex prefixes. My preference for syntax descriptions is [ ] for &quot;optional&quot;, &quot;,,,&quot; or &quot;+&quot; for &quot;1 or more&quot;, &quot;*&quot; for &quot;0 or more&quot;, and &quot;{min,max}&quot; or &quot;{n}&quot; for repetition ranges, which closely mirrors regex syntax; I&#x27;m not sure if this has been standardised or even has a name, but I&#x27;ve seen it far more often than ABNF&#x2F;EBNF.
kstenerudabout 5 hours ago
These are some of the many reasons why I developed the Dogma metalanguage.<p><a href="https:&#x2F;&#x2F;dogma-lang.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;dogma-lang.org&#x2F;</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;kstenerud&#x2F;dogma&#x2F;blob&#x2F;master&#x2F;v1&#x2F;dogma_v1.0.md">https:&#x2F;&#x2F;github.com&#x2F;kstenerud&#x2F;dogma&#x2F;blob&#x2F;master&#x2F;v1&#x2F;dogma_v1.0...</a><p>That, and also I needed a language that could describe binary data.
评论 #44037281 未加载
mannyvabout 7 hours ago
(4) -&gt; I would say that the lack of regex use is a plus. Yes I use them all the time. For anything complicated I&#x27;ll just ask ChatGPT to make it. And of course, are regexs all the same across everything?<p>(5) -&gt; Once you get it you get it.<p>Every language specification is odd in its own special way. In any case I haven&#x27;t really seen BNF&#x2F;EBNF used in the last few years, so this is probably a moot discussion.
评论 #44037010 未加载