Home | History | Annotate | only in /external/apache-commons-bcel/src/examples/Mini
Up to higher level directory
NameDateSize
ASCII_CharStream.java22-Oct-202010.3K
ASTExpr.java22-Oct-202010.8K
ASTFactor.java22-Oct-20201.5K
ASTFunAppl.java22-Oct-20207K
ASTFunDecl.java22-Oct-202013.1K
ASTIdent.java22-Oct-20203.9K
ASTIfExpr.java22-Oct-20205.3K
ASTInteger.java22-Oct-20202.4K
ASTLetExpr.java22-Oct-20205.3K
ASTProgram.java22-Oct-202011.7K
ASTTerm.java22-Oct-20201.5K
EnvEntry.java22-Oct-2020995
Environment.java22-Oct-20204.9K
fac.mini22-Oct-2020139
fib.mini22-Oct-2020172
Function.java22-Oct-20202.8K
JJTMiniParserState.java22-Oct-20203.8K
max.mini22-Oct-2020357
Mini.bnf22-Oct-2020716
Mini.jj22-Oct-202012.7K
Mini.jjt22-Oct-20205K
MiniC.java22-Oct-20205.8K
MiniParser$JJCalls22-Oct-2020363
MiniParser.java22-Oct-202030K
MiniParserConstants.java22-Oct-20202.1K
MiniParserTokenManager.java22-Oct-202021.5K
MiniParserTreeConstants.java22-Oct-20201.4K
Node.java22-Oct-20201.8K
ParseException.java22-Oct-20207K
README22-Oct-20201.6K
SimpleNode.java22-Oct-20202.7K
Token.java22-Oct-20203.4K
TokenMgrError.java22-Oct-20204.9K
Variable.java22-Oct-20202.2K

README

      1             Mini-Mini tutorial
      2             ------------------
      3 
      4 Mini is a very simple (semi-functional) language that I wrote to test
      5 the generic package of BCEL.
      6 
      7     http://commons.apache.org/bcel/
      8 
      9 Mini uses the JavaCC parser generator which comes precompiled from
     10 
     11     http://www.webgain.com/products/java_cc/
     12 
     13 After  setting the  CLASSPATH to  the  directory  just above the  Mini
     14 directory, e.g.
     15 
     16     % cd Mini
     17     % setenv CLASSPATH $CLASSPATH:.:..
     18 
     19 try the following:
     20 
     21     % java Mini.MiniC max.mini
     22 
     23 This produces a Java class file (max.class) which you can execute with
     24 
     25     % java max
     26 
     27 Enter a number (4, eg.)  and you will be asked to enter 4 numbers. The
     28 program will then tell you the biggest of them.
     29 
     30 Alternatively you can  produce a  Java  file (max.java) which  will be
     31 translated automatically to a .class file.
     32 
     33     % java Mini.MiniC -java max.mini
     34 
     35 There are three    examples programs  (max.mini,  fac.mini,  fib.mini)
     36 provided  which  demonstrate the language  syntax  and should be quite
     37 easy to understand.
     38 
     39 
     40 The compiler is not  that well documented, I'm  afraid, but  if you've
     41 ever seen a compiler before, you should be able to understand what I'm
     42 doing. The  part that  produces  the  byte code   is contained  in the
     43 byte_code() method  that  all AST   nodes implement.  Take  a  look at
     44 MiniC.java at line 85 and follow the recursive byte_code() calls.
     45 
     46 It's also useful to use  the listclass program provided with BCEL
     47 to examine the generated class. For example
     48 
     49     % java listclass max.class
     50 
     51 
     52 Send bug reports and suggestions to
     53 
     54     m.dahm (a] gmx.de (Markus Dahm)
     55