nice-commit Mailing List for The Nice Programming Language (Page 95)
Brought to you by:
bonniot
You can subscribe to this list here.
2003 |
Jan
|
Feb
(60) |
Mar
(125) |
Apr
(183) |
May
(140) |
Jun
(227) |
Jul
(141) |
Aug
(181) |
Sep
(75) |
Oct
(89) |
Nov
(187) |
Dec
(162) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(69) |
Feb
(197) |
Mar
(98) |
Apr
(26) |
May
(10) |
Jun
(85) |
Jul
(88) |
Aug
(79) |
Sep
(80) |
Oct
(81) |
Nov
(53) |
Dec
(109) |
2005 |
Jan
(68) |
Feb
(77) |
Mar
(232) |
Apr
(79) |
May
(37) |
Jun
(37) |
Jul
(3) |
Aug
(18) |
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
(10) |
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(9) |
2007 |
Jan
(2) |
Feb
(8) |
Mar
(2) |
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
|
Nov
(17) |
Dec
(6) |
2008 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ar...@us...> - 2003-07-19 00:54:08
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv32228/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Moved a few things out of the parser, it improves some error messages as side-effect. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.197 retrieving revision 1.198 diff -C2 -d -r1.197 -r1.198 *** Parser.jj 18 Jul 2003 22:56:49 -0000 1.197 --- Parser.jj 19 Jul 2003 00:54:05 -0000 1.198 *************** *** 909,919 **** | "private-write" | ( ("public" | "private" | {} ) ! [ ( "final" | t="const" ) ! { isFinal=true; ! if (t!=null) ! User.warning(Location.make(t), ! "'const' is deprecated. Use 'final' instead."); ! } ! ] ) ) --- 909,913 ---- | "private-write" | ( ("public" | "private" | {} ) ! [ "final" { isFinal=true; } ] ) ) *************** *** 1363,1388 **** Monotype t; Expression value=null; ! boolean constant; } { ! ( ! "var" {constant = false;} ! t=monotype() name=ident() ! [ "=" ! ( ! LOOKAHEAD(funExpLookahead()) value=funExp() ! | ! value=SideEffectFreeExpression() ! ) ! ] ! | ! "let" {constant = true;} ! t=monotype() name=ident() "=" ! ( ! LOOKAHEAD(funExpLookahead()) value=funExp() | value=SideEffectFreeExpression() ) ! ) ";" { return new GlobalVarDeclaration(name,t,value,constant); } --- 1357,1372 ---- Monotype t; Expression value=null; ! boolean constant = true; } { ! ( "var" {constant = false;} | "let" ) ! t=monotype() name=ident() ! [ "=" ! ( LOOKAHEAD(funExpLookahead()) ! value=funExp() | value=SideEffectFreeExpression() ) ! ] ";" { return new GlobalVarDeclaration(name,t,value,constant); } *************** *** 2228,2234 **** { ( ! LOOKAHEAD( "final" | "const" | "var" | "let" | monotype() <IDENT>) ( ! LOOKAHEAD( [ "final" | "const" | "var" | "let" ] monotype() <IDENT> "(" ) res = LocalFunctionDeclaration() | --- 2212,2218 ---- { ( ! LOOKAHEAD( "var" | "let" | monotype() <IDENT>) ( ! LOOKAHEAD( [ "var" | "let" ] monotype() <IDENT> "(" ) res = LocalFunctionDeclaration() | *************** *** 2252,2293 **** LocatedString id; Expression e = null; ! boolean constant = true; Token t = null; Block.LocalValue res; } { ! ( LOOKAHEAD ( monotype() ident() ) type=monotype() - id=ident() - [ "=" e=Expression() ] - { res = new Block.LocalVariable(id,type,false,e); } - ( LOOKAHEAD( "," <IDENT> ( "=" | ";" | ",") ) - "," id=ident() {e=null;} [ "=" e=Expression() ] { res.addNext(id,e); } )* | ! ( ! (t="final" | t="const") ! {User.warning(Location.make(t), ! "'"+t.toString()+"' is deprecated. Use 'let' instead."); ! } ! | "let" ! | "var" {constant = false;} ! ) ! ( LOOKAHEAD ( <IDENT> "=" ) ! id=ident() ! "=" e=Expression() ! { if (constant) { res = new Block.LocalConstant(id,e);} ! else { res = new Block.LocalVariable(id, null, constant, e);} ! } ! ( LOOKAHEAD( "," <IDENT> "=" ) ! "," id=ident() "=" e=Expression() { res.addNext(id,e); } )* ! | ! type=monotype() ! id=ident() ! [ "=" e=Expression() ] ! { res = new Block.LocalVariable(id,type,constant,e); } ! ( LOOKAHEAD( "," <IDENT> ( "=" | ";" | ",") ) ! "," id=ident() {e=null;} [ "=" e=Expression() ] { res.addNext(id,e); } )* ! ) ) { return res; } } --- 2236,2256 ---- LocatedString id; Expression e = null; ! boolean constant = false; Token t = null; Block.LocalValue res; } { ! ( type=monotype() | ! ( "var" | "let" {constant = true;} ) ! [ LOOKAHEAD ( monotype() <IDENT> ) type=monotype() ] ) + id=ident() + [ "=" e=Expression() ] + { res = Block.createLocalVariable(id,type,constant,e); } + ( LOOKAHEAD( "," <IDENT> ( "=" | ";" | ",") ) + "," id=ident() {e=null;} [ "=" e=Expression() ] { res.addNext(id,e); } )* + { return res; } } *************** *** 2299,2316 **** FormalParameters parameters; Statement body; ! boolean constant = true; Token t = null; List statements = new LinkedList(); } { ! ( ! (t="final" | t="const") ! {User.warning(Location.make(t), ! "'"+t.toString()+"' is deprecated. Use 'let' instead."); ! } ! | "let" ! | "var" {constant = false;} ! | {constant = false;} ! ) type = monotype() id=ident() --- 2262,2271 ---- FormalParameters parameters; Statement body; ! boolean constant = false; Token t = null; List statements = new LinkedList(); } { ! [ "let" {constant = true;} | "var" ] type = monotype() id=ident() *************** *** 2318,2322 **** body=code() { statements.add(body); } { return Block.LocalFunction.make(id, type, parameters, body!=null?new Block(statements):null); } - } --- 2273,2276 ---- *************** *** 2507,2511 **** LOOKAHEAD( monotype() <IDENT> ":" ) loop=ForInStatement() | ( ! LOOKAHEAD( "final" | "const" | "var" | "let" | monotype() <IDENT>) init=LocalDeclarationList() | statexp=StatementExpression() ";" {init.add(statexp);} --- 2461,2465 ---- LOOKAHEAD( monotype() <IDENT> ":" ) loop=ForInStatement() | ( ! LOOKAHEAD( "var" | "let" | monotype() <IDENT>) init=LocalDeclarationList() | statexp=StatementExpression() ";" {init.add(statexp);} |
From: <bo...@us...> - 2003-07-18 22:56:53
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv13900/debian Modified Files: changelog Log Message: Added simple class initializers. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.190 retrieving revision 1.191 diff -C2 -d -r1.190 -r1.191 *** changelog 17 Jul 2003 23:44:13 -0000 1.190 --- changelog 18 Jul 2003 22:56:50 -0000 1.191 *************** *** 1,2 **** --- 1,16 ---- + nice (0.9.1) unstable; urgency=low + + * A class can now initializers, which are executed each time an instance + is created. + class A + { + // Initializer + { + // Initialization code goes here. + } + } + + -- + nice (0.9.0) unstable; urgency=low *************** *** 72,76 **** * Improved some error messages. ! -- Daniel Bonniot <daniel@blanche> Fri, 18 Jul 2003 01:40:25 +0200 nice (0.8) unstable; urgency=low --- 86,90 ---- * Improved some error messages. ! -- Daniel Bonniot <bo...@us...> Fri, 18 Jul 2003 01:40:25 +0200 nice (0.8) unstable; urgency=low |
From: <bo...@us...> - 2003-07-18 22:56:53
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv13900/src/bossa/parser Modified Files: Parser.jj Log Message: Added simple class initializers. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.196 retrieving revision 1.197 diff -C2 -d -r1.196 -r1.197 *** Parser.jj 17 Jul 2003 23:14:37 -0000 1.196 --- Parser.jj 18 Jul 2003 22:56:49 -0000 1.197 *************** *** 971,976 **** { NiceClass impl = new NiceClass(res); } // internal fields and methods ! { List fields = new ArrayList(), methods = null; } ( LOOKAHEAD( getField(null, null) ) getField(impl, fields) --- 971,985 ---- { NiceClass impl = new NiceClass(res); } // internal fields and methods ! { List fields = new ArrayList(), methods = null, initializers = null; } ( + // Initializer + { Statement init; } + init = Block() + { + if (initializers == null) + initializers = new LinkedList(); + initializers.add(init); + } + | LOOKAHEAD( getField(null, null) ) getField(impl, fields) *************** *** 996,1000 **** --- 1005,1013 ---- { impl.setFields(fields); + if (initializers != null) + impl.setInitializers(initializers); + res.setImplementation(impl); + if (methods != null) definitions.addAll(methods); |
From: <bo...@us...> - 2003-07-18 22:56:52
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv13900/src/bossa/syntax Modified Files: Statement.java NiceClass.java FormalParameters.java Constructor.java Log Message: Added simple class initializers. Index: Statement.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Statement.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Statement.java 9 May 2003 13:17:03 -0000 1.18 --- Statement.java 18 Jul 2003 22:56:49 -0000 1.19 *************** *** 33,36 **** --- 33,38 ---- } + public static final Statement[] noStatements = new Statement[0]; + /**************************************************************** * Code generation Index: NiceClass.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceClass.java,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** NiceClass.java 24 Jun 2003 15:28:19 -0000 1.48 --- NiceClass.java 18 Jul 2003 22:56:49 -0000 1.49 *************** *** 170,173 **** --- 170,174 ---- localScope = definition.getLocalScope(); resolveFields(); + resolveIntitializers(); createConstructor(); definition.setJavaType(classe.getType()); *************** *** 190,193 **** --- 191,246 ---- /**************************************************************** + * Initializers + ****************************************************************/ + + private Statement[] initializers = Statement.noStatements; + + public void setInitializers(List inits) + { + initializers = (Statement[]) inits.toArray(new Statement[inits.size()]); + } + + public int nbInitializers() { return initializers.length; } + + private void resolveIntitializers() + { + if (initializers.length == 0) + return; + + VarScope scope = definition.scope; + mlsub.typing.Monotype thisType = + Monotype.sure + (new mlsub.typing.MonotypeConstructor + (definition.tc, definition.getTypeParameters())); + thisSymbol = + new MonoSymbol(FormalParameters.thisName, thisType) + { + gnu.expr.Expression compile() + { + return NiceClass.this.thisExp; + } + }; + + scope.addSymbol(thisSymbol); + + for (int i = 0; i < initializers.length; i++) + initializers[i] = bossa.syntax.dispatch.analyse + (initializers[i], definition.scope, localScope, false); + } + + private MonoSymbol thisSymbol; + private gnu.expr.Expression thisExp; + + void setThisExp(gnu.expr.Expression thisExp) + { + this.thisExp = thisExp; + } + + gnu.expr.Expression compileInitializer(int index) + { + return initializers[index].generateCode(); + } + + /**************************************************************** * Type checking ****************************************************************/ *************** *** 198,205 **** --- 251,268 ---- for (int i = 0; i < fields.length; i++) fields[i].typecheck(this); + + if (initializers.length != 0) + { + enterTypingContext(); + Node.thisExp = new SymbolExp(thisSymbol, definition.location()); + for (int i = 0; i < initializers.length; i++) + bossa.syntax.dispatch.typecheck(initializers[i]); + } } finally { if (entered) { entered = false; + + Node.thisExp = null; try { Typing.leave(); Index: FormalParameters.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/FormalParameters.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** FormalParameters.java 22 Jun 2003 09:51:56 -0000 1.25 --- FormalParameters.java 18 Jul 2003 22:56:49 -0000 1.26 *************** *** 282,286 **** } ! private LocatedString thisName = new LocatedString("this", Location.nowhere()); --- 282,286 ---- } ! static final LocatedString thisName = new LocatedString("this", Location.nowhere()); Index: Constructor.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Constructor.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Constructor.java 22 Jun 2003 09:51:56 -0000 1.5 --- Constructor.java 18 Jul 2003 22:56:49 -0000 1.6 *************** *** 111,115 **** (MonoSymbol[]) args.toArray(new MonoSymbol[args.size()])); ! Expression[] body = new Expression[1 + fields.length]; body[0] = callSuper(thisExp, fullArgs, omitDefaults); --- 111,117 ---- (MonoSymbol[]) args.toArray(new MonoSymbol[args.size()])); ! Expression[] body = ! new Expression[1 + fields.length + classe.nbInitializers()]; ! body[0] = callSuper(thisExp, fullArgs, omitDefaults); *************** *** 128,133 **** fieldValue = value.compile(); ! body[ i + 1] = fields[i].method.compileAssign(thisExp, fieldValue); } Gen.setMethodBody(lambda, new BeginExp(body)); --- 130,139 ---- fieldValue = value.compile(); ! body[1 + i] = fields[i].method.compileAssign(thisExp, fieldValue); } + + classe.setThisExp(thisExp); + for (int i = 0; i < classe.nbInitializers(); i++) + body[1 + fields.length + i] = classe.compileInitializer(i); Gen.setMethodBody(lambda, new BeginExp(body)); |
From: <bo...@us...> - 2003-07-18 22:56:52
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1:/tmp/cvs-serv13900/testsuite/compiler/classes Added Files: initializer.testsuite Log Message: Added simple class initializers. --- NEW FILE: initializer.testsuite --- /// PASS new A(i: cst); /// Toplevel let int cst = 42; class A { int i; { int j = i; assert j == cst; } } /// FAIL /// Toplevel class A { int i; { int j = i + true; } } /// PASS boolean ok = false; try { new A(); } catch(Error e) { ok = true; } assert ok; /// Toplevel class A { { throw new Error(); } } /// PASS boolean ok = false; try { new B(); } catch(Error e) { ok = true; } catch(Exception e) { ok = false; } assert ok; /// Toplevel class A { { throw new Error(); } } class B extends A { { throw new Exception(); } } /// PASS bug // Initializers should be executed after all the instance variables are set new B(); /// Toplevel class A { void foo(); foo() {} { this.foo(); } } class B extends A { int i = 1; foo() { assert i == 1; } } /// PASS /// Toplevel class A<T> { T x; { T y = x; } } |
From: <bo...@us...> - 2003-07-18 22:49:47
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv11673/web Modified Files: .htaccess Log Message: Released 0.9.0 Index: .htaccess =================================================================== RCS file: /cvsroot/nice/Nice/web/.htaccess,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** .htaccess 30 May 2003 01:34:22 -0000 1.9 --- .htaccess 18 Jul 2003 22:49:44 -0000 1.10 *************** *** 1,5 **** Redirect /Wiki http://nice.sourceforge.net/cgi-bin/twiki/view ! Redirect /Nice.tar http://prdownloads.sourceforge.net/nice/Nice-0.8-unix.tar.gz ! Redirect /Nice.zip http://prdownloads.sourceforge.net/nice/Nice-0.8-windows.zip ! Redirect /nice.deb http://prdownloads.sourceforge.net/nice/nice_0.8_all.deb ! Redirect /nice.rpm http://prdownloads.sourceforge.net/nice/Nice-0.8-1.noarch.rpm --- 1,5 ---- Redirect /Wiki http://nice.sourceforge.net/cgi-bin/twiki/view ! Redirect /Nice.tar http://prdownloads.sourceforge.net/nice/Nice-0.9.0-unix.tar.gz ! Redirect /Nice.zip http://prdownloads.sourceforge.net/nice/Nice-0.9.0-windows.zip ! Redirect /nice.deb http://prdownloads.sourceforge.net/nice/nice_0.9.0_all.deb ! Redirect /nice.rpm http://prdownloads.sourceforge.net/nice/Nice-0.9.0-1.noarch.rpm |
From: <ar...@us...> - 2003-07-18 21:26:53
|
Update of /cvsroot/nice/Nice/testsuite/lib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv30355/F:/nice/testsuite/lib/nice/lang Modified Files: arrays.testsuite Log Message: Added overloaded verion `+` for arrays. fixes #773918 Index: arrays.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/lib/nice/lang/arrays.testsuite,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** arrays.testsuite 16 May 2003 00:15:02 -0000 1.3 --- arrays.testsuite 18 Jul 2003 21:26:50 -0000 1.4 *************** *** 27,28 **** --- 27,33 ---- j[0] = 2; assert i[0] == 1 && j[0] == 2; + + /// PASS + var String[] foo = ["hello"]; + foo += ["world"]; + assert foo[0].equals("hello") && foo[1].equals("world"); |
From: <ar...@us...> - 2003-07-18 21:26:53
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv30355/F:/nice/stdlib/nice/lang Modified Files: array.nice Log Message: Added overloaded verion `+` for arrays. fixes #773918 Index: array.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/array.nice,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** array.nice 4 May 2003 16:49:38 -0000 1.23 --- array.nice 18 Jul 2003 21:26:50 -0000 1.24 *************** *** 172,173 **** --- 172,176 ---- return res; } + + <T, T1, T2 | T1 <: T, T2 <: T> T[] `+`(T1[] a1, T2[] a2) = concat(a1,a2); + |
From: <bo...@us...> - 2003-07-17 23:44:16
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv31490/debian Modified Files: changelog Log Message: Closed 0.9.0 Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.189 retrieving revision 1.190 diff -C2 -d -r1.189 -r1.190 *** changelog 15 Jul 2003 20:11:51 -0000 1.189 --- changelog 17 Jul 2003 23:44:13 -0000 1.190 *************** *** 6,10 **** abs(n<0) = -n; The compiler knows that method abs is covered for all int values. ! It's also possible to compare with globalconstants: let int bar = 5; String foo(int n); --- 6,10 ---- abs(n<0) = -n; The compiler knows that method abs is covered for all int values. ! It's also possible to compare with global constants: let int bar = 5; String foo(int n); *************** *** 12,20 **** foo(bar) = "equal to bar"; foo(n>bar) = "larger than bar"; - * The names of the arguments of a default implementation of a method must - be the same as the names in the declaration. - void foo(int number); - foo(number) { ... } //correct - //foo(num) { ... } //not valid * Added dispatch on String literals. This can be used as a switch on Strings. void foo(String color); --- 12,15 ---- *************** *** 42,49 **** name(Green) = "green"; The compiler knows now that the method "name" is completely covered. * Added operator ** to calculate powers of longs, doubles and BigIntegers. - * Added implies operator `->` "a -> b" is the same as "!a || b". - This is useful in assertions: - assert condition -> condition_that_only_needs_to_be_true_when_the_first_is; * The 'char' type is no longer a subtype of int. The integer unicode representation of a character c can be obtained by int(c). --- 37,48 ---- name(Green) = "green"; The compiler knows now that the method "name" is completely covered. + * The names of the arguments of a default implementation of a method must + be the same as the names in the declaration. + void foo(int number); + foo(number) { ... } //correct + //foo(num) { ... } //not valid + This is important, so that a typo in a global constant or enum name + in a method implementation does not lead to a default implementation. * Added operator ** to calculate powers of longs, doubles and BigIntegers. * The 'char' type is no longer a subtype of int. The integer unicode representation of a character c can be obtained by int(c). *************** *** 54,58 **** * Redefining of local variables in their scope is not allowed anymore. * Method bodies with a single statement can be written without brackets. ! example: void foo() = throw new Exception; * It is possible to bind the values of tuple arguments to functions: String foo((String s, String t)) = s + t; --- 53,57 ---- * Redefining of local variables in their scope is not allowed anymore. * Method bodies with a single statement can be written without brackets. ! example: void foo() = throw new Exception(); * It is possible to bind the values of tuple arguments to functions: String foo((String s, String t)) = s + t; *************** *** 73,77 **** * Improved some error messages. ! -- nice (0.8) unstable; urgency=low --- 72,76 ---- * Improved some error messages. ! -- Daniel Bonniot <daniel@blanche> Fri, 18 Jul 2003 01:40:25 +0200 nice (0.8) unstable; urgency=low |
From: <bo...@us...> - 2003-07-17 23:14:40
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv22373/src/bossa/parser Modified Files: Parser.jj Log Message: Disabled the implication operator for now. It might be reintroduced later as `=>`, if the syntax for anonymous functions is changed. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.195 retrieving revision 1.196 diff -C2 -d -r1.195 -r1.196 *** Parser.jj 15 Jul 2003 15:03:10 -0000 1.195 --- Parser.jj 17 Jul 2003 23:14:37 -0000 1.196 *************** *** 1811,1816 **** { e1=ConditionalOrExpression() ! ( t="->" e2=ConditionalOrExpression() ! { e1=CallExp.create(symb(t), e1, e2); } )? { return e1; } } --- 1811,1816 ---- { e1=ConditionalOrExpression() ! // ( t="->" e2=ConditionalOrExpression() ! // { e1=CallExp.create(symb(t), e1, e2); } )? { return e1; } } |
From: <bo...@us...> - 2003-07-17 23:14:40
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv22373/stdlib/nice/lang Modified Files: booleans.nice Log Message: Disabled the implication operator for now. It might be reintroduced later as `=>`, if the syntax for anonymous functions is changed. Index: booleans.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/booleans.nice,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** booleans.nice 15 Jul 2003 15:03:10 -0000 1.12 --- booleans.nice 17 Jul 2003 23:14:37 -0000 1.13 *************** *** 9,13 **** boolean `!=`(boolean, boolean) = inline nice.lang.inline.BoolOp("^"); ! boolean `->`(boolean a, boolean b) = !a || b; /** --- 9,13 ---- boolean `!=`(boolean, boolean) = inline nice.lang.inline.BoolOp("^"); ! boolean `=>`(boolean a, boolean b) = !a | b; /** |
From: <bo...@us...> - 2003-07-17 23:14:40
|
Update of /cvsroot/nice/Nice/testsuite/compiler/expressions/operators In directory sc8-pr-cvs1:/tmp/cvs-serv22373/testsuite/compiler/expressions/operators Modified Files: boolean.testsuite Log Message: Disabled the implication operator for now. It might be reintroduced later as `=>`, if the syntax for anonymous functions is changed. Index: boolean.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/expressions/operators/boolean.testsuite,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** boolean.testsuite 15 Jul 2003 15:03:11 -0000 1.4 --- boolean.testsuite 17 Jul 2003 23:14:37 -0000 1.5 *************** *** 83,92 **** /// PASS ! assert true->true; ! assert false->true; ! assert false->false; ! assert !(true->false); ! assert true->false||true; ! assert true->(false->true); /// FAIL --- 83,92 ---- /// PASS ! // assert true->true; ! // assert false->true; ! // assert false->false; ! // assert !(true->false); ! // assert true->false||true; ! // assert true->(false->true); /// FAIL |
From: <bo...@us...> - 2003-07-17 23:10:39
|
Update of /cvsroot/nice/Nice/src/bossa/modules In directory sc8-pr-cvs1:/tmp/cvs-serv21694/src/bossa/modules Modified Files: Package.java Log Message: In a set of mutually dependent packages, typecheck all of them first, before starting to generate code. Fixes #772784. Index: Package.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Package.java,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** Package.java 14 Jul 2003 16:45:39 -0000 1.94 --- Package.java 17 Jul 2003 23:10:37 -0000 1.95 *************** *** 268,275 **** public void compile() { - typecheck(); - - addProgress(PROGRESS_TYPECHECK); - compilation.exitIfErrors(); generateCode(); --- 268,271 ---- *************** *** 317,321 **** } ! private void typecheck() { // An interface file does not have to be typecheked. --- 313,317 ---- } ! public void typecheck() { // An interface file does not have to be typecheked. *************** *** 328,331 **** --- 324,329 ---- ast.typechecking(compiling()); + + addProgress(PROGRESS_TYPECHECK); } |
From: <bo...@us...> - 2003-07-17 23:10:39
|
Update of /cvsroot/nice/Nice/src/mlsub/compilation In directory sc8-pr-cvs1:/tmp/cvs-serv21694/src/mlsub/compilation Modified Files: make.nice Module.java Log Message: In a set of mutually dependent packages, typecheck all of them first, before starting to generate code. Fixes #772784. Index: make.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/compilation/make.nice,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** make.nice 12 Jun 2003 21:29:53 -0000 1.22 --- make.nice 17 Jul 2003 23:10:37 -0000 1.23 *************** *** 41,44 **** --- 41,45 ---- try { + modules.foreach(Module m => m.typecheck()); modules.foreach(Module m => m.compile()); Index: Module.java =================================================================== RCS file: /cvsroot/nice/Nice/src/mlsub/compilation/Module.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Module.java 4 Mar 2003 16:50:17 -0000 1.5 --- Module.java 17 Jul 2003 23:10:37 -0000 1.6 *************** *** 42,49 **** void localResolve(); /** Compile the module. This may involve: - - typecheking - code generation - saving the interface of the module --- 42,51 ---- void localResolve(); + /** Check types. */ + void typecheck(); + /** Compile the module. This may involve: - code generation - saving the interface of the module |
From: <bo...@us...> - 2003-07-17 23:10:39
|
Update of /cvsroot/nice/Nice/testsuite/compiler/overloading In directory sc8-pr-cvs1:/tmp/cvs-serv21694/testsuite/compiler/overloading Modified Files: resolution.testsuite Log Message: In a set of mutually dependent packages, typecheck all of them first, before starting to generate code. Fixes #772784. Index: resolution.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/overloading/resolution.testsuite,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** resolution.testsuite 4 Jun 2003 17:06:53 -0000 1.3 --- resolution.testsuite 17 Jul 2003 23:10:36 -0000 1.4 *************** *** 74,75 **** --- 74,105 ---- /// Toplevel void foo(int e) requires e >= 0 {} + + /// PASS + /// package rohan.C dontcompile + /// Toplevel + + import rohan.A; + import rohan.B; + + class CC { + void g() { + B d = new B(l: []); // no crash if this is... new B(); + } + } + + /// package rohan.A dontcompile + /// Toplevel + + import rohan.B; + + class B { + List<B> l = new ArrayList(); + } + + /// package rohan.B + /// Toplevel + + import rohan.A; + import rohan.C; + + void dummy() {} |
From: <bo...@us...> - 2003-07-17 19:37:35
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv8120/stdlib/nice/lang Modified Files: collections.nice Log Message: Concatenation operator `+` on lists. Index: collections.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/collections.nice,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** collections.nice 8 Jul 2003 11:52:51 -0000 1.49 --- collections.nice 17 Jul 2003 19:37:32 -0000 1.50 *************** *** 263,266 **** --- 263,275 ---- } + /** @return the concatenation of the two lists, as a new list. */ + <T, T1, T2 | T1 <: T, T2 <: T> List<T> `+`(List<T1> l1, List<T2> l2) + { + List<T> res = new ArrayList(l1.size + l2.size); + res.addAll(l1); + res.addAll(l2); + return res; + } + /**************************************************************** * Printing |
From: <bo...@us...> - 2003-07-17 19:13:21
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv3413/stdlib/nice/lang Modified Files: strings.nice Log Message: Allow `+` to be used to create a String when the right argument is a String. Index: strings.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/strings.nice,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** strings.nice 11 Jun 2003 12:21:25 -0000 1.11 --- strings.nice 17 Jul 2003 19:13:17 -0000 1.12 *************** *** 21,25 **** ****************************************************************/ ! <Any R> String `+`(String s, R o) = s.concat(String.valueOf(o)); int indexOf(String, char) = native int String.indexOf(int); --- 21,27 ---- ****************************************************************/ ! <T> String `+`(String s, T o) = s.concat(String.valueOf(o)); ! <!T> String `+`(T o, String s) = o.toString().concat(s); ! String `+`(String s1, String s2) = s1.concat(s2); int indexOf(String, char) = native int String.indexOf(int); |
From: <ar...@us...> - 2003-07-17 11:01:06
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv14577/F:/nice/src/bossa/syntax Modified Files: FunSymbol.java Log Message: Cleanup of the latest change. Index: FunSymbol.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/FunSymbol.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** FunSymbol.java 16 Jul 2003 23:29:34 -0000 1.8 --- FunSymbol.java 17 Jul 2003 11:01:03 -0000 1.9 *************** *** 68,76 **** { if (parameters == null) ! { ! // true for constructors, for instance. case might be removed ! if (!arguments.plainApplication(arity, this)) ! return 0; ! } else if (!parameters.match(arguments, this)) return 0; --- 68,76 ---- { if (parameters == null) ! { ! // true for constructors, for instance. case might be removed ! if (!arguments.plainApplication(arity, this)) ! return 0; ! } else if (!parameters.match(arguments, this)) return 0; *************** *** 81,96 **** String explainWhyMatchFails(Arguments arguments) { ! if (parameters != null && arguments.size() > parameters.size) ! return "No method named " + name + " has as many as " + ! arguments.size() + " parameters"; ! ! if (this instanceof MethodDeclaration.Symbol && ! ((MethodDeclaration.Symbol)this).getFieldAccessMethod() != null) ! { ! if (arguments.size() == 0) ! return name + " is not defined"; ! return name + " is a field of class " + describeParameters(); ! } return "Method " + name + " expects parameters (" + --- 81,91 ---- String explainWhyMatchFails(Arguments arguments) { ! if (isFieldAccess()) ! { ! if (arguments.size() == 0) ! return name + " is not defined"; ! return name + " is a field of class " + describeParameters(); ! } return "Method " + name + " expects parameters (" + |
From: <ar...@us...> - 2003-07-16 23:29:37
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv12242/F:/nice/src/bossa/syntax Modified Files: FunSymbol.java Log Message: Improved some 'explain why match fails' error messages. Index: FunSymbol.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/FunSymbol.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** FunSymbol.java 23 Mar 2003 23:03:03 -0000 1.7 --- FunSymbol.java 16 Jul 2003 23:29:34 -0000 1.8 *************** *** 81,84 **** --- 81,97 ---- String explainWhyMatchFails(Arguments arguments) { + if (parameters != null && arguments.size() > parameters.size) + return "No method named " + name + " has as many as " + + arguments.size() + " parameters"; + + if (this instanceof MethodDeclaration.Symbol && + ((MethodDeclaration.Symbol)this).getFieldAccessMethod() != null) + { + if (arguments.size() == 0) + return name + " is not defined"; + + return name + " is a field of class " + describeParameters(); + } + return "Method " + name + " expects parameters (" + describeParameters() + ")"; |
From: <bo...@us...> - 2003-07-16 19:41:58
|
Update of /cvsroot/nice/Nice/regtest/basic In directory sc8-pr-cvs1:/tmp/cvs-serv3376/regtest/basic Modified Files: optionalParameters.nice Log Message: Respect the declared parameter names in a default implementation. Index: optionalParameters.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/optionalParameters.nice,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** optionalParameters.nice 26 May 2003 20:52:27 -0000 1.8 --- optionalParameters.nice 16 Jul 2003 19:41:55 -0000 1.9 *************** *** 6,10 **** int o1(int x, int, int z = 20, int t = 0); ! o1(a, x, z, t) = a + 2*x + 3*z; int o1(int, int x, int y = 10); --- 6,10 ---- int o1(int x, int, int z = 20, int t = 0); ! o1(x, a, z, t) = x + 2*a + 3*z; int o1(int, int x, int y = 10); |
From: <bo...@us...> - 2003-07-16 14:08:02
|
Update of /cvsroot/nice/Nice/src/nice/tools/compiler In directory sc8-pr-cvs1:/tmp/cvs-serv2286/src/nice/tools/compiler Modified Files: native.nice Log Message: Fixed the main class name for gcj compilation. Explicitely specify the classpath as empty, since the jar should be self-contained, and nice.jar which is on the classpath interferes. Index: native.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/compiler/native.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** native.nice 16 Oct 2002 11:44:34 -0000 1.3 --- native.nice 16 Jul 2003 14:07:59 -0000 1.4 *************** *** 21,24 **** --- 21,26 ---- */ + import java.io.*; + void produceNativeProgram(?String nativeCompiler, String pkg, String output, String jar) *************** *** 37,45 **** try{ Process p = Runtime.getRuntime().exec ! ([gcj, "--main=" + pkg + ".package", "-o", output, jar ]); p.waitFor(); if (p.exitValue() != 0) ! fail(); } catch(java.io.IOException e) { --- 39,60 ---- try{ Process p = Runtime.getRuntime().exec ! ([gcj, ! "--classpath=", // We set the classpath to null to ignore nice.jar ! "--main=" + pkg + ".fun", "-o", output, jar ]); p.waitFor(); if (p.exitValue() != 0) ! { ! fail(); ! ! // Print the content of stderr. ! let in = new BufferedReader(new InputStreamReader(p.getErrorStream())); ! try { ! for (String line = in.readLine(); line != null; ! line = in.readLine()) ! System.out.println(line); ! } ! catch(IOException ex) {} ! } } catch(java.io.IOException e) { |
From: <ar...@us...> - 2003-07-16 11:37:28
|
Update of /cvsroot/nice/Nice/src/bossa/link In directory sc8-pr-cvs1:/tmp/cvs-serv11803/F:/nice/src/bossa/link Modified Files: Dispatch.java Log Message: Limit the number of error message give by not matching values to avoid duplicates. Index: Dispatch.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/link/Dispatch.java,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** Dispatch.java 6 Jul 2003 18:12:17 -0000 1.58 --- Dispatch.java 16 Jul 2003 11:37:22 -0000 1.59 *************** *** 181,185 **** else if (hasValues && testValues(method, tags, values, isValue, sortedAlternatives) ) ! if (++nb_errors > 3) break; --- 181,185 ---- else if (hasValues && testValues(method, tags, values, isValue, sortedAlternatives) ) ! if (++nb_errors > 0) break; |
From: <ar...@us...> - 2003-07-15 21:41:39
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv12903/F:/nice/src/bossa/syntax Modified Files: ConstantExp.java Log Message: Fix small bug in printing error messages of not completely covered integer comparison patterns. Index: ConstantExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ConstantExp.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** ConstantExp.java 6 Jul 2003 18:12:17 -0000 1.44 --- ConstantExp.java 15 Jul 2003 21:41:36 -0000 1.45 *************** *** 57,60 **** --- 57,61 ---- { this.value = value; + this.representation = value.toString(); } |
From: <bo...@us...> - 2003-07-15 20:11:54
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv29484/debian Modified Files: changelog Log Message: Clarified that using a wrong name for a default implementation is an error. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.188 retrieving revision 1.189 diff -C2 -d -r1.188 -r1.189 *** changelog 15 Jul 2003 15:03:11 -0000 1.188 --- changelog 15 Jul 2003 20:11:51 -0000 1.189 *************** *** 12,16 **** foo(bar) = "equal to bar"; foo(n>bar) = "larger than bar"; ! * The names of the arguments of a default implementation of a method should be the same as the names in the declaration. void foo(int number); --- 12,16 ---- foo(bar) = "equal to bar"; foo(n>bar) = "larger than bar"; ! * The names of the arguments of a default implementation of a method must be the same as the names in the declaration. void foo(int number); |
From: <ar...@us...> - 2003-07-15 15:03:14
|
Update of /cvsroot/nice/Nice/testsuite/compiler/expressions/operators In directory sc8-pr-cvs1:/tmp/cvs-serv7738/F:/nice/testsuite/compiler/expressions/operators Modified Files: boolean.testsuite Log Message: implemented the `->` (implies) operator. Index: boolean.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/expressions/operators/boolean.testsuite,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** boolean.testsuite 2 Apr 2003 17:15:13 -0000 1.3 --- boolean.testsuite 15 Jul 2003 15:03:11 -0000 1.4 *************** *** 81,82 **** --- 81,94 ---- boolean b = true; b = true ? b^b||10>3>1 : false ^ b && 0 != 5; + + /// PASS + assert true->true; + assert false->true; + assert false->false; + assert !(true->false); + assert true->false||true; + assert true->(false->true); + + /// FAIL + // non associative + boolean b = true->true->true; |