Updated docs for 300 and fixed bug with lexing non-supported specials
svn: r1562
This commit is contained in:
parent
e54514d4be
commit
d4a450a93b
|
@ -1,19 +1,39 @@
|
||||||
_professorj_
|
_professorj_
|
||||||
|
|
||||||
This documentation details available resources, recent additions, and
|
ProfessorJ is a compiler for Java and related languages. The languages
|
||||||
constructs which do not currently work in ProfessorJ overall. For
|
include three teaching languages, Java 1.1 (with some incomplete
|
||||||
details of the specific language levels, please see the language level
|
features, see below), and an experimental language supporting interoperability
|
||||||
specific manuals.
|
between Java and Scheme. For details about the teaching languages, please
|
||||||
|
see the language manuals.
|
||||||
|
|
||||||
The interactions window accepts variable declaration, statements and
|
In all of the ProfessorJ language levels, the interactions window accepts variable
|
||||||
expressions legal for the language level. If the text is not sending,
|
declaration, statements and expressions legal for the language level. If the text
|
||||||
type Alt+Enter.
|
is not sending, type Alt+Enter to force the text to send.
|
||||||
|
|
||||||
The definitions window expects class and interface definitions,
|
The definitions window expects class and interface definitions,
|
||||||
interaction boxes, and test-suite boxes. (i.e. what would be given to
|
Java examples boxes, and test suite boxes. (i.e. what would be given to
|
||||||
javac plus two graphical boxes). Descriptions of these boxes can be
|
javac plus two graphical boxes). Descriptions of these boxes can be
|
||||||
found in the DrScheme manual.
|
found in the DrScheme manual.
|
||||||
|
|
||||||
|
_ProfessorJ Beginner
|
||||||
|
In Version 300, the Beginner language level has undergone significant changes.
|
||||||
|
Largest among these is that interfaces are supported within the language, but
|
||||||
|
abstract classes are no longer allowed. Further, interface implementation is supported
|
||||||
|
but class extension is not. For further details please see the language manual.
|
||||||
|
|
||||||
|
_ProfessorJ Intermediate
|
||||||
|
In Version 300, instanceof is now allowed. For further language details please see
|
||||||
|
the language manual.
|
||||||
|
|
||||||
|
_ProfessorJ Advanced
|
||||||
|
For details, please see the language manual.
|
||||||
|
|
||||||
|
_ProfessorJ Full
|
||||||
|
Supports Java 1.1, no 1.5 features have been included. Few libraries are available.
|
||||||
|
Where the libraries are supported, they are from version 1.4 (there are no language
|
||||||
|
differences between 1.1 and 1.4). Please see the list of unsupported features to see
|
||||||
|
what constructs are not available within this language level.
|
||||||
|
|
||||||
_Java + dynamic_ language level
|
_Java + dynamic_ language level
|
||||||
Version 299.200 +
|
Version 299.200 +
|
||||||
This language level allows programs to contain a value that will be
|
This language level allows programs to contain a value that will be
|
||||||
|
@ -72,23 +92,21 @@ _Java + dynamic_ language level
|
||||||
|
|
||||||
_Libraries available to ProfessorJ:
|
_Libraries available to ProfessorJ:
|
||||||
|
|
||||||
*NEW* Items are new to either DrScheme 207 or DrScheme 208
|
|
||||||
|
|
||||||
java.lang.Object
|
java.lang.Object
|
||||||
java.lang.String (see exceptions)
|
java.lang.String (see exceptions)
|
||||||
java.lang.Throwable
|
java.lang.Throwable
|
||||||
java.lang.*Exception
|
java.lang.*Exception
|
||||||
*NEW* java.lang.System (only currentTimeMillis, gc, and identityHashCode)
|
java.lang.System (only currentTimeMillis, gc, and identityHashCode)
|
||||||
*NEW* java.lang.Comparable
|
java.lang.Comparable
|
||||||
*NEW* java.lang.Number
|
java.lang.Number
|
||||||
*NEW* java.lang.Double (see exceptions)
|
java.lang.Double (see exceptions)
|
||||||
*NEW* java.lang.Float (see exceptions)
|
java.lang.Float (see exceptions)
|
||||||
*NEW* java.lang.Boolean (see exceptions)
|
java.lang.Boolean (see exceptions)
|
||||||
*NEW* java.io.Serializable
|
java.io.Serializable
|
||||||
*NEW* java.util.Random
|
java.util.Random
|
||||||
|
|
||||||
*NEW* Teachpacks (PLT/collects/htdch)
|
Teachpacks (PLT/collects/htdch)
|
||||||
*NEW* draw.*
|
draw.*
|
||||||
|
|
||||||
exceptions:
|
exceptions:
|
||||||
String: String(byte[],int,int,String) -- incorrect
|
String: String(byte[],int,int,String) -- incorrect
|
||||||
|
@ -106,39 +124,9 @@ _Libraries available to ProfessorJ:
|
||||||
Float: floatToIntBits, floatToRawBits, longBitsToFloat -- not implemented
|
Float: floatToIntBits, floatToRawBits, longBitsToFloat -- not implemented
|
||||||
Boolean: getBoolean(String) not implemented
|
Boolean: getBoolean(String) not implemented
|
||||||
|
|
||||||
_General New Items (New to 207 and 208)
|
|
||||||
|
|
||||||
New to all teaching language levels:
|
|
||||||
import package.name.*;
|
|
||||||
a teachpack directory (PLT/collects/htdch)
|
|
||||||
access to draw.* teachpack
|
|
||||||
|
|
||||||
New to Beginner:
|
|
||||||
super calls reallowed. For example
|
|
||||||
class A {
|
|
||||||
int x;
|
|
||||||
A(int x) {
|
|
||||||
this.x = x;
|
|
||||||
}
|
|
||||||
int adder() { return x + 1; }
|
|
||||||
}
|
|
||||||
class B extends A {
|
|
||||||
int y;
|
|
||||||
B( int x, int y) {
|
|
||||||
super(x);
|
|
||||||
this.y = y;
|
|
||||||
}
|
|
||||||
int adder() { return y + super.adder(); }
|
|
||||||
}
|
|
||||||
now works
|
|
||||||
|
|
||||||
== is restricted to comparing byte, short, int, long, char, and boolean
|
|
||||||
values
|
|
||||||
|
|
||||||
Classes may have initialized fields (i.e. int x = 3;)
|
|
||||||
|
|
||||||
_Unfinished constructs:
|
_Unfinished constructs:
|
||||||
nested classes
|
static nested classes
|
||||||
switch
|
switch
|
||||||
labeled statements (compiles but does not work correctly)
|
labeled statements (compiles but does not work correctly)
|
||||||
reflection
|
reflection
|
||||||
|
@ -146,9 +134,3 @@ _Unfinished constructs:
|
||||||
synchronized (compiles but is ignored)
|
synchronized (compiles but is ignored)
|
||||||
strictfp (compiles but is ignored)
|
strictfp (compiles but is ignored)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -153,8 +153,8 @@
|
||||||
(TypeDeclaration
|
(TypeDeclaration
|
||||||
[(ClassDeclaration) $1]
|
[(ClassDeclaration) $1]
|
||||||
[(InterfaceDeclaration) $1]
|
[(InterfaceDeclaration) $1]
|
||||||
[(INTERACTIONS_BOX) $1]
|
#;[(INTERACTIONS_BOX) $1]
|
||||||
[(CLASS_BOX) (parse-class-box $1 (build-src 1) 'advanced)]
|
#;[(CLASS_BOX) (parse-class-box $1 (build-src 1) 'advanced)]
|
||||||
[(TEST_SUITE) $1]
|
[(TEST_SUITE) $1]
|
||||||
[(EXAMPLE) $1]
|
[(EXAMPLE) $1]
|
||||||
[(SEMI_COLON) #f])
|
[(SEMI_COLON) #f])
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
(TypeDeclaration
|
(TypeDeclaration
|
||||||
[(ClassDeclaration) $1]
|
[(ClassDeclaration) $1]
|
||||||
[(InterfaceDeclaration) $1]
|
[(InterfaceDeclaration) $1]
|
||||||
[(INTERACTIONS_BOX) $1]
|
#;[(INTERACTIONS_BOX) $1]
|
||||||
[(EXAMPLE) $1]
|
[(EXAMPLE) $1]
|
||||||
#;[(CLASS_BOX) (parse-class-box $1 (build-src 1) 'beginner)]
|
#;[(CLASS_BOX) (parse-class-box $1 (build-src 1) 'beginner)]
|
||||||
[(TEST_SUITE) $1]
|
[(TEST_SUITE) $1]
|
||||||
|
|
|
@ -154,8 +154,8 @@
|
||||||
(TypeDeclaration
|
(TypeDeclaration
|
||||||
[(ClassDeclaration) $1]
|
[(ClassDeclaration) $1]
|
||||||
[(InterfaceDeclaration) $1]
|
[(InterfaceDeclaration) $1]
|
||||||
[(INTERACTIONS_BOX) $1]
|
#;[(INTERACTIONS_BOX) $1]
|
||||||
[(CLASS_BOX) (parse-class-box $1 (build-src 1) 'full)]
|
#;[(CLASS_BOX) (parse-class-box $1 (build-src 1) 'full)]
|
||||||
[(TEST_SUITE) $1]
|
[(TEST_SUITE) $1]
|
||||||
[(EXAMPLE) $1]
|
[(EXAMPLE) $1]
|
||||||
[(SEMI_COLON) #f])
|
[(SEMI_COLON) #f])
|
||||||
|
|
|
@ -140,8 +140,8 @@
|
||||||
(TypeDeclaration
|
(TypeDeclaration
|
||||||
[(ClassDeclaration) $1]
|
[(ClassDeclaration) $1]
|
||||||
[(InterfaceDeclaration) $1]
|
[(InterfaceDeclaration) $1]
|
||||||
[(INTERACTIONS_BOX) $1]
|
#;[(INTERACTIONS_BOX) $1]
|
||||||
[(CLASS_BOX) (parse-class-box $1 (build-src 1) 'intermediate)]
|
#;[(CLASS_BOX) (parse-class-box $1 (build-src 1) 'intermediate)]
|
||||||
[(EXAMPLE) $1]
|
[(EXAMPLE) $1]
|
||||||
[(TEST_SUITE) $1]
|
[(TEST_SUITE) $1]
|
||||||
[(SEMI_COLON) #f])
|
[(SEMI_COLON) #f])
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#cs
|
|
||||||
(module lexer mzscheme
|
(module lexer mzscheme
|
||||||
|
|
||||||
;; Lexical Analysis according to the Java Language Specification First Edition
|
;; Lexical Analysis according to the Java Language Specification First Edition
|
||||||
|
@ -51,8 +50,7 @@
|
||||||
(STRING_LIT CHAR_LIT INTEGER_LIT LONG_LIT FLOAT_LIT DOUBLE_LIT
|
(STRING_LIT CHAR_LIT INTEGER_LIT LONG_LIT FLOAT_LIT DOUBLE_LIT
|
||||||
IDENTIFIER STRING_ERROR NUMBER_ERROR HEX_LIT OCT_LIT HEXL_LIT OCTL_LIT))
|
IDENTIFIER STRING_ERROR NUMBER_ERROR HEX_LIT OCT_LIT HEXL_LIT OCTL_LIT))
|
||||||
|
|
||||||
(define-tokens special-toks (CLASS_BOX INTERACTIONS_BOX EXAMPLE TEST_SUITE
|
(define-tokens special-toks (EXAMPLE TEST_SUITE IMAGE_SPECIAL OTHER_SPECIAL))
|
||||||
IMAGE_SPECIAL OTHER_SPECIAL))
|
|
||||||
|
|
||||||
(define (trim-string s f l)
|
(define (trim-string s f l)
|
||||||
(substring s f (- (string-length s) l)))
|
(substring s f (- (string-length s) l)))
|
||||||
|
@ -319,15 +317,16 @@
|
||||||
#;("/**" (begin (read-document-comment input-port) (return-without-pos (get-token input-port))))
|
#;("/**" (begin (read-document-comment input-port) (return-without-pos (get-token input-port))))
|
||||||
|
|
||||||
((special)
|
((special)
|
||||||
(syntax-case lexeme ()
|
|
||||||
((parse-example-box examples) (token-EXAMPLE (make-example-box (syntax examples))))
|
|
||||||
(_
|
|
||||||
(cond
|
(cond
|
||||||
((and (syntax? lexeme) (syntax-property lexeme 'test-case-box))
|
((and (syntax? lexeme) (syntax-property lexeme 'test-case-box))
|
||||||
(token-TEST_SUITE (make-test-case lexeme)))
|
(token-TEST_SUITE (make-test-case lexeme)))
|
||||||
|
((and (syntax? lexeme) (syntax-property lexeme 'example-box))
|
||||||
|
(syntax-case lexeme ()
|
||||||
|
((parse-example-box examples) (token-EXAMPLE (make-example-box (syntax examples))))))
|
||||||
((is-a? lexeme (image-snip%))
|
((is-a? lexeme (image-snip%))
|
||||||
(token-IMAGE_SPECIAL lexeme))
|
(token-IMAGE_SPECIAL lexeme))
|
||||||
((token-OTHER_SPECIAL (list lexeme start-pos end-pos)))))))
|
(else
|
||||||
|
(token-OTHER_SPECIAL (list lexeme start-pos end-pos)))))
|
||||||
|
|
||||||
#;(cond
|
#;(cond
|
||||||
((class-case? lexeme) (token-CLASS_BOX lexeme))
|
((class-case? lexeme) (token-CLASS_BOX lexeme))
|
||||||
|
|
|
@ -701,7 +701,6 @@
|
||||||
(drscheme:get/extend:extend-unit-frame java-comment-box-mixin)
|
(drscheme:get/extend:extend-unit-frame java-comment-box-mixin)
|
||||||
|
|
||||||
;;Java interactions box
|
;;Java interactions box
|
||||||
#;(define ji-gif (include-bitmap (lib "java-interactions-box.gif" "icons")))
|
|
||||||
(define ji-gif (include-bitmap (lib "j.gif" "icons")))
|
(define ji-gif (include-bitmap (lib "j.gif" "icons")))
|
||||||
|
|
||||||
(define snipclass-java-interactions%
|
(define snipclass-java-interactions%
|
||||||
|
@ -762,7 +761,7 @@
|
||||||
(editor-filter #t))
|
(editor-filter #t))
|
||||||
ed type-recs level))
|
ed type-recs level))
|
||||||
(reverse inputs-list))))
|
(reverse inputs-list))))
|
||||||
; (printf "~a~n~a~n" syntax-list (map remove-requires syntax-list))
|
;(printf "~a~n~a~n" syntax-list (map remove-requires syntax-list))
|
||||||
(if ret-list?
|
(if ret-list?
|
||||||
syntax-list
|
syntax-list
|
||||||
(datum->syntax-object #f `(begin ,@(map remove-requires syntax-list)) #f)))))
|
(datum->syntax-object #f `(begin ,@(map remove-requires syntax-list)) #f)))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user