Jun 10

When there is ambiguities in writing antlr grammar, there are different ways to solve it.

1. Simply avoid them. This is the ideal way when it’s possible.

2. Turn on backtracking, which is most inefficient way.

3. Use left factoring.

4. Use syntax predicates.

For some samples, check it out at http://www.antlr.org/wiki/display/ANTLR3/How+to+remove+global+backtracking+from+your+grammar

The format of sytnax predicate is close to semantic predicates. There are 3 types of them:

1. Validating semantic predicate, to place constraints on rules. For example
data : ( b += BYTE )+ {$b.size() <= 4}? ;
2. Gated semantic predicate, to turn on some alternatives under runtime condition. For example:
stat: ifState | {allowAssert}?=> assertStat ;
3. Disambiguating semantic predicate, to choose alternatives based on semantic context. For example:
stat: keyIf ID stat | keyCall ID ‘;’ ;
keyIf: {input.LT(1).getText().equals(”if”)}? ID ;
keyCall: {input.LT(1).getText().equals(”call”)}? ID ;

  • Share/Bookmark
May 03

Here is a good article explaining how to read cassandra source codes:

Understanding Cassandra Code Base
http://prettyprint.me/2010/05/02/understanding-cassandra-code-base/

  • Share/Bookmark
Apr 07

Check it out at http://skorage.org/2009/03/08/simple-thrift-tutorial/

  • Share/Bookmark
Apr 06

In Firefox, visit:

about:config

Then set network.automatic-ntlm-auth.trusted-uris to your trusted domains, separated by comma.

  • Share/Bookmark
Apr 02

Some of my thoughts: Unit tests are very important in TDD. It enables you easily refactor code, adhere to customer requirements, and verify logics at earliest points. It also enables Continuously Integration to work brilliantly.

  • Share/Bookmark
Mar 02

There is a famous Cassandra PPT at SigMod 2008. In one slide, they presented several interesting lessons:

  1. Add fancy features only when absolutely required
  2. Many types of failures are possible
  3. Big systems need proper system-level monitoring
  4. Value simple designs

These lessons are interestingly useful. :-)

  • Share/Bookmark
Feb 06

This is pretty interesting:

The Visualization of Browser War

The Visualization of Browser War

  • Share/Bookmark
Feb 05

This should be a good tutorial. I need to look into it:

http://www.ibm.com/developerworks/edu/os-dw-os-ecl-commplgin1.html

I know there is an excellent tutorial in Chinese. It demos how to craft a source code editor using Eclipse JFace Text Framework and a bit ANTLR. The link is here.

  • Share/Bookmark
Feb 05

Here are some tutorial links for learning antlr v3:

  1. The Getting Started Tutorial from Official Site is Damn Good!
  2. ANTLR Works is a damn good tool!
  3. The Definitive Antlr Reference is a good book
  4. ANTLR 3.X Tutorials are good video course and introduced a damn good eclipse tool: ANTLR IDE.
  • Share/Bookmark
Feb 03

After installing Ubuntu 9.10, eclipse became naughty. I tried to create a Java Project. However, mouse-click on Next/Finish buttons didn’t work. The buttons got focused, but no response. So you have to press ENTER or SPACE to actually press the buttons.

A quick fix here: create a shell script. For example, eclipse.sh:

export GDK_NATIVE_WINDOWS=1
/home/frankdu/Developer/eclipse/eclipse

Then add executable permission to the file: chmod +x ./eclipse.sh

Every time you run eclipse.sh to launch eclipse. At least we can be happy for a while. Please see http://www.eclipse.org/forums/index.php?t=msg&goto=498640& for more information.

  • Share/Bookmark