GithubHelp home page GithubHelp logo

Comments (11)

chexxor avatar chexxor commented on June 16, 2024

In what form do we want this documentation? BNF grammar, like this SQL BNF grammar description?

from documentation.

kingsleyh avatar kingsleyh commented on June 16, 2024

I would like to build a plugin for Intellij - but I really need a BNF grammar. Is there any place I can find this information? Even a partial grammar documented would be helpful.

from documentation.

hdgarrood avatar hdgarrood commented on June 16, 2024

Hi @kingsleyh! The closest thing we have to that is still just the compiler source code for now. It's actually not that dissimilar to a BNF grammar once you learn how to read it, though.

from documentation.

kingsleyh avatar kingsleyh commented on June 16, 2024

Thanks - I will have a look and see what I can figure out and then try to build a BNF grammar

from documentation.

geometryzen avatar geometryzen commented on June 16, 2024

I'm interested in this issue because I would like to do a direct PureScript to TypeScript transpiler that works in the browser without going to a server. I've had success doing this with Python to TypeScript and used a parser-generator called SPARK. SPARK takes a textual grammar and generates the parser. You are left to build the AST from the concrete syntax tree. A nice thing about this approach is that the grammar becomes a working software artifact with a dependent reference implementation. Here's the example parser for Python: https://github.com/geometryzen/typhon-lang. Anyone interested in taking this route to a PureScript grammar?

from documentation.

seagreen avatar seagreen commented on June 16, 2024

@chexxor: Not sure it's the best fit for PureScript, but Gabriel Gonzalez used ABNF for Dhall and he seems to know what he's doing=)

from documentation.

chexxor avatar chexxor commented on June 16, 2024

I believe the PS compiler itself doesn't use a BNF notation to generate its parser, so any BNF we maintain here could bit-rot. There was some interest in moving PS's parser to be generated from a BNF notation, so perhaps this issue should wait until that happens?

Or is there some value in having PS's current parser be approximated by a PS compiler-external BNF spec? If so, it's probably best to have someone actually write one and verify its correctness, then we copy it into here.

Regarding flavor of syntax notation, some notations support more complicated grammars than others. So, I think we just use whichever one works. :)

from documentation.

nwolverson avatar nwolverson commented on June 16, 2024

I find myself wanting to refer to such a thing to look at syntax highlighting details. @kingsleyh did you ever start building such a grammar?

from documentation.

sriharshachilakapati avatar sriharshachilakapati commented on June 16, 2024

@nwolverson He did release the IntelliJ plugin it seems: https://github.com/intellij-purescript/intellij-purescript/

from documentation.

Boscop avatar Boscop commented on June 16, 2024

I'm interested in writing a PureScript interpreter in Rust (and then compiler from PS to Rust).
Where can I find the most complete PS grammar description?
In that intellij plugin repo I only see a Purescript.flex file used for generating the lexer..

from documentation.

kingsleyh avatar kingsleyh commented on June 16, 2024

Hey - I tried to write a bnf for IntelliJ - however IntelliJ uses a specialised ebnf format which doesn’t support some forms of recursion - I could not get it working with good performance - so switched to using a hand rolled parser written in code. But I’ve not had any more time recently so I’ve stopped work on it for now

from documentation.

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.