User loginNavigation |
Human language and machine languageI am reading The language instinct from Steven Pinker. Some of the examples he has are very familiar to compiler construction. Shift/Reduce conflictis a conflict in LALR grammars (most programming languages) where in the parser has to decide between shifting a new token for a rule or reducing the rule. Quoting Stephen C. Johnson from the YACC paper As an example of the power of disambiguating rules, consider a fragment from a programming language involving an ``if-then-else'' construction:That is during a shift/reduce conflict, LALR parsers chose shift over reduce, implying that clauses are always associated with the innermost clause.stat : IF '(' cond ')' stat | IF '(' cond ')' stat ELSE stat ; On the human side of the equation, Steven Pinker talks about Chomsky's classic illustration of turning a declarative sentence into a question A unicorn is in the garden -> Is a unicorn in the garden? This is done by taking the auxiliary "is" and moving it. However, this is not a simple move as illustrated in the below case A unicorn that is eating a flower is in the garden -> Is a unicorn that is eating a flower in the garden? Chomsky argues that our mental algorithm does not pick words by their linear positions, but does so by grouping it into phrases, implying that during a conflict the mind chooses entire units together. Does this mean that the designers of LALR were goaded by their mintal algorithm to chose shift instead of reduce? Or does this mean that language is an algorithm (albeit more powerful than any parser) that is wired into our brain - and evolution chose shift over reduce because that is the easier one to implement? Also at here By kusimari at 2009-07-18 03:39 | LtU Forum | previous forum topic | next forum topic | other blogs | 5355 reads
|
Browse archives
Active forum topics |
Recent comments
23 weeks 1 day ago
23 weeks 1 day ago
23 weeks 1 day ago
45 weeks 2 days ago
49 weeks 4 days ago
51 weeks 1 day ago
51 weeks 1 day ago
1 year 1 week ago
1 year 6 weeks ago
1 year 6 weeks ago