Better HN
topnewbestaskshowjobs
Log inSign up

dmajda

131 karma · joined Feb 20, 2007 (19y ago) · 12 submissions

Software developer with passion for programming languages, clean code, and software craftmanship. Author of PEG.js. Currently working at Jut.
Submissions

1.

Two Questions To Ask After a Bugfix(majda.cz ↗)

2 points · by dmajda · 11y ago · discuss

2.

Codie — JavaScript template engine specialized in generating JavaScript code(github.com ↗)

1 points · by dmajda · 15y ago · discuss

comment 16y ago · link · parent

I believe that the classical generated parser has generally better performance potential - there is less function calling, less string passing (but this may be avoided easily in combinators too) and more opportunity for optimalization if you have the whole grammar AST in hand.

comment 16y ago · link · parent

ECMAScript 5 PEG parser: http://boshi.inimino.org/3box/PEG/build/ES5.html

(Hmm, I must definitely try to port it to PEG.js :-)

As for Ruby, I am not sure if it is even possible to create a PEG grammar. Its lexer and parser are heavily interconnected and there is a lot of state involved. If the grammar will be created, I don't think it would be pretty.

comment 16y ago · link · parent

Interesting, thanks for the warning. I only skimmed through the paper today and noted that the algoritm seems complex, but I didn't attempt to understand it in detail.

What was your final result? Did you implement the left recursion in the way the paper describes, invented/found some other way or abandoned the whole idea?

comment 16y ago · link · parent

I knew somebody would raise this point :-) You are right that the evaluation order would be wrong for "-" and "/".

I will probably implement support for left recursion in PEG.js - it is possible (see e.g. http://www.vpri.org/pdf/tr2007002_packrat.pdf). After that, the grammar could be rewritten to evaluate in the correct order.

(Another alternative - which works right now - is to change the parsing expressions to something like "additive ([+-] additive)*" and deal with the whole chain of operations with the same priority at once. I didn't use this in the example as I wanted it to be as simple as possible.)

comment 16y ago · link · parent

What exactly you didn't like?

8.

PEG.js - parser generator for JavaScript(pegjs.majda.cz ↗)

74 points · by dmajda · 16y ago · 43 comments

9.

Rubinius 1.0.0RC1 released(rubini.us ↗)

44 points · by dmajda · 17y ago · 5 comments

comment 17y ago · link · parent

Thanks :-)

The source code is available on my website: http://www.majda.cz/download/translating-ruby-to-php-cd.tar..... I didn't push it on GitHub because I didn't indend to develop the compiler further after finishing the thesis.

The code is BSD-licensed however, so if anyone wants to hack on it, he is free to go :-)

comment 17y ago · link · parent

I begun to work on the master thesis when there was no mod_rails, Rails hostings were less common and they were more expensive than PHP hostings. So the other commenters in this thread are right about the "deployability" reason.

When the work was being finished, I aleready saw that the real-world usefulness of the compiler is minimal. This is why I didn't develop the compiler further after finishing the thesis.

comment 17y ago · link · parent

The PCNTL extension is about process control, not threading. I don't see how it could help to solve the limitations mentioned in the section 7.1 of the thesis.