Git Product home page Git Product logo

Comments (8)

yate avatar yate commented on June 11, 2024

I'm having trouble understanding why the number of arguments affect how it's parsed. I've only studied one way of parsing, and that's top down LL(1). It seemed to me as long as the grammar of the language didn't have any ambiguity, was context free, not left recursive, then the parser would be able to handle it. Also what do you mean by the value of the function, it's name, memory location?

I think I'm thinking about it differently because I'm imagining it being compiled and not interpreted, which my implementation might be.

from -g-pl.

haasn avatar haasn commented on June 11, 2024

It seemed to me as long as the grammar of the language didn't have any ambiguity

The problem here is that the grammar of the language HAD ambiguity.

Previously,

>foo >bar bat baz

was ambiguous between the following:

  • foo() bar() bat baz
  • foo(bar()) bat baz
  • foo(bar(), bat) baz
  • foo(bar(), bat baz)
  • foo() bar(bat) baz
  • foo() bar(bat, baz)
  • foo(bar(bat)) baz
  • foo(bar(bat), baz)
  • foo(bar(bat, baz))

And the actual result would be determined based on how many parameters foo and bar take, respectively.

Now, with the addition of semicolons, it would be

>foo >bar bat; baz;

Which makes it clear that foo(bar(bat), baz) is meant, and nothing else.

from -g-pl.

yate avatar yate commented on June 11, 2024

ah i see, so how the hell does perl do it lol? there is always the option of adding parens, which I'm not entirely against.

from -g-pl.

haasn avatar haasn commented on June 11, 2024

perl is interpreted and slow as shit for a reason :)

Edit: Doesn't perl force parentheses where it would be ambiguous otherwise?

from -g-pl.

haasn avatar haasn commented on June 11, 2024

For the reference, my implementation is basically working. The hello world compiles except for three parts:

  1. I don't have a comparison function yet so >is name "nand" fails
  2. I don't remove comments yet so those fail
  3. I don't have any “gb2” yet so that fails

Otherwise, the rest is working fully.

from -g-pl.

haasn avatar haasn commented on June 11, 2024

Update: I added a comparison function now, so now the only issue I still need to solve is comments and gb2. :)

from -g-pl.

yate avatar yate commented on June 11, 2024

damn you work fast

from -g-pl.

haasn avatar haasn commented on June 11, 2024

I'm closing this. If we get any better ideas later on, open a new issue.

from -g-pl.

Related Issues (17)

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.