Giter Site home page Giter Site logo

Comments (2)

eytan avatar eytan commented on June 8, 2024

Hi Greg,
Awesome! JSON literals are a hacky way to implement dictionary/map-like objects. The syntax is something like:

x = @{"a": [1,2,3], "b": 2};
y = @[1,2,3];

where the stuff that comes after @ can't contain any PlanOut variables. Honestly, the JSON literal parser is pretty wonky, and we have been hoping that somebody with more experience writing parsers could implement a sane implementation of dictionaries, that would completely replace JSON literals, so that one could write things like:

weights1 = [1, 2, 1];
weights2 = [2,1,1];
y = {"US": weights1, "ES": weights2};

Is this something you would know how to do? If so, that would be great! Also, if you were to re-write the parser in PEG, would it be compatible with PEG.js?

Also, you may be interested in checking out the PlanOut editor (in planout/planout-editor/) -- I think it might motivate why we favor having a JS-based compiler :)

from planout.

GregBowyer avatar GregBowyer commented on June 8, 2024

Hi Greg,
Awesome! JSON literals are a hacky way to implement dictionary/map-like objects. The syntax is something like:

x = @{"a": [1,2,3], "b": 2};
y = @[1,2,3];

where the stuff that comes after @ can't contain any PlanOut variables. Honestly, the JSON literal parser is pretty wonky, and we have been hoping that somebody with more experience writing parsers could implement a sane implementation of dictionaries, that would completely replace JSON literals, so that one could write things like:

I could try to give it a shot in implementing a dict object, I might give that a shot once the grammar is done.

Is this something you would know how to do? If so, that would be great!

I could do it in a PEG, I generally hate writing classical grammars :P

Also, if you were to re-write the parser in PEG, would it be compatible with PEG.js?
I dont know if PEG.js takes grako EBNF format, but I dont think it would be hard to transliterate. Scanning quickly through the PEG.js documentation the one thing that might be troublesome is the lack of a cut operator.

Also, you may be interested in checking out the PlanOut editor (in planout/planout-editor/) -- I think it might motivate why we favor having a JS-based compiler :)

I have played with it a lot, its really neat. The rationale for me, for the python compiler is to have a compiler that can run inside a test-server that is responsible for farming out test jsons to systems that ask for them.

I opened a pull request #29 for where I am up to.

from planout.

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.