Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #21017 > unrolled thread
| Started by | Simeon Chaos <simeon.chaos@gmail.com> |
|---|---|
| First post | 2013-08-20 20:06 -0700 |
| Last post | 2013-08-22 09:47 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to comp.lang.javascript
Peasy is released: an easy but powerful parser Simeon Chaos <simeon.chaos@gmail.com> - 2013-08-20 20:06 -0700
Re: Peasy is released: an easy but powerful parser "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2013-08-21 18:45 -0700
Re: Peasy is released: an easy but powerful parser Simeon Chaos <simeon.chaos@gmail.com> - 2013-08-22 00:42 -0700
Re: Peasy is released: an easy but powerful parser Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-08-22 09:47 +0200
| From | Simeon Chaos <simeon.chaos@gmail.com> |
|---|---|
| Date | 2013-08-20 20:06 -0700 |
| Subject | Peasy is released: an easy but powerful parser |
| Message-ID | <ab7b098c-d96d-453f-a199-5b4fe44ad20f@googlegroups.com> |
I've released Peasy, which is an easy but powerful parser. Peasy brings a new method to write the parser. with Peasy, you write the parser by hand, just like to write any other kind of program. Do not be confused by "by hand", with the method brought by Peasy, it's easier and more powerful than using other tools or libraries. Peasy presents itself as a module of single file. To use Peasy, just "npm install peasy", and copy peasy.js to your project, read it, modify it, write the grammar rules,, and remove any unnecessary stuffs in Peasy, and parse with the grammar. Peasy has an simple, elegant and fast support for direct/indirect left recursive grammar, See [here]( http://chaosim.github.io/peasy/doc/peasy.html#peasysample ) for a concrete sample. The [annotated code]( http://chaosim.github.io/peasy/doc/peasy.html ) is best document for Peasy at the moment.
[toc] | [next] | [standalone]
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
|---|---|
| Date | 2013-08-21 18:45 -0700 |
| Message-ID | <a787d61a-ff27-44e9-9a36-167d2ef9ba90@googlegroups.com> |
| In reply to | #21017 |
On Tuesday, August 20, 2013 10:06:27 PM UTC-5, Simeon Chaos wrote: > I've released Peasy, which is an easy but powerful parser. > > Peasy brings a new method to write the parser. with Peasy, you write the parser by hand, just like to write any other kind of program. Do not be confused by "by hand", with the method brought by Peasy, it's easier and more powerful than using other tools or libraries. > > Peasy presents itself as a module of single file. To use Peasy, just "npm install peasy", and copy peasy.js to your project, read it, modify it, write the grammar rules,, and remove any unnecessary stuffs in Peasy, and parse with the grammar. > > Peasy has an simple, elegant and fast support for direct/indirect left recursive grammar, See [here]( http://chaosim.github.io/peasy/doc/peasy.html#peasysample ) for a concrete sample. > > The [annotated code]( http://chaosim.github.io/peasy/doc/peasy.html ) is best document for Peasy at the moment. This is a JavaScript group. Please present such things in the relevant language. If/when you do, I'd like to see some better examples of usage instead of having to dig through the codebase with its questionable layout (seems to be a fad in CS projects). Namely, I'd like to see an example of how you'd represent #1 a CSV file, and #2 basic arithmetic expressions with parenthesis & exponents: 1 + +(2 - -3) * 5/+9 *9^((3))^5 * 8 I see you are using your parser also for lexical analysis, which is fine in principle for a parser, but in this case I have a suspicion that this will be greater than O(n) in general.
[toc] | [prev] | [next] | [standalone]
| From | Simeon Chaos <simeon.chaos@gmail.com> |
|---|---|
| Date | 2013-08-22 00:42 -0700 |
| Message-ID | <1caf3f65-024b-444c-80c7-bb2c7433edd2@googlegroups.com> |
| In reply to | #21025 |
> This is a JavaScript group. Please present such things in the relevant language. From http://coffeescript.org/: "It's just JavaScript". > If/when you do, I'd like to see some better examples of usage instead of having to dig through the codebase with its questionable layout (seems to be a fad in CS projects). Namely, I'd like to see an example of how you'd represent #1 a CSV file, and #2 basic arithmetic expressions with parenthesis & exponents: > > 1 + +(2 - -3) * 5/+9 *9^((3))^5 * 8 Thank you for your advice. For arihemetic expression, here is a sample: https://github.com/chaosim/peasy/blob/master/samples/arithmatic.js The sample parser for a real language, here is my translation from coffeescript's jison grammar: https://github.com/chaosim/coffee-script/blob/master/src/parser.js and it's transcompiled from this coffeescript source: https://github.com/chaosim/coffee-script/blob/master/src/parser.coffee The original grammar.coffee, sorry for that there is only coffeescript code, from which lib/coffeescript/parser.js is generated: https://github.com/jashkenas/coffee-script/blob/master/src/grammar.coffee > I see you are using your parser also for lexical analysis, which is fine in principle for a parser. With the method of Peasy, anyone can write a independent lexer which produces tokens in the same manner to writing the parser. Thought I think it would be better not to split the lexer and the parser in most cases. > but in this case I have a suspicion that this will be greater than O(n) in general. It should be possible and easy that we write a O(n) parser in the method of Peasy for any LL(*) or LR(*), PEG grammar can be achieved O(n) by other parser generators. If in case it is better to split the lexer and the parser, we can write both of them in the method of Peasy respectively.
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2013-08-22 09:47 +0200 |
| Message-ID | <1655304.lrQdTIOHdA@PointedEars.de> |
| In reply to | #21027 |
Simeon Chaos wrote: >> This is a JavaScript group. Please present such things in the relevant >> language. > From http://coffeescript.org/: "It's just JavaScript". And that is just wrong, as you have been told before. -- PointedEars Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web