Skip to content

Issues with the full specification and pest code #42

@ghost

Description

To start of with, I wanted to say I really like the idea of corn. I've long been frustrated with JSON config files. Recently I've been writing a corn parser with chumsky as a learning experience. As such I have been reading over the full spec a lot and have noticed some issues that I think should be addressed. I haven't experimented with the rust code directly but I have used the online pest editor to see how the pest code breaks down various examples.

Issues

The formal language grammar linked here https://cornlang.dev/spec/#grammar goes nowhere. The link needs to be updated (and should probably point to a stable tag/branch instead of the master branch).


Here the valid form for input names is described as:

Input names always start with a dollar $ when declaring and referencing them. The first character after the dollar must be either alphabetic (a-z A-Z) or an underscore _. This can be followed by any number of alphanumeric (a-z A-Z 0-9) characters or underscores.

This is slightly wrong, or at least, poorly worded. Here is the relevant line in the pest code:

input = ${ !"\\" ~ "$" ~ (ASCII_ALPHA | "_") ~ (ASCII_ALPHANUMERIC | "_")+ }

This requires an input name to be at least two characters long. The line '... This can be followed by any number of alphanumeric ...' in the spec should instead read '... This is followed by one or more alphanumeric ...' or the pest code should be changed to make the second character optional.


In the spec for strings:

You can also include any Unicode character using an \uXXXX escape code. XXXX must be replaced with exactly 4 hexadecimal digits.

This is incorrect. I'm no Unicode guru myself but eyeballing this with only four digits you can represent about 40% of Unicode characters. For example none of these 🌐 🌞 🌝 🌸 can be represented with only four digits. Ideally you would want to support 4-6 digits, but 4-5 would be enough for all but the Supplement­ary Private Use Area plane - B.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions