[antlr-interest] new action syntax proposal

Kay Roepke kroepke at classdump.org
Fri Jul 13 17:24:37 PDT 2007


On Jul 14, 2007, at 2:04 AM, Gavin Lambert wrote:

> Well, the last I recall ANTLR didn't handle nested {}s anyway,  
> meaning that if you wanted to use them you had to use \{ and \}.   
> So that would look different, and wouldn't be a problem.

No, curlies are alright.

> Or am I thinking of nested []s for parameters?  Or possibly I'm  
> just going mad :)

The thing that cropped up a week or so ago were the []s inside  
parameters/return values. Things like

rule returns [String[] ary]
	:	stuff ;

> Anyway, another option could be to use a magic prefix symbol.  @ 
> {...} springs to mind for some reason, though I don't know why ;)   
> {Maybe it's from literal strings in C#.]

mmh. I think the delimiters should look like 'always' a bit. It's bit  
undefined what 'always' looks like, but it should be (1) easily  
recognizable, and (2) consistent.

Sort of like {} means action and {}? means semantic (=code)  
predicate. {}! is not really good, since it fails rule 1. Doubling  
the curlies satisfies both rules, with caveat I pointed out.
It should definitely be something with curlies, since they are  
actions. Maybe it's time to look for an Unicode character that's  
describe as 'always'?

;)

cheers,
-k

-- 
Kay Röpke
http://classdump.org/






More information about the antlr-interest mailing list