| Hi Andrey, yes removing is a good first 
step. 
  
  
  
    
    Generalize the 
    ASTNode hierarchy so it better fits all dynamic languages. Various languages 
    have different notions of what an '_expression_' and a 'statement' are. I 
    suggest removing _expression_ and Statement from the ASTNode hierarchy (i.e. 
    flattening the hierchy). I believe those nodes are mostly unused already, so removing them 
  completely would be a logic step forward. +1. 
 
    
    Modify the ASTVisitor to support the flattened hierarchy, 
    currently it has visit(_expression_ ..) visit(Statement..) 
    visit(MethodDeclaration... visit(ModuleDeclaration and 
    visit(TypeDeclaration... change to something like visitExpression(ASTNode.. visitStatement(ASTNode 
    etc and each node would have to call the appropriate visit 
    method.   For supporting a single language it makes sense since it helps represents 
the structure/logic of the grammar/ast but it's not required and since it's 
problematic for multiple languages, I think you are probably right that we could 
ignore it in the visitor. 
   Is there any reason to 
  differentiate statements and expressions at the visitor level? Is anything in 
  DLTK core interested in that information at all? 
 
    
    AST's would probably have to be created from factories so 
    they can be configured for each language (ie whether an type of node is a 
    statement or _expression_).  Yes that makes sense. I guess we need input from some of 
the other languages, do they need the information about whether something 
is an _expression_ or not?  
  I believe a somewhat better idea is to provide abstract AST classes, so 
  that concrete language frameworks can derive from them and provide specific 
  language-dependant behaviour/properties, such as whether the node is a 
  statement. 
 On the other hand, we might finally have some use for Bit1..Bit64 flags. 
  (BTW my request to add another 64 was completely ignored. I still miss 
  them!)    Just curious what did you want the extra bits for?   Mark  
  
 Anyway, the method of AST node creation is up to the language framework, 
  so this does not really matter for the design of DLTK core. 
 
 Andrey. 
 |