Re: [9fans] yacc question - Plan9

This is a discussion on Re: [9fans] yacc question - Plan9 ; i think the key is that you need to define %left MUL rather than trying to use '×'. this is going to try to index an array of len 255 by the codepoint of '×', which is why you're getting ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Re: [9fans] yacc question

  1. Re: [9fans] yacc question

    i think the key is that you need to define
    %left MUL
    rather than trying to use '×'. this is going to try to index
    an array of len 255 by the codepoint of '×', which is why you're
    getting a sucicide.

    also, if you are doing this, you need to replace each Bgetc with Bgetrune.
    and Bungetc with Bungetrune. here's about what you want. but, warning,
    i didn't compile this.


    int
    getr(void *)
    {
    return Bgetrune(src);
    }

    int
    yylex(void)
    {
    int r;

    while((r = Bgetrune(src)) == ' ' || c == '\t')
    ;
    if(r == Beof)
    return 0;
    if(r == '.' || (isasciirune(r) && isdigitrune(r))){
    Bungetrune(src);
    yylval = charstod(getr, 0);
    Bungetrune(src);
    return NUMBER;
    }
    if(r == L'×')
    return MUL;
    if(c == '\n')
    lineno++;
    return r;
    }

    you can also look at the patch i submitted to hoc
    last summer to allow runic constants like π and γ.

    - erik

  2. Re: [9fans] yacc question

    given russ' observation, i'm probablly wrong about the sucicide.

    - erik

+ Reply to Thread