Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Why would we want more than LALR(1)?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Mon Mar 28, 2016 5:20 pm    Post subject: Why would we want more than LALR(1)? Reply with quote

For a programming-language, can anyone give examples of how a grammar that is more complex than standard LALR(1), would actually interest a working programmer?
ie: examples of syntactic constructs, that cannot be parsed by LALR(1); note that LL(1) is a subset (recursion rewrite notwithstanding.)

They must actually enable something useful, that we cannot get currently, sufficient for us to say "yeah, that's worth the hassle."
That ad-hoc language X has some construct or other, does not count in and of itself: it must actually be something you consider useful, preferably essential, that could not be more simply-expressed.

In a decade on IRC, and many people rambling on about GLL etc, I have yet to see what's so spiffy about it all.
Pardon my ignorance if it's all rather obvious (just enlighten me, though: don't emphasise my limitations. ;)
Back to top
View user's profile Send private message
v_andal
Guru
Guru


Joined: 26 Aug 2008
Posts: 541
Location: Germany

PostPosted: Tue Mar 29, 2016 8:14 am    Post subject: Reply with quote

Well, this sounds like a very funny question to me. Your criteria is "interest a working programmer" and that thing really depends on the taste of particular programmer. So, you'll end up arguing if something is of any "interest" or not. That is as funny as arguing about "taste of chicken" :) For example, I'm a working programmer that has "interest" only in pure C and Assembler. And I don't really understand why people might be interested in C++, Rust, or any other stuff. But people do find those languages very useful. To me it appears, that people can have "interest" in all kinds of stuff that I consider to be completely useless. So, quite possible that there are a lot of "working programmers" out there that have "interest" in constructs that can not be parsed by LALR(1). To you, those constructs would seem to be useless and boring. Tastes differ, you know :D
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Tue Mar 29, 2016 9:46 am    Post subject: Reply with quote

So basically what you are saying is: I don't use any such language, but if I did, it would be entirely subjective what I found useful.

The latter seems rather self-evident, and is not the problem you make it out to be; the subjective experience is precisely what I am asking about.

The notion that I would argue about that, is ludicrous.

Sure I might not find it of interest, but that's neither here nor there in terms of arguing with someone about their feelings, a completely futile exercise.

If you are not interested in the discussion, then by all means ignore it.
To a certain extent, it is meant to be self-selecting, as in if you don't know what LALR(1) means, then it's not going to be very interesting to you. (hence the subject line.)
OTOH someone like mv, knows exactly what is under discussion, without further explanation.

I'm not trying to be unfriendly, or grumpy; I'm just not interested in meta-discussion, or discussion about the discussion, and not the substantive topic.

Whatever my personal feelings on a construct, I would never expect a fellow Gentoo user to stop using something they liked because of my opinion, nor even to give that much of a damn what my opinion would be, if they liked it. That's kind of standard for the forums: use what you want, and we discuss bits that others might find useful. If not, who cares.
Specifically on languages, I concur with the Perl community's Tim Toady; There's More Than One Way To Do It.

Thanks for understanding.
Back to top
View user's profile Send private message
ArneBab
Guru
Guru


Joined: 24 Jan 2006
Posts: 429
Location: Graben-Neudorf, Germany

PostPosted: Wed Feb 22, 2017 3:58 pm    Post subject: Reply with quote

I just hit this while searching for rust, and I found it interesting. It caused me to look at https://en.wikipedia.org/wiki/GLR_parser

An practical answer could be: When parsing javascript (ECMAscript) with Guile, I see lots of shift/reduce conflicts.

Another answer could be: We could go for more natural languages: A smaller core vocabulary could describe more structures when we allow for more (temporary) ambiguity.

Examples:

Code:
when i is in 1 5

Code:
when i is in [1, 5]

Code:
when i is in "1 5"

Code:
when i is in 1 5 or in 3 7

Code:
when i is empty

Code:
when i is 1

Code:
when i occurs in 1 5 or in 3 7


Could these be parsed with a LALR parser? (I really do not know, that’s why I ask)

The exact meaning of "is" and "in" change with their surroundings, but the meaning of the line is clear for humans.

This haskell page lists uses for GLR: https://www.haskell.org/happy/doc/html/sec-glr-misc.html
_________________
Being unpolitical means being political without realizing it. - Arne Babenhauserheide ( http://draketo.de )

pkgcore: So fast that it feels unreal - by doing only what is needed.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Wed Feb 22, 2017 9:29 pm    Post subject: Reply with quote

steveL wrote:
Specifically on languages, I concur with the Perl community's Tim Toady; There's More Than One Way To Do It.

There's only one way to parse Perl code reliably though, and it's not LALR ;)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum