From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 8FhPEs0Ql18ICQAA0tVLHw (envelope-from ) for ; Mon, 26 Oct 2020 18:09:17 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id mKAYDs0Ql1/MAwAAB5/wlQ (envelope-from ) for ; Mon, 26 Oct 2020 18:09:17 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A5DF5940215 for ; Mon, 26 Oct 2020 18:09:16 +0000 (UTC) Received: from localhost ([::1]:57914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kX6vh-0001mN-Ce for larch@yhetil.org; Mon, 26 Oct 2020 14:09:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kX6mE-0000Bj-46 for emacs-orgmode@gnu.org; Mon, 26 Oct 2020 13:59:26 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:54207) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kX6mC-0005QV-DD; Mon, 26 Oct 2020 13:59:25 -0400 Received: by mail-wm1-x332.google.com with SMTP id d78so12580381wmd.3; Mon, 26 Oct 2020 10:59:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Z/eA3APIqcCDfBwuBUMJjQJrnMlLrHk6v0pWXwBLOww=; b=MsqoqznWAT/7gbtTUMIZPcAu9LZnc3WtJku2ULAZdcEnDuwi8VRQegM1wnurkRexD3 XgBRDMQKg406Re8ZdvmM5N2tw5sWy6VbYiStCGhRHI/OaG2V8mW5gODW6txp7gW6pi2V ebNpjkjRMBi4tysYyLimIxr4e4RdrzusOZfiG1j4O7xi9EkmS1D62tM8yCkyi7l/Ibv4 5n7/0yaJSYT7IT0okp6olFjffWiPsEqwDp2KtWI5rkhQtqSI15FBnbpGEMv/pxSg1Fq3 1ht+53ThGpClPYTSbCasFwNpLxHnVrfzMITAPSXC8uIb+g5zCkbcWz7QV40N5Dh9o2dG nL1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Z/eA3APIqcCDfBwuBUMJjQJrnMlLrHk6v0pWXwBLOww=; b=Hy9iRxVCnJGdhrXtuNxmq6GYJC4WiHWRECFW3Xa7I02iKyAaD8ydUkNmXnJOyV4rEw eR4K5thoRgSH8vShAxzlMJbCKofcYrximupYve+Zlm4pxrRb7p90CgnHNbb8TOQtPwJg 7kvWd18PQD0YBerb5+T69Z8fprMDfeDdChJj6mSNI96Oo+wcYwjx+1C7+7KJrMe8eflu nc+LLQmgzLQwGMV2+Uebe/ijE3D2/SFNy+NZussRs5Fhc3fx8+jbssh3ED8/YQdHaKAu E285UbOjzQroCCAoQOb2UB1+qP3bHY9mWSKF/OU1NkzACk6QVotDWzAHpeGOw0G9pQNs q9gA== X-Gm-Message-State: AOAM531fj9I2TBU9mrxoBSweheO/4go8leKPOL4zd3HnObpN8b7b/JG4 DzaqWVQjsmrNVPFYy4ELNlkLXwrE56nuaXD279w= X-Google-Smtp-Source: ABdhPJzoS3uWJPyW/8Z1LjTvWKSApDngCKYbm/oPUDLHr+RMxXaE26H+tGqnYGV8FI86Rvix0bvlZbSvh7nwTNZfIrI= X-Received: by 2002:a7b:c09a:: with SMTP id r26mr17787802wmh.45.1603735161914; Mon, 26 Oct 2020 10:59:21 -0700 (PDT) MIME-Version: 1.0 References: <68dc1ea1-52e8-7d9e-fb2d-bcf08c111eca@intrepidus.pl> <874kno7w3v.fsf@gnu.org> <87k0vdkz7c.fsf@gmail.com> <87sga13w62.fsf@nicolasgoaziou.fr> <87r1plj71v.fsf@gmail.com> <87mu093qgn.fsf@nicolasgoaziou.fr> <87o8kpj5mu.fsf@gmail.com> In-Reply-To: <87o8kpj5mu.fsf@gmail.com> From: Tom Gillespie Date: Mon, 26 Oct 2020 13:59:10 -0400 Message-ID: Subject: Re: official orgmode parser To: Ken Mankoff Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=tgbugs@gmail.com; helo=mail-wm1-x332.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bastien , =?UTF-8?B?UHJ6ZW15c8WCYXcgS2FtacWEc2tp?= , emacs-orgmode , Nicolas Goaziou Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=MsqoqznW; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: hLsTTROrUARA I started writing down Org's grammar as an EBNF (with Racket's #lang brag) on Saturday. There is indeed a layer of Org grammar that can be implemented via EBNF, but it is fairly minimal. You can identify headlines, but you can't identify nesting level; the arbitrary nesting depth means that you have to have a stack to keep track. There is a similar issue with the indentation level in order to correctly interpret plain lists. If the canonical representation of an org document was required to used org-adapt-indentation: nil; org-edit-src-content-indentation: 0 and there was a canonical normalization function some of these issues would go away, but not all of them, and I'm fairly certain that it is not possible to implement a safe normalization function that won't mangle someones formatting. Another example of something that requires a stack is the greater blocks, where you have #+begin_{name} and #+end_{name}, and the names must match. If there was a closed set of names you could sort of do it by hand, but since name can be any string that does not contain whitespace, you have to have a stack to track which block you are in. So, you can identify things that are heads, you can identify things that are block start lines and block end lines, but you need stacks to keep track of heading level, indentation, plain list level, and block name. I might be missing a few other places where stacks are required, but those are the big ones. Best, Tom On Mon, Oct 26, 2020 at 12:48 PM Ken Mankoff wrote: > > > On 2020-10-26 at 09:24 -07, Nicolas Goaziou wrote... > > # This is a comment (1) > > > > #+begin_example > > # This is not a comment (2) > > #+end_example > > > > AFAICT, you cannot distinguish between lines (1) and (2) with EBNF. > > I agree. I think this is a better (correct?) example than the footnotes on Org Syntax page. > > -k. > >