Better HN
topnewbestaskshowjobs
Log inSign up

panic

29,749 karma · joined Sep 16, 2009 (17y ago) · 3,593 submissions

Submissions

comment 8y ago · link · parent

Is it possible to recreate a wheat plant from just its genome?

1292.

Chattanooga’s EPB, a Community-Run ISP, Is the Highest Rated Broadband in the US(motherboard.vice.com ↗)

3 points · by panic · 8y ago · discuss

comment 8y ago · link · parent

Thank you for sharing your perspective. It's sad (but somewhat unsurprising at this point) that in a discussion about gender, the only post recognizably written by a woman is at the bottom of the page.

1294.

Not All Blue Noise Is Created Equal(blog.demofox.org ↗)

2 points · by panic · 8y ago · 1 comment

comment 8y ago · link · parent

I wonder what Schrödinger would have thought of the Free Will Theorem: https://arxiv.org/pdf/quant-ph/0604079.pdf

comment 8y ago · link · parent

Would it make sense to add a redirect on Wikipedia for this?

1297.

Vienna Offers Affordable and Luxurious Housing (2013)(governing.com ↗)

2 points · by panic · 8y ago · discuss

comment 8y ago · link · parent

Ah, you're right -- the "continue" button shows them. Never mind!

comment 8y ago · link · parent

Is there a reason they don't print the high school students' names? It seems like they should be given some sort of credit for their work.

comment 8y ago · link · parent

Is there a connection to geometric algebra here? The similarity of the final result to the geometric product (a dot b + a cross b) seems like it can't just be a coincidence.

comment 8y ago · link · parent

This quote from http://erights.org/e/StateSerialization.html has always stuck in my mind:

Do you, Programmer, take this Object to be part of the persistent state of your application, to have and to hold, through maintenance and iterations, for past and future versions, as long as the application shall live?

- Erm, can I get back to you on that?

comment 8y ago · link · parent

I've seen people on Twitch playing multiplayer Mario Party using Dolphin's multiplayer support, and it seemed to work pretty well. I think the trick is to add latency until everyone's inputs can be played in lockstep.

comment 8y ago · link · parent

Yeah, it absolutely is. But discrimination can be difficult to see unless you're one of the people being discriminated against. I think we should let this thread be a place for LGBT people to share their experiences rather than filling it with discussion about whether these experiences are valid or not.

comment 8y ago · link · parent

I think OP is looking for something above the baseline of "nobody seems to care".

comment 8y ago · link · parent

I love how philosophy-driven this library is. Most graphics libraries work upwards from whatever primitives the platform provides—Pts pushes its concept of geometry downwards onto the platform instead. The result is artistically coherent, not just visually, but all the way through to the code itself. Really great work!

comment 8y ago · link · parent

To be fair, the name is pretty terrible! ("Prefix tree" is a much better name for them IMO)

1307.

Chaff Bugs: Deterring Attackers by Making Software Buggier(arxiv.org ↗)

3 points · by panic · 8y ago · discuss

comment 8y ago · link · parent

Yeah, this is a fundamental problem. Luckily, arithmetic expressions are always left- or right-recursive, never middle-recursive. That means they're recognizable by a regular grammar, even if the parse tree doesn't match what you'd expect:

    expr = number (('*' | '+') number)*
You can replace number by (number | [ '(' expr ')' ]) to add support for parentheses as well.

My solution was to add special syntax which makes rules like this automatically:

    expr = number : num
     .operators infix left '*' : times
     .operators infix left '+' : plus
While the parse tree is built, the operators and operands are rearranged into the expected parse tree using https://en.wikipedia.org/wiki/Shunting-yard_algorithm. Here's an interactive example with some more operators: https://ianh.github.io/owl/try/#expr

comment 8y ago · link · parent

Beaker is really cool! There's a big list of sites built for it here: https://github.com/beakerbrowser/explore.

comment 8y ago · link · parent

I always thought something like this would be neat to explore further: https://www.youtube.com/watch?v=gifzjhyBwOc (warning: contains some intense flashing at a couple points).

A GUI is ultimately producing a stream of actions; these actions can be reified as text and displayed. Then you can copy the text to perform the actions again, modify the text, include it in scripts, and so on.

comment 8y ago · link · parent

Has anyone tried putting LIDAR in a human-driven car? It seems like a heads-up display with a 3D image of your surroundings would improve safety even for human drivers (plus it would look really cool).

comment 8y ago · link · parent

Because it makes more people click on the link.

comment 8y ago · link · parent

I think they're the same thing, though IIRC tree grammars are usually defined to operate on actual trees rather than strings of text.

comment 8y ago · link · parent

Thanks! This is something I want to fix eventually. These papers will be very helpful.

comment 8y ago · link · parent

Thanks! The two biggest uses of Owl right now are Owl itself (see grammar.owl in the root directory) and the "egg" programming language which is included as an example: https://github.com/ianh/owl/tree/master/example/egg-lang. I'm hoping to use it in some future projects as well!

comment 8y ago · link · parent

Yeah, they both solve the same problem -- turning text into a structured "parse tree".

At the core of each parsing tool is a particular parsing algorithm. The details of this algorithm determine what kind of text the parser can parse, how efficiently it can parse it, and what kind of error messages you get if something goes wrong.

There's a huge variety of these algorithms, but nearly all of them are variations on two basic types: "LL" and "LR" parsers. For example, ANTLR uses an "LL(*)" parsing algorithm. This is a great blog post about the difference between the two basic types: http://blog.reverberate.org/2013/07/ll-and-lr-parsing-demyst....

Owl is unique because its algorithm isn't a variation of either of these. It works more like a regular expression parsing algorithm. This makes it more limited than a tool like ANTLR, but it can solve some problems that have been difficult with the existing algorithms.

For example, most programming languages allow expressions like "1 - 2" to be used as statements. If you don't use a semicolon or anything to separate the statements, there's an ambiguity -- is "1 - 2" a single expression, or is it the two expressions "1" "-2" in sequence?

ANTLR (at least with the default settings I tried) doesn't tell you about this ambiguity at all. It just picks one of the two options ("1 - 2" in this case). This may or may not have been what you were expecting! The problems with ambiguity checking are quite deep (this followup to the earlier blog post I linked goes into more detail: http://blog.reverberate.org/2013/09/ll-and-lr-in-context-why...). Owl's parsing algorithm avoids these problems; it can show you the ambiguity in all cases.

comment 8y ago · link · parent

Yeah, there's explicit support for expressions (left recursive and right recursive) using '.operators', which creates a group of operators at the same precedence level:

    expr =
       identifier : var
     .operators postfix
       '.' identifier '(' args ')' : method-call
     .operators infix left
       '+' : plus

comment 8y ago · link · parent

> Can you provide some intuition on which languages can be parsed by this algorithm, and which can't?

The restriction is that any recursion in the grammar has to be inside explicit begin and end tokens. For example, you can't write a rule like

    stmt = 'if' expr 'then' stmt* | expr
because `stmt` refers to itself directly, but

    stmt = [ 'if' expr 'then' stmt* 'end' ] | expr
is OK -- the [ and ] symbols indicate explicit recursion using 'if' and 'end' as the begin and end tokens.[1]

> Btw, why did you choose the name Owl?

I wanted a bird name, and Owl was short and easy to type!

. . .

[1] Though in this case, the language is still visibly pushdown, since you can expand it manually to:

    stmt = (('if' expr 'then')+ expr*)+ | expr
This is because the grammar only has right recursion. Middle recursion (like you get if you add an 'else' clause) can't be expanded like this, so explicit recursion is necessary to parse languages which use it.

To automate this expansion process (and re-association into a sensible parse tree), Owl also has syntax for operators with precedence. Here's an example: https://ianh.github.io/owl/try/#expr

1319.

Show HN: Owl, a new kind of parser generator(github.com ↗)

156 points · by panic · 8y ago · 42 comments

1
434445
120