oscript.translator
Class FunctionDeclarationTranslator

java.lang.Object
  extended byoscript.translator.FunctionDeclarationTranslator

public class FunctionDeclarationTranslator
extends java.lang.Object

A translator to implement one part of the language in terms of another. This simplifies the compiler/interpreter implementation. This translates from:

   Permissions "function"  "(" Arglist ")" ("extends" ...)?
   "{"
     Program
   "}"
 
to
   Permissions "var"  "=" "function" "(" Arglist ")" ("extends" ...)?
   "{"
     Program
   "};"
 

Version:
0.1
Author:
Rob Clark

Constructor Summary
FunctionDeclarationTranslator()
           
 
Method Summary
static Node translate(FunctionDeclaration n)
          Convert a FunctionDeclaration production in the syntaxtree into an equivalent production.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FunctionDeclarationTranslator

public FunctionDeclarationTranslator()
Method Detail

translate

public static Node translate(FunctionDeclaration n)
Convert a FunctionDeclaration production in the syntaxtree into an equivalent production.
 f0 -> Permissions(true)
 f1 -> "function"
 f2 -> <IDENTIFIER>
 f3 -> "("
 f4 -> ( Arglist() )?
 f5 -> ")"
 f6 -> ( "extends" PrimaryExpressionWithTrailingFxnCallExpList() FunctionCallExpressionList() )?
 f7 -> "{"
 f8 -> Program(true)
 f9 -> "}"