[antlr-interest] Antlrworks 1.4.1, OS X 10.6.5 and debugging issues

Christopher Hunt huntc at internode.on.net
Sun Dec 12 14:55:41 PST 2010


Just out of interest, I reverted to 1.4 and had the same problem. So, while there may be some other problem with 1.4.1, there is probably and issue with my grammar. Here's the grammar so far in case anyone has thoughts (it parses the zoneinfo database (1) - I'll release this to the ANTLR site when finished):

/*
 * Copyright 2010 Class Action P/L
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
grammar Zoneinfo;

options {
	output=AST;
	ASTLabelType=CommonTree;
	language=Java;
}
	
@header {
	package com.classactionpl.tz;
}

@lexer::header {
	package com.classactionpl.tz;
}

line
	: (ruleLine | zoneLine | linkLine | NEWLINE)*
	;

ruleLine
	: 'Rule' ruleName ruleFrom ruleTo ruleType ruleIn ruleOn ruleAt ruleSave ruleLetters NEWLINE
	;

zoneLine
	: 'Zone' zoneName zoneGmtOffset zoneRules zoneFormat 
	(zoneUntil NEWLINE+ zoneGmtOffset zoneRules zoneFormat)* 
	NEWLINE
	;

linkLine
	: 'Link' linkFrom linkTo NEWLINE
	;

ruleName
	: ID
	;
	
ruleFrom
	: INT | YEAR_MINMAX
	;
	
ruleTo
	: INT | YEAR_MINMAX | ONLY_YEAR
	;
	
ruleType
	: '-' | YEAR_TYPE
	;
	
ruleIn
	: MONTH
	;
	
ruleOn
	: INT | LAST_DAY | (DAY_OF_WEEK DAY_COMPARATOR INT)
	;
	
ruleAt
	: '-' | (positiveTime TIME_OF_DAY_SUFFIX?)
	;
	
ruleSave
	: '-' | positiveTime
	;
	
ruleLetters
	: '-' | ID
	;

zoneName
	: ID
	;

zoneGmtOffset
	: offset
	;
	
zoneRules
	: '-' | positiveTime | ID
	;
	
zoneFormat
	: ID ('/' ID)?
	;

zoneUntil
	: INT (ruleIn (ruleOn ruleAt?)?)?
	;

linkFrom
	: ID
	;
	
linkTo
	: ID
	;
	
offset
	: '-'? positiveTime
	;

positiveTime
	: INT (':' INT (':' INT)?)?
	;

YEAR_MINMAX
	: 'min' | 'max'
	;

ONLY_YEAR
	: 'only'
	;
	
YEAR_TYPE
	: 'even' | 'odd' | 'uspres' | 'nonpres' | 'nonuspres'
	;

MONTH
	: 'Jan' 'uary'? 
	| 'Feb' 'ruary'? 
	| 'Mar' 'ch'? 
	| 'Apr' 'il'? 
	| 'May' 
	| 'Jun' 'e'? 
	| 'Jul' 'y'? 
	| 'Aug' 'ust'? 
	| 'Sep' 'tember'? 
	| 'Oct' 'ober'? 
	| 'Nov' 'ember'? 
	| 'Dec' 'ember'?
	;

LAST_DAY
	: 'last' '-'? DAY_OF_WEEK
	;

DAY_OF_WEEK 
	: 'Sun' 'day'? 
	| 'Mon' 'day'? 
	| 'Tue' 'sday'? 
	| 'Wed' 'nesday'? 
	| 'Thu' 'rsday'? 
	| 'Fri' 'day'? 
	| 'Sat' 'urday'?
	;
	
DAY_COMPARATOR
	: '<=' | '>='
	;

TIME_OF_DAY_SUFFIX
	: 'w' | 's' | 'u' | 'g' | 'z'
	;

INT
	: ('0'..'9')+
	;

ID
	: ('a'..'z'|'A'..'Z'|'%')('a'..'z'|'A'..'Z'|'0'..'9'|'%'|'/'|'_'|'-')*
	;

NEWLINE
	: ('#' ~('\n'|'\r')*)? '\r'? '\n' | EOF
    	;

WS
    	: (' ' | '\t') {skip();}
    	;


Kind regards,
Christopher

(1) http://www.twinsun.com/tz/tz-link.htm

On 10/12/2010, at 10:08 PM, Christopher Hunt wrote:

> Hi there,
> 
> I'm using Antlrworks v.1.4.1 on Mac OS X 10.6.5 and find that I cannot debug my grammar, despite all being well via the interpreter.
> 
> Here are my steps:
> 1. Open a grammar
> 2. Run/Debug...
> 3. Select a file as input (makes no difference if I use the text option) and confirm
> 
> I then receive the generating/connecting messages and note that a socket connection is established i.e.:
> 
> netstat -an|grep 49100
> tcp4       0      0  127.0.0.1.49100        127.0.0.1.60879        ESTABLISHED
> tcp4      27      0  127.0.0.1.60879        127.0.0.1.49100        ESTABLISHED
> tcp46      0      0  *.49100                *.*                    LISTEN
> 
> Clicking on any of the play buttons (step, step over etc.), appears to do nothing. The only event shown is "commence". If I stop the debugger I have to click the stop button twice whereupon it force quits (a single stop doesn't appear to do anything).
> 
> Are there known issues with my configuration?
> 
> Thanks for your help.
> 
> Kind regards,
> Christopher



More information about the antlr-interest mailing list