Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a21ed003181ebde9

Jump to content

Talk:Lexer hack

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
Latest comment: 2 years ago by Jr-00000 in topic Clang

(A) (*B) Not Unambigous

[edit]

The article states that this is an unambigous cast, but it's not. If A is a function it's a function call. Example:

int A(int _b) {
    return _b;
}

int main(void) {
    int  C = 134;
    int *B = &C;
    int D = (A) (*B);  // The function call

    printf("%d", D);
}

Untitled

[edit]

This article provides no explanations for its technical terms nor are the terms linked to other articles to provide any explanation. Please expand and make accessible for the majority of readers. Velela 17:45, 21 May 2006 (UTC)Reply

I've added a bit to help:
  • a brief explanation of the lexing-parsing process to provide some context of where this occurs in compilation
  • an example to bring this down from the technical level of C language implementers to C language programmers
So it's still technical, but I hope that readers with a basic understanding of C should be able to get the idea. --Mrwojo (talk) 04:11, 27 November 2008 (UTC)Reply

Clang

[edit]

According to the reference given (Eli Bendersky's website), clang can get rid of 'the lexer hack' because it is using a recursive / backtracking parser (which allows it to try different interpretations, and tag lexical items with semantic info). Please explain how this supports the claim that clang is using a "non-reference lexical grammar".

Using the example given in this article, if using a LALR parser, it would be impossible to reinterpret "var*(var_or_type)*var" as "var*((type)*var)" instead of "(var*(var))*var" without throwing away the whole syntax tree.  Preceding unsigned comment added by 2A02:2F0E:D2A1:4B00:B165:DC79:CC95:1986 (talk) 23:17, 31 January 2017 (UTC)Reply

I believe clang uses an equivalent of GLR parsing technique. Lightness1024 (talk) 09:42, 7 February 2020 (UTC)Reply
Clang does not use GLR and has never to my knowledge used GLR. Clang uses a hand-written recursive descent parser, e.g. ParseIfStatement. Jr-00000 (talk) 04:55, 20 June 2024 (UTC)Reply