Java Doc for LispCompiler.java in  » Scripting » Jatha » org » jatha » compile » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » Jatha » org.jatha.compile 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jatha.compile.LispCompiler

LispCompiler
public class LispCompiler (Code)
LispCompiler has a compile() method that will compile a LISP expression and return the SECD code for that expression. Example LISP read/eval/print loop:
 expr   = parser.read(stream);
 code   = compiler.compile(expr);
 result = machine.eval(code);
 result.print();
 

Macro compilation contributed by Jean-Pierre Gaillardon, April 2005


See Also:   org.jatha.machine.SECDMachine
See Also:   org.jatha.machine.SECDop
author:
   Micheal S. Hewett hewett@cs.stanford.edu


Field Summary
 LispValueAMP_REST
    
 LispValueAND
    
static  booleanDEBUG
    
 LispValueDEFMACRO
    
 LispValueDEFUN
    
 LispValueDUMMY_FUNCTION
    
 LispValueDUMMY_MACRO
    
 LispValueIF
    
 LispValueLAMBDA
    
 LispValueLET
    
 LispValueLETREC
    
 LispValueMACRO
    
 LispValueOR
    
 LispValuePRIMITIVE
    
 LispValuePROGN
    
 LispValueQUOTE
    
 LispValueSETQ
    
 booleanWarnAboutSpecialsP
    

Constructor Summary
public  LispCompiler(Jatha lisp)
    

Method Summary
public  voidRegister(LispPrimitive primitive)
     Use this function to register any new LISP primitives that you create from Java code.
public  voidRegister(LispPrimitive primitive, LispPackage pkg)
     Use this function to register any new LISP primitives that you create from Java code.
public  voidRegister(LispPrimitive primitive, String pkgName)
     Use this function to register any new LISP primitives that you create from Java code.
public  voidWarnAboutSpecials(boolean value)
    
public  LispValuecompile(SECDMachine machine, LispValue expr, LispValue varValues)
     compile takes a LISP expression, a list of global variables, and optionally an already-generated list of code.
public  LispValuecompile(LispValue expr, LispValue valueList, LispValue code)
     compile takes a LISP expression, a list of global variables, and optionally an already-generated list of code.
 LispValuecompileAnd(SECDMachine machine, LispValue args, LispValue valueList, LispValue code)
    
 LispValuecompileAndAux(LispValue dummyVar, LispValue args)
    
 LispValuecompileApp(SECDMachine machine, LispValue args, LispValue valueList, LispValue code)
    
 LispValuecompileAppConstant(SECDMachine machine, LispValue args, LispValue valueList, LispValue code)
    
public  LispValuecompileArgsLeftToRight(LispValue args, LispValue valueList, LispValue code)
    
 LispValuecompileAtom(SECDMachine machine, LispValue expr, LispValue valueList, LispValue code)
    
 LispValuecompileBuiltin(SECDMachine machine, LispValue fn, LispValue args, LispValue valueList, LispValue code)
    
public  LispValuecompileConstantArgsLeftToRight(SECDMachine machine, LispValue args, LispValue valueList, LispValue code)
    
 LispValuecompileDefmacro(SECDMachine machine, LispValue name, LispValue argsAndBody, LispValue valueList, LispValue code)
    
 LispValuecompileDefun(SECDMachine machine, LispValue name, LispValue argsAndBody, LispValue valueList, LispValue code)
    
 LispValuecompileIf(SECDMachine machine, LispValue test, LispValue thenExpr, LispValue elseExpr, LispValue valueList, LispValue code)
    
 LispValuecompileLambda(SECDMachine machine, LispValue body, LispValue valueList, LispValue code)
    
public  LispValuecompileLet(SECDMachine machine, LispValue vars, LispValue values, LispValue valueList, LispValue body, LispValue code)
    
 LispValuecompileList(SECDMachine machine, LispValue expr, LispValue valueList, LispValue code)
    
 LispValuecompileOptimizedIf(SECDMachine machine, LispValue test, LispValue thenExpr, LispValue elseExpr, LispValue valueList, LispValue code)
    
 LispValuecompileOr(SECDMachine machine, LispValue args, LispValue valueList, LispValue code)
    
 LispValuecompileOrAux(LispValue dummyVar, LispValue args)
    
 LispValuecompileProgn(LispValue body, LispValue valueList, LispValue code)
    
 LispValuecompileSpecialBind(SECDMachine machine, LispValue vars, LispValue values, LispValue valueList, LispValue code)
    
 LispValuecompileSpecialForm(SECDMachine machine, LispValue function, LispValue args, LispValue valueList, LispValue code)
    
 LispValuecompileSpecialUnbind(SECDMachine machine, LispValue vars, LispValue code)
    
 LispValuecompileUserDefinedFunction(SECDMachine machine, LispValue fn, LispValue args, LispValue valueList, LispValue code)
    
public  StackgetLegalBlocks()
    
public  StackgetLegalTags()
    
public  MapgetRegisteredDos()
    
public  LispValueindexAndAttribute(LispValue e, LispValue l)
     Looks up the symbol in a list of lists. Returns a dotted pair. - first element is the attribute of the found symbol it can be "&rest" or NIL for no attribute (or if symbol has not been found) - second element is the index of the list in which it is found and the index in that list.
public  intindexInList(LispValue e, LispValue l, LispValue[] attribute)
     Looks up the symbol in a list
Parameters:
  e - a Symbol
Parameters:
  l - a list
Parameters:
  attribute - The attribute of the found symbol is assigned to attribute[0].
public  voidinit()
     Initializes the compiler by registering the LISP primitive functions so that the compiler can recognize them.
public static  booleanisBuiltinFunction(LispValue code)
     Send in either code or a symbol with a function value. Returns true only if the first element of the code list is :PRIMITIVE.
Parameters:
  code - a LISP list.
public  booleanisLegalTag(LispValue tag)
    
public  booleanisMacroCode(LispValue code)
    
public  LispValuequoteList(LispValue l)
     Returns the input list with quotes added before every top-level expression.
public  booleanspecialFormP(LispValue fn)
    
public  LispValuevaluesFromLetBindings(LispValue varValueList)
    
public  LispValuevarsFromLetBindings(LispValue varValueList)
    

Field Detail
AMP_REST
LispValue AMP_REST(Code)



AND
LispValue AND(Code)



DEBUG
static boolean DEBUG(Code)



DEFMACRO
LispValue DEFMACRO(Code)



DEFUN
LispValue DEFUN(Code)



DUMMY_FUNCTION
LispValue DUMMY_FUNCTION(Code)



DUMMY_MACRO
LispValue DUMMY_MACRO(Code)



IF
LispValue IF(Code)



LAMBDA
LispValue LAMBDA(Code)



LET
LispValue LET(Code)



LETREC
LispValue LETREC(Code)



MACRO
LispValue MACRO(Code)



OR
LispValue OR(Code)



PRIMITIVE
LispValue PRIMITIVE(Code)



PROGN
LispValue PROGN(Code)



QUOTE
LispValue QUOTE(Code)



SETQ
LispValue SETQ(Code)



WarnAboutSpecialsP
boolean WarnAboutSpecialsP(Code)




Constructor Detail
LispCompiler
public LispCompiler(Jatha lisp)(Code)




Method Detail
Register
public void Register(LispPrimitive primitive)(Code)
Use this function to register any new LISP primitives that you create from Java code. The compiler will then recognize them and compile them appropriately. Example:
 compiler.Register(new RevAppendPrimitive());
 

See Also:   LispPrimitive
Parameters:
  primitive -



Register
public void Register(LispPrimitive primitive, LispPackage pkg)(Code)
Use this function to register any new LISP primitives that you create from Java code. The compiler will then recognize them and compile them appropriately. This version of the constructor accepts a package in which to intern the symbol. Example:
 compiler.Register(new RevAppendPrimitive());
 

See Also:   LispPrimitive
Parameters:
  primitive -



Register
public void Register(LispPrimitive primitive, String pkgName)(Code)
Use this function to register any new LISP primitives that you create from Java code. The compiler will then recognize them and compile them appropriately. This version of the constructor accepts a package in which to intern the symbol. Example:
 compiler.Register(new RevAppendPrimitive());
 

See Also:   LispPrimitive
Parameters:
  primitive -



WarnAboutSpecials
public void WarnAboutSpecials(boolean value)(Code)



compile
public LispValue compile(SECDMachine machine, LispValue expr, LispValue varValues) throws CompilerException(Code)
compile takes a LISP expression, a list of global variables, and optionally an already-generated list of code. It returns compiled code in a list.
See Also:   LispCompiler
Parameters:
  expr - expression to compile
Parameters:
  varValues - global or local variable list. LispValue - generated code



compile
public LispValue compile(LispValue expr, LispValue valueList, LispValue code) throws CompilerException(Code)
compile takes a LISP expression, a list of global variables, and optionally an already-generated list of code. It returns compiled code in a list.
See Also:   LispCompiler
Parameters:
  expr - expression to compile
Parameters:
  valueList - global variable list.
Parameters:
  code - [optional] LispValue - generated code



compileAnd
LispValue compileAnd(SECDMachine machine, LispValue args, LispValue valueList, LispValue code) throws CompilerException(Code)



compileAndAux
LispValue compileAndAux(LispValue dummyVar, LispValue args)(Code)



compileApp
LispValue compileApp(SECDMachine machine, LispValue args, LispValue valueList, LispValue code) throws CompilerException(Code)



compileAppConstant
LispValue compileAppConstant(SECDMachine machine, LispValue args, LispValue valueList, LispValue code) throws CompilerException(Code)



compileArgsLeftToRight
public LispValue compileArgsLeftToRight(LispValue args, LispValue valueList, LispValue code) throws CompilerException(Code)



compileAtom
LispValue compileAtom(SECDMachine machine, LispValue expr, LispValue valueList, LispValue code) throws CompilerException(Code)



compileBuiltin
LispValue compileBuiltin(SECDMachine machine, LispValue fn, LispValue args, LispValue valueList, LispValue code) throws CompilerException(Code)



compileConstantArgsLeftToRight
public LispValue compileConstantArgsLeftToRight(SECDMachine machine, LispValue args, LispValue valueList, LispValue code)(Code)



compileDefmacro
LispValue compileDefmacro(SECDMachine machine, LispValue name, LispValue argsAndBody, LispValue valueList, LispValue code) throws CompilerException(Code)



compileDefun
LispValue compileDefun(SECDMachine machine, LispValue name, LispValue argsAndBody, LispValue valueList, LispValue code) throws CompilerException(Code)



compileIf
LispValue compileIf(SECDMachine machine, LispValue test, LispValue thenExpr, LispValue elseExpr, LispValue valueList, LispValue code) throws CompilerException(Code)



compileLambda
LispValue compileLambda(SECDMachine machine, LispValue body, LispValue valueList, LispValue code) throws CompilerException(Code)



compileLet
public LispValue compileLet(SECDMachine machine, LispValue vars, LispValue values, LispValue valueList, LispValue body, LispValue code) throws CompilerException(Code)



compileList
LispValue compileList(SECDMachine machine, LispValue expr, LispValue valueList, LispValue code) throws CompilerException(Code)



compileOptimizedIf
LispValue compileOptimizedIf(SECDMachine machine, LispValue test, LispValue thenExpr, LispValue elseExpr, LispValue valueList, LispValue code) throws CompilerException(Code)



compileOr
LispValue compileOr(SECDMachine machine, LispValue args, LispValue valueList, LispValue code) throws CompilerException(Code)



compileOrAux
LispValue compileOrAux(LispValue dummyVar, LispValue args)(Code)



compileProgn
LispValue compileProgn(LispValue body, LispValue valueList, LispValue code) throws CompilerException(Code)



compileSpecialBind
LispValue compileSpecialBind(SECDMachine machine, LispValue vars, LispValue values, LispValue valueList, LispValue code) throws CompilerException(Code)



compileSpecialForm
LispValue compileSpecialForm(SECDMachine machine, LispValue function, LispValue args, LispValue valueList, LispValue code) throws CompilerException(Code)



compileSpecialUnbind
LispValue compileSpecialUnbind(SECDMachine machine, LispValue vars, LispValue code)(Code)



compileUserDefinedFunction
LispValue compileUserDefinedFunction(SECDMachine machine, LispValue fn, LispValue args, LispValue valueList, LispValue code) throws CompilerException(Code)
FN is an instance of StandardLispFunction
Parameters:
  machine -
Parameters:
  fn - an instance of StandardLispFunction
Parameters:
  args -
Parameters:
  valueList -
Parameters:
  code -
throws:
  CompilerException -



getLegalBlocks
public Stack getLegalBlocks()(Code)



getLegalTags
public Stack getLegalTags()(Code)



getRegisteredDos
public Map getRegisteredDos()(Code)



indexAndAttribute
public LispValue indexAndAttribute(LispValue e, LispValue l)(Code)
Looks up the symbol in a list of lists. Returns a dotted pair. - first element is the attribute of the found symbol it can be "&rest" or NIL for no attribute (or if symbol has not been found) - second element is the index of the list in which it is found and the index in that list. Both indexes start from 1. The &rest keyword eventually present in the list is not taken into account for index count. index is NIL if not found. Examples:
 indexAndAttribute(b, ((a b c) (d e f))     = (NIL. (1 . 2))
 indexAndAttribute(f, ((a b c) (d e f))     = (NIL.(2 . 3))
 indexAndAttribute(z, ((a b c) (d e f))     = (NIL. NIL)
 indexAndAttribute(l, ((a &rest l) (d e f)) = (&rest .(1 . 2))
 

Parameters:
  e - a Symbol
Parameters:
  l - a list of lists either (NIL.NIL), if not found, or a dotted pair; first is the attribute for symbol, second is a Cons of 2 LispIntegers\(a . b) indicating list number (a) and index into that list (b)



indexInList
public int indexInList(LispValue e, LispValue l, LispValue[] attribute)(Code)
Looks up the symbol in a list
Parameters:
  e - a Symbol
Parameters:
  l - a list
Parameters:
  attribute - The attribute of the found symbol is assigned to attribute[0]. It can be NIL or &rest the index in list of found symbol (it start from 1) or 0 if symbol has not been found in list



init
public void init()(Code)
Initializes the compiler by registering the LISP primitive functions so that the compiler can recognize them.
See Also:   org.jatha.compile.LispCompiler



isBuiltinFunction
public static boolean isBuiltinFunction(LispValue code)(Code)
Send in either code or a symbol with a function value. Returns true only if the first element of the code list is :PRIMITIVE.
Parameters:
  code - a LISP list. true if the code indicates a built-in function



isLegalTag
public boolean isLegalTag(LispValue tag)(Code)



isMacroCode
public boolean isMacroCode(LispValue code)(Code)

Parameters:
  code - a Lisp list true if code is code for a macro (the first element is :MACRO)



quoteList
public LispValue quoteList(LispValue l)(Code)
Returns the input list with quotes added before every top-level expression.



specialFormP
public boolean specialFormP(LispValue fn)(Code)



valuesFromLetBindings
public LispValue valuesFromLetBindings(LispValue varValueList)(Code)



varsFromLetBindings
public LispValue varsFromLetBindings(LispValue varValueList)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.