Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #21027

Re: Peasy is released: an easy but powerful parser

Newsgroups comp.lang.javascript
Date 2013-08-22 00:42 -0700
References <ab7b098c-d96d-453f-a199-5b4fe44ad20f@googlegroups.com> <a787d61a-ff27-44e9-9a36-167d2ef9ba90@googlegroups.com>
Message-ID <1caf3f65-024b-444c-80c7-bb2c7433edd2@googlegroups.com> (permalink)
Subject Re: Peasy is released: an easy but powerful parser
From Simeon Chaos <simeon.chaos@gmail.com>

Show all headers | View raw


> 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.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web