Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Mushfeq Khan
RE: Dhaka Lexer [ reply ]  
2010-07-29 10:42
Hi Ricky,
Thanks for posting your solution. It's probably not a good idea for the lexer object to have a display string that actually tries to dump out its contents. This could be fixed very easily in the Lexer class.

Mushfeq.

By: Ricky Robinson
RE: Dhaka Lexer [ reply ]  
2010-07-29 00:28
"Problem" identified.

The issue was that when the following expression is evaluated in IRB, the resulting lexer object is displayed at the prompt:

lexer = Dhaka::Lexer.new(ArithmeticPrecedenceLexerSpecification)

But the lexer is such a complicated object that displaying it at the prompt takes an absolute eternity and causes your machine to thrash like crazy. The problem does not show itself if you run the above as a script. I guess when I used Dhaka last and it worked for me, I didn't test it out in IRB!

To overcome the issue in IRB, simply append "nil" to the statement to prevent display of the resulting lexer object:

lexer = Dhaka::Lexer.new(ArithmeticPrecedenceLexerSpecification); nil

Hope that helps someone.

By: Ricky Robinson
Dhaka Lexer [ reply ]  
2010-07-28 05:52
I'm on Mac OS X, Ruby 1.8.7 using dhaka-2.2.1. Whenever I try to create a new lexer using a specification that contains repetition operators (+*?), it just hangs. This includes any attempt to create a lexer using the provided test examples (Chittagong and ArithmeticPrecedence).

>> require 'dhaka'
=> true
>> require '/Library/Ruby/Gems/1.8/gems/dhaka-2.2.1/test/arithmetic_precedence/arithmetic_precedence_lexer_specification'
=> true
>> lexer = Dhaka::Lexer.new(ArithmeticPrecedenceLexerSpecification)
<Hangs right here>

I've tried this on two other machines (Debian with Ruby 1.8.7 and Fedora with Ruby 1.8.6), with the same result.

Note that all this used to work when I last tried it about a year ago, so I'd say some gem upgrade somewhere along the way is the culprit.

Is anyone else experiencing this problem?

Ricky