GithubHelp home page GithubHelp logo

Comments (8)

andorp avatar andorp commented on May 28, 2024 1

The grammar from the PhD is over-generative. Variables in those position must hold to location OR simple types. This comes from the nature of representing the nodes of the evaluation graph in GRIN. Let me find the reference for this in the PhD...

About the linter: It has two modes one that uses a calculated type-environment and one that doesn't. If the type env is present the linter is smarter. For some reason the calculation of the type-environemint in your provided example is failing.

Meanwhile I try to construct a well formed example based on the snippet you provided. The one that uses heap, still has some errors. I'll post that version soon, but it needs a bit deeper digging.

from grin.

andorp avatar andorp commented on May 28, 2024 1

This one:

grinMain =
  v <- pure (CA)
  print v
  v3 <- store v
  v2t <- store (Cother v3)
  v2 <- eval v2t
  print v2

print x =
  case x of
    (CA) -> _prim_int_print 1
    (CB) -> _prim_int_print 2

other y =
  o2 <- fetch y
  o1 <- case o2 of
    (CA) -> pure (CB)
    (CB) -> pure (CA)
  pure o1

eval thunk =
  e1 <- fetch thunk
  case e1 of
    (Cother yt) ->
      other yt

reduces to this:

grinMain =
  _prim_int_print $ 1
  _prim_int_print $ 2

from grin.

andorp avatar andorp commented on May 28, 2024
  v <- pure (CA)
  ...
  v2t <- pure (Fother v)

This seems to be an invalid construction in GRIN. as the Variable v holds to a Node value and it is used in building the (Fother v) node. There is an invariant that the parameters for node values must be locations or simple types. Thus the construction of (Fother v) is invalid.

from grin.

AlexandreTunstall avatar AlexandreTunstall commented on May 28, 2024

The syntax reference in the README claims that variables are simple types. Is it out of date, or am I reading it wrong?

Would it be possible to add a case to the linter to catch the mistake?
At the moment, the linter gives no warnings/errors on the above program.

from grin.

AlexandreTunstall avatar AlexandreTunstall commented on May 28, 2024

Thanks. Do you want me to leave this open for the lack of linter error?

By the way, the linter gives "expected SimpleVal" errors when using store with a tag (e.g. store (Cother v3) in your fix).
Are there any cases where the linter error is justified?

from grin.

andorp avatar andorp commented on May 28, 2024

We are in a phase transition from the current syntax to a more restrictive one. See the 32-extended-syntax feature branch.

The misleading error message from the linker is a byproduct of the initial transition. For the interprocedural dead data eliminations need a special form where values can created only using pure simple expression. The new syntax will restrict the AST into that form. That would mean the following snippet:

  v3 <- store v
  v4 <- pure (Fother v3)
  v2t <- store v4
  v2 <- eval v2t

from grin.

andorp avatar andorp commented on May 28, 2024

Closing this one as the extract of this conversation can be found in the #76 .

from grin.

andorp avatar andorp commented on May 28, 2024

The parameters of node are mentioned slightly in Section 2.4.1 Restrictions. The origin of this restriction comes from the implementation of the HeapPointsTo. Its description can be found in Section 3.2 HPT .

from grin.

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.