From d4a450a93bb6b1f36899b7ac13444dc5b95fa2de Mon Sep 17 00:00:00 2001 From: Kathy Gray Date: Wed, 7 Dec 2005 22:00:15 +0000 Subject: [PATCH] Updated docs for 300 and fixed bug with lexing non-supported specials svn: r1562 --- collects/profj/doc.txt | 96 ++++++++----------- collects/profj/parsers/advanced-parser.ss | 4 +- collects/profj/parsers/beginner-parser.ss | 2 +- collects/profj/parsers/full-parser.ss | 4 +- collects/profj/parsers/intermediate-parser.ss | 4 +- collects/profj/parsers/lexer.ss | 23 +++-- collects/profj/tool.ss | 3 +- 7 files changed, 58 insertions(+), 78 deletions(-) diff --git a/collects/profj/doc.txt b/collects/profj/doc.txt index 804e708872..dd6c13728b 100644 --- a/collects/profj/doc.txt +++ b/collects/profj/doc.txt @@ -1,19 +1,39 @@ _professorj_ -This documentation details available resources, recent additions, and -constructs which do not currently work in ProfessorJ overall. For -details of the specific language levels, please see the language level -specific manuals. +ProfessorJ is a compiler for Java and related languages. The languages +include three teaching languages, Java 1.1 (with some incomplete +features, see below), and an experimental language supporting interoperability +between Java and Scheme. For details about the teaching languages, please +see the language manuals. -The interactions window accepts variable declaration, statements and -expressions legal for the language level. If the text is not sending, -type Alt+Enter. +In all of the ProfessorJ language levels, the interactions window accepts variable +declaration, statements and expressions legal for the language level. If the text +is not sending, type Alt+Enter to force the text to send. 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 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 Version 299.200 + This language level allows programs to contain a value that will be @@ -72,23 +92,21 @@ _Java + dynamic_ language level _Libraries available to ProfessorJ: -*NEW* Items are new to either DrScheme 207 or DrScheme 208 - java.lang.Object java.lang.String (see exceptions) java.lang.Throwable java.lang.*Exception - *NEW* java.lang.System (only currentTimeMillis, gc, and identityHashCode) - *NEW* java.lang.Comparable - *NEW* java.lang.Number - *NEW* java.lang.Double (see exceptions) - *NEW* java.lang.Float (see exceptions) - *NEW* java.lang.Boolean (see exceptions) - *NEW* java.io.Serializable - *NEW* java.util.Random + java.lang.System (only currentTimeMillis, gc, and identityHashCode) + java.lang.Comparable + java.lang.Number + java.lang.Double (see exceptions) + java.lang.Float (see exceptions) + java.lang.Boolean (see exceptions) + java.io.Serializable + java.util.Random - *NEW* Teachpacks (PLT/collects/htdch) - *NEW* draw.* + Teachpacks (PLT/collects/htdch) + draw.* exceptions: String: String(byte[],int,int,String) -- incorrect @@ -106,39 +124,9 @@ _Libraries available to ProfessorJ: Float: floatToIntBits, floatToRawBits, longBitsToFloat -- 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: - nested classes + static nested classes switch labeled statements (compiles but does not work correctly) reflection @@ -146,9 +134,3 @@ _Unfinished constructs: synchronized (compiles but is ignored) strictfp (compiles but is ignored) - - - - - - diff --git a/collects/profj/parsers/advanced-parser.ss b/collects/profj/parsers/advanced-parser.ss index 6ee050550e..0b3469b9d8 100644 --- a/collects/profj/parsers/advanced-parser.ss +++ b/collects/profj/parsers/advanced-parser.ss @@ -153,8 +153,8 @@ (TypeDeclaration [(ClassDeclaration) $1] [(InterfaceDeclaration) $1] - [(INTERACTIONS_BOX) $1] - [(CLASS_BOX) (parse-class-box $1 (build-src 1) 'advanced)] + #;[(INTERACTIONS_BOX) $1] + #;[(CLASS_BOX) (parse-class-box $1 (build-src 1) 'advanced)] [(TEST_SUITE) $1] [(EXAMPLE) $1] [(SEMI_COLON) #f]) diff --git a/collects/profj/parsers/beginner-parser.ss b/collects/profj/parsers/beginner-parser.ss index 436befacf9..4ec267315a 100644 --- a/collects/profj/parsers/beginner-parser.ss +++ b/collects/profj/parsers/beginner-parser.ss @@ -115,7 +115,7 @@ (TypeDeclaration [(ClassDeclaration) $1] [(InterfaceDeclaration) $1] - [(INTERACTIONS_BOX) $1] + #;[(INTERACTIONS_BOX) $1] [(EXAMPLE) $1] #;[(CLASS_BOX) (parse-class-box $1 (build-src 1) 'beginner)] [(TEST_SUITE) $1] diff --git a/collects/profj/parsers/full-parser.ss b/collects/profj/parsers/full-parser.ss index 91fce83127..0f36c1395a 100644 --- a/collects/profj/parsers/full-parser.ss +++ b/collects/profj/parsers/full-parser.ss @@ -154,8 +154,8 @@ (TypeDeclaration [(ClassDeclaration) $1] [(InterfaceDeclaration) $1] - [(INTERACTIONS_BOX) $1] - [(CLASS_BOX) (parse-class-box $1 (build-src 1) 'full)] + #;[(INTERACTIONS_BOX) $1] + #;[(CLASS_BOX) (parse-class-box $1 (build-src 1) 'full)] [(TEST_SUITE) $1] [(EXAMPLE) $1] [(SEMI_COLON) #f]) diff --git a/collects/profj/parsers/intermediate-parser.ss b/collects/profj/parsers/intermediate-parser.ss index f904d94cdb..1f380f4511 100644 --- a/collects/profj/parsers/intermediate-parser.ss +++ b/collects/profj/parsers/intermediate-parser.ss @@ -140,8 +140,8 @@ (TypeDeclaration [(ClassDeclaration) $1] [(InterfaceDeclaration) $1] - [(INTERACTIONS_BOX) $1] - [(CLASS_BOX) (parse-class-box $1 (build-src 1) 'intermediate)] + #;[(INTERACTIONS_BOX) $1] + #;[(CLASS_BOX) (parse-class-box $1 (build-src 1) 'intermediate)] [(EXAMPLE) $1] [(TEST_SUITE) $1] [(SEMI_COLON) #f]) diff --git a/collects/profj/parsers/lexer.ss b/collects/profj/parsers/lexer.ss index e0d26c09e1..59b1db342a 100644 --- a/collects/profj/parsers/lexer.ss +++ b/collects/profj/parsers/lexer.ss @@ -1,4 +1,3 @@ -#cs (module lexer mzscheme ;; 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 IDENTIFIER STRING_ERROR NUMBER_ERROR HEX_LIT OCT_LIT HEXL_LIT OCTL_LIT)) - (define-tokens special-toks (CLASS_BOX INTERACTIONS_BOX EXAMPLE TEST_SUITE - IMAGE_SPECIAL OTHER_SPECIAL)) + (define-tokens special-toks (EXAMPLE TEST_SUITE IMAGE_SPECIAL OTHER_SPECIAL)) (define (trim-string s f 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)))) ((special) - (syntax-case lexeme () - ((parse-example-box examples) (token-EXAMPLE (make-example-box (syntax examples)))) - (_ - (cond - ((and (syntax? lexeme) (syntax-property lexeme 'test-case-box)) - (token-TEST_SUITE (make-test-case lexeme))) - ((is-a? lexeme (image-snip%)) - (token-IMAGE_SPECIAL lexeme)) - ((token-OTHER_SPECIAL (list lexeme start-pos end-pos))))))) + (cond + ((and (syntax? lexeme) (syntax-property lexeme 'test-case-box)) + (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%)) + (token-IMAGE_SPECIAL lexeme)) + (else + (token-OTHER_SPECIAL (list lexeme start-pos end-pos))))) #;(cond ((class-case? lexeme) (token-CLASS_BOX lexeme)) diff --git a/collects/profj/tool.ss b/collects/profj/tool.ss index 541f14bdc8..e7ce4e8046 100644 --- a/collects/profj/tool.ss +++ b/collects/profj/tool.ss @@ -701,7 +701,6 @@ (drscheme:get/extend:extend-unit-frame java-comment-box-mixin) ;;Java interactions box - #;(define ji-gif (include-bitmap (lib "java-interactions-box.gif" "icons"))) (define ji-gif (include-bitmap (lib "j.gif" "icons"))) (define snipclass-java-interactions% @@ -762,7 +761,7 @@ (editor-filter #t)) ed type-recs level)) (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? syntax-list (datum->syntax-object #f `(begin ,@(map remove-requires syntax-list)) #f)))))