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