Giter VIP home page Giter VIP logo

website's Introduction

GitHub Actions Codecov CodeFactor license

PEG.js is a simple parser generator for JavaScript that produces fast parsers with excellent error reporting. You can use it to process complex data or computer languages and build transformers, interpreters, compilers and other tools easily.

PEG.js is still very much work in progress. There are no compatibility guarantees until version 1.0

public packages

package version dependency status
pegjs release dev dependencies

local packages

package dependency status
~/ dependencies
~/test dependencies
~/tools/benchmark dependencies
~/tools/bundler dependencies
~/tools/impact dependencies
~/tools/publish-dev dependencies

website's People

Contributors

djadmin avatar dmajda avatar futagoza avatar michaelficarra avatar mulka avatar pouyakary avatar s3u avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

website's Issues

"Parsers can also support their own custom options"

The documentation says that parsers can also support their own custom options. How do I enable this? I'm generating the parser from the commandline, and I'm using the generated code. I'd like to pass context to the "parse" function.

jsDump bug

The following grammar entered into the online version:

start = { return { item: 'abc' }; }

produces output [] for an empty input, instead of correct { item: 'abc' }.

The following grammars don't have this problem:

start = { return { item: 0 }; }
start = { return { index: 'abc' }; }

Debugging points to a bug in the jsDump library. I need to look whether this is fixed in a newer version. If not, I need to report it/fix it.

Originally reported in the Google Group.

Add source code tabs

To make prototyping of production scale parsers easier, there should be two tabs on the left side:

  1. PEG.js source code
  2. JS code (+ library selection from CDN)
    (Assigned to me)

Show line numbers while writing PEG.js grammar Online

I'd be very great if we could show line numbers in the Grammar writing section (<textarea>) at http://pegjs.majda.cz/online.

When we write grammar directly into the online editor and if any error occurs in the grammar it shows respective line number. But to find the line number we need to copy the code in the text editor and check the line number where exactly the error is. I feel it's not easy to debug there.

PS: I'd like take this up but need prior discussion before implementing.

Wanna do some changes

So, it's been years since I've started using /online and I wanted to see some changes, but they never came. Here're some things that came to my head first:

  • Burn the jQuery. Replace it with React
  • Get rid of EJS on server
  • Restyle website to conform to modern flat design: remove rounded corners, remove extraneous borders, create consistent color scheme, change to darker background etc
  • Use CodeMirror for output
  • Add a button to switch between CM and treeview for output
  • Display stack trace
  • Display errors on CM gutters in code and output
  • Put execution into webworker, so that infinite loops do not destroy code in Chrome
  • Add a combobox to select examples from the list
  • Collapse options (parser variable, result cache) to take less space, they're almost never used
  • Store previous code in localstorage
  • Fix incorrect CM config (2/4 spaces depending on action)
  • Add lodash into scope

Which of these do you think you will never let into master?

line(), coulmn() and offset() still listed as valid in predicates

According to 0.9.0 changelog

line(), column() and offset() were removed and replaced by location()

however the documentation on the website still shows

line(), column() and offset() as available in predicates

emphasis added for clarity.

The predicate is a piece of JavaScript code that is executed as if it was inside a function. It gets the match results of labeled expressions in preceding expression as its arguments. It should return some JavaScript value using the return statement. If the returned value evaluates to true in boolean context, just return undefined and do not advance the parser position; otherwise consider the match failed.

The code inside the predicate can access all variables and functions defined in the initializer at the beginning of the grammar.

The code inside the predicate can also access location information using the location function. It returns an object like this:

{
start: { offset: 23, line: 5, column: 6 },
end: { offset: 23, line: 5, column: 6 }
}
The start and end properties both refer to the current parse position. The offset property contains an offset as a zero-based index and line and column properties contain a line and a column as one-based indices.

The code inside the predicate can also access the parser object using the parser variable and options passed to the parser using the options variable.

The code inside the predicate can also access the current parse position using the offset function. It returns a zero-based character index into the input string. The code can also access the current line and column using the line and column functions. Both return one-based indexes.

The code inside the predicate can also access options passed to the parser using the options variable.

Note that curly braces in the predicate code must be balanced.

Provide option to '--trace' and show output

Consider this a wishlist feature request to provide an option in the web interface to produce a parser with '--trace' enabled and to show the resulting trace output for debugging purposes.

Implement a build system

Implement a build system that will allow us to avoid the vendor directory with minified versions of various libraries.

After this is implemented, the website should have just one JavaScript and CSS file and its dependencies should not be included in the repository.

Prevent confusion about website and master divergence

People get confused and try to use master-only features in the online version (see e.g. here).

Since this problem will surely re-occur in the future (i.e. releasing 0.8.0 won't solve it), I need to explicitly state somewhere that the online version uses the latest released version of PEG.js (currently 0.7.0), not master. Creating master-based online version and allowing to switch between this one and the latest-released-version-based one could also be useful.

Similar issue exists also for the documentation.

Remember user code in the online editor

It would be neat if the online editor persisted the latest user input across visits, like the babel.js REPL - sometimes I want to go back to the idea code I was working on earlier, and at the moment I need to save the code somewhere locally or start from scratch.

It should be pretty trivial with localStorage. I'll happily submit a PR if you think it's a good idea.

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.