GithubHelp home page GithubHelp logo

Comments (5)

metagn avatar metagn commented on June 11, 2024 2

Could you please advise whether we need to change the grammar files

The comments in the parser.nim file starting with #| are turned into the grammar documentation file when executing the parser file as the main module, i.e. nim r compiler/parser.nim. So to change the wrong line in the grammar, one would change the comment in this line:

#| conceptParam = ('var' | 'out')? symbol

to say ('var' | 'out' | 'ptr' | 'ref' | 'static' | 'type'), then run nim r compiler/parser.nim.

A separate issue exists where this line:

of tkOut, tkVar: nkVarTy

needs to be split into of tkVar: nkVarTy and of tkOut: nkOutTy (nkOutTy is new).

from nim.

arnetheduck avatar arnetheduck commented on June 11, 2024 1

well, the grammar, parser and AST for concepts is .. experimental as a whole at best - its indentation rules generally deviate from the language, keywords such as type are used in an irregular way compared to the rest of the language etc.

I think there are deeper questions to resolve than this grammar quirk before venturing further.

from nim.

metagn avatar metagn commented on June 11, 2024

Also the concept parameter out x seems to parse the same as var x (this line predates the new out type):

of tkOut, tkVar: nkVarTy

from nim.

silly-carbon avatar silly-carbon commented on June 11, 2024

Hi @arnetheduck @metagn

I'd like to try to solve this issue. But as I can see from the codebase, other symbols other than var & out are also supported, e.g., ptr, ref, static, type.
But I can see from this link (https://nim-lang.org/docs/manual_experimental.html#concepts):

You can apply any of the standard type modifiers such as var, ref, ptr and static to denote a more specific type of instance

It seems that those symbols are supported as described in the doc listed above, just the grammar files need to be updated.

Could you please advise whether we need to change the grammar files (to add more symbols like ptr, ref, static, type. IMHO, this is more feasible),
or to change the codebase(to remove support of ptr, ref, static, type)?

from nim.

silly-carbon avatar silly-carbon commented on June 11, 2024

from nim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.