Thursday 29 July 2010

To the Barber Shop

Thursday 15 July 2010

Line Number Information in BYacc/J

In order to know until which line parsing has been done, we can utilize %line directive in JFlex specification and add relevant methods.

%byaccj
%line
%column

%{
  private Parser yyparser;

  public Yylex (java.io.Reader r, Parser yyparser) {
    this (r);
    this.yyparser = yyparser;
  }

  int getLineNum () {
    return (yyline+1);
  }

  int getColNum () {
    return (yycolumn+1);
  }
%}

"yyline+1" expression is needed because JFlex starts counting from 0.

To get the position information in BYacc/J, add several lines in the specification:

private Yylex lexer;

public void yyerror (String strError) {
  System.err.println ("Error at line: " + lexer.getLineNum() + ": " + strError);
}

Monday 12 July 2010

Piala Itu Tidak Bundar

Friday 9 July 2010

Isra Mi'raj Dunia

Hayoooo... mana yang lebih seru? Sholat lima waktu apa perebutan tempat ketiga final Piala Dunia 2010?

Siap-siap begadang buat nonton pertandingan bola, apa siap-siap buat sholat Tahajud?

10 Juli 2010. 27 Rajab 1431.