Skip to content

Keep the gramma of the language context free #37

Closed

Description

@Isaac-Leonard

I believe its probably best to attempt to keep the syntax / Gramma of the language context free to make building parses easier and to limit ambiguity in the syntax.
C++ for example is not context free and is a mess to the point where its syntax is now Turing complete from what I've heard.
Avoiding this is best I think.

Activity

  1. alshdavid commented on Apr 3, 2022

    @alshdavid
    Collaborator

    Can you give some examples please?

  2. mindplay-dk commented on Apr 4, 2022

    @mindplay-dk

    I'm no expert, but I think context-free grammar basically means every parser rule is a simple replacement - so, determining whether the syntax is valid does not depend on any contextual information deduced by the compiler while parsing.

    Importantly, it implies the syntax can be described in Backus-Naur form, which most languages can - having an official, properly versioned BNF (perhaps as part of a reference parser implementation with good test coverage) is an important piece of a language specification, if you want to encourage others to experiment with compiler implementations on different platforms.

  3. mindplay-dk commented on Apr 4, 2022

    @mindplay-dk

    I guess I would propose to close this issue, in favor of a new issue, which calls for a formal BNF. 🙂

  4. asafigan commented on Sep 2, 2022

    @asafigan

    Also note that typescript's type system is turning complete. Or at least it isn't possible to know if a type can ever be resolved. This is a huge issue because it means that arbitrary limits have to be put in place to insure that the compiler always stops and doesn't run forever. My company ran into this limit when our code base got to a current size. The typescript compiler just stopped compiling our code base one day and we had to do a lot of work to figure out why. We had to break our code base into multiple packages to grow the code base anymore. This was a huge pain because we had to use third party tools to do this as npm and typescript don't really support multi package code bases.

    I am bringing this up because the syntax is inspired by typescript. Turning complete type systems should be avoided as much as possible. It causes real issues for end users.

  5. locked and limited conversation to collaborators on Feb 17, 2023
  6. converted this issue into a discussion #67 on Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions