[HN Gopher] 1001 Representations of Syntax with Binding (2021)
       ___________________________________________________________________
        
       1001 Representations of Syntax with Binding (2021)
        
       Author : 082349872349872
       Score  : 38 points
       Date   : 2024-05-19 06:40 UTC (1 days ago)
        
 (HTM) web link (jesper.cx)
 (TXT) w3m dump (jesper.cx)
        
       | Y_Y wrote:
       | _De Bruijn syntax is nameless
       | 
       | But reordering brings changes
       | 
       | And really it's a graph
       | 
       | Not just a tree_
        
         | 082349872349872 wrote:
         | And you may find yourself binding a parameter       And you may
         | find yourself with a free variable       And you may find
         | yourself down in subtrees equal to cousin branches       And
         | you may find yourself with a beautiful rep, in a beautiful type
         | And you may ask yourself, "Well, how did I get here?"
         | 
         | Lagniappe: https://www.youtube.com/watch?v=x3EDCM461jQ
        
           | Y_Y wrote:
           | I like the cut of your jib
        
       | chrisjj wrote:
       | " As a compiler developer or programming language researcher, one
       | very common question is how to represent the syntax of a
       | programming language in order to interpret, compile, analyze,
       | optimize, and/or transform it.
       | 
       | One of the first lessons you learn is to not represent syntax as
       | the literal string of characters written by the programmer, but
       | rather convert it to an abstract syntax tree (AST). "
       | 
       | Note: AST does not "represent the syntax of a programming
       | language", but represents a program written in the language.
       | 
       | Perhaps worth amendment given this article seems otherwise
       | excellent.
        
         | evertedsphere wrote:
         | the AST type represents the syntax of the language, each
         | inhabitant of which type is a representation of an individual
         | program in the language
        
           | chrisjj wrote:
           | My parse stumbled at "which type".
        
             | bckr wrote:
             | The AST type represents the syntax of the language.
             | 
             | Each instance of the AST type is a representation of an
             | individual program in the language.
        
               | chrisjj wrote:
               | > The AST type represents the syntax of the language.
               | 
               | Agreed, but was not mentioned by the text in question,
               | note.
               | 
               | Thing != Thing's type.
        
             | wizzwizz4 wrote:
             | "which" is doing double duty as a relative pronoun and a
             | determiner. I think. Parse it as "each [...] of which
             | [...]", which serves the same grammatical function as "each
             | of which" would.
             | 
             | Edit: A specific procedure for understanding this part of
             | the sentence:
             | 
             | (1) Replace "each inhabitant of which type" with "each of
             | which".
             | 
             | (2) Parse the sentence.
             | 
             | (3) Interpret "each" as qualified by "inhabitant" (i.e.,
             | each of them is an inhabitant), and "which" as qualified by
             | "type" (i.e., the referent of "which" is a type).
        
               | chrisjj wrote:
               | That leaves me stuck at "type".
               | 
               | EDIT: #2 gives
               | 
               | "The AST type represents the syntax of the language, each
               | of which is a representation of an individual program in
               | the language."
               | 
               | But "each of which" what? There's no collection for it.
        
               | evertedsphere wrote:
               | "... the language. each inhabitant of this type is ..."
        
               | chrisjj wrote:
               | OK, so:
               | 
               | "The AST type represents the syntax of the language. Each
               | inhabitant of this type is a representation of an
               | individual program in the language."
               | 
               | I agree.
               | 
               | But my
               | 
               | AST does not "represent the syntax of a programming
               | language"
               | 
               | stands.
               | 
               | Thing != Thing's type.
        
               | evertedsphere wrote:
               | the first sentence that you quote doesn't mention the
               | term AST or "AST type" at all, the second sentence is
               | clearly talking about terms (i.e. inhabitants of a type)
               | 
               | this is meaningless nitpicking over a problem of your own
               | invention
        
               | wizzwizz4 wrote:
               | #1 is a grammatical translation, and loses meaning. If
               | you continue to step #3 before attempting to extract
               | meaning from the sentence, it answers your question.
               | There's only one "type" in the reference pool ("the AST
               | type") and, like a list, set, class or tree, it is a
               | collection. Therefore, it is this to which "which"
               | refers.
        
       | jasperry wrote:
       | I wonder if there is any research that draws insightful
       | connections between these theoretical models of variable binding
       | and the usual way of writing a compiler with nested symbol
       | tables.
        
       ___________________________________________________________________
       (page generated 2024-05-20 23:02 UTC)