Git Product home page Git Product logo

Comments (9)

b-studios avatar b-studios commented on July 17, 2024 1

To be honest, I think the latter (n-1 not parsing) is a feature, not a bug :) I am happy with nudging people to use whitespace.

from effekt.

marzipankaiser avatar marzipankaiser commented on July 17, 2024

Note, this is still the case on current master.

Also, similarly: n-1 lexes as n -1 (not as n - 1) and fails during parsing.

from effekt.

b-studios avatar b-studios commented on July 17, 2024

Just tagging @dvdvgt since this might be relevant for him.

from effekt.

dvdvgt avatar dvdvgt commented on July 17, 2024

I fail to see what we can do about it to completely avoid this issue:

  • Either disallow ! occurring in identifiers,
  • force the user to add a space
  • or have it the other way around such that there may be a falsely lexed != where it is actually an identifier ending with a !.

How else should the lexer know that val n!=1 contains the identifier n! and and the token = but not != instead without taking the context into consideration?

from effekt.

dvdvgt avatar dvdvgt commented on July 17, 2024

Also, similarly: n-1 lexes as n -1 (not as n - 1) and fails during parsing.

This should be fixable by allowing the lexer only to lex unsigned numbers and let parser figure out the precedence.

from effekt.

b-studios avatar b-studios commented on July 17, 2024

As I said, I wouldn't want to fix this. People should use whitespaces if they mean n - 1.

from effekt.

dvdvgt avatar dvdvgt commented on July 17, 2024

As much as I like the frequent and consistent use whitespaces to structure code, I disagree. I don't think arithmetics is the right place to force this onto the user. Parsing should be robust enough to handle something like 1-1 (instead of 1 - 1) without aborting the whole compilation.

from effekt.

marzipankaiser avatar marzipankaiser commented on July 17, 2024

As I said, I wouldn't want to fix this. People should use whitespaces if they mean n - 1.

I'm somewhat fine with this (though I sometimes do prefer the version without whitespace), but then we should be consistent and also disallow n- 1 (which is parsing fine).

from effekt.

b-studios avatar b-studios commented on July 17, 2024

The easiest way to disallow it is to allow - as part of an identifier ;)

from effekt.

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.