nice-commit Mailing List for The Nice Programming Language (Page 20)
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: Daniel B. <bo...@us...> - 2005-02-24 15:11:32
|
Update of /cvsroot/nice/Nice/src/nice/tools/unit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14379/src/nice/tools/unit Modified Files: api.nice Log Message: Cleanup. Index: api.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/unit/api.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** api.nice 2 Jul 2004 19:31:01 -0000 1.2 --- api.nice 24 Feb 2005 15:11:00 -0000 1.3 *************** *** 8,12 **** ?String classpath = null) { ! let classloader = classpath == null ? ClassLoader.getSystemClassLoader() : classloaderFromClasspath(notNull(classpath)); --- 8,12 ---- ?String classpath = null) { ! let classloader = classpath == null ? ClassLoader.getSystemClassLoader() : classloaderFromClasspath(notNull(classpath)); *************** *** 58,62 **** } ! boolean isTestMethod(Method m) = m.getName().startsWith("_test") && m.getParameterTypes().length == 0; --- 58,62 ---- } ! boolean isTestMethod(Method m) = m.getName().startsWith("_test") && m.getParameterTypes().length == 0; *************** *** 64,79 **** { let name = m.getDeclaringClass().getName() + "." + m.getName(); ! listener.start(name); ! try { m.invoke(null, null); ! } ! catch (InvocationTargetException e) { let cause = e.getTargetException(); listener.failure(name, cause); } ! finally { listener.end(name); --- 64,79 ---- { let name = m.getDeclaringClass().getName() + "." + m.getName(); ! listener.start(name); ! try { m.invoke(null, null); ! } ! catch (InvocationTargetException e) { let cause = e.getTargetException(); listener.failure(name, cause); } ! finally { listener.end(name); *************** *** 85,94 **** let index = source.lastIndexOf(c); if (index == -1) return source; ! StringBuffer res = new StringBuffer(source.length() + by.length() - 1); res.append(source.substring(0, index)); res.append(by); res.append(source.substring(index + 1)); ! return res.toString(); } --- 85,94 ---- let index = source.lastIndexOf(c); if (index == -1) return source; ! StringBuffer res = new StringBuffer(source.length() + by.length() - 1); res.append(source.substring(0, index)); res.append(by); res.append(source.substring(index + 1)); ! return res.toString(); } |
From: Daniel B. <bo...@us...> - 2005-02-23 16:58:23
|
Update of /cvsroot/nice/Nice/src/nice/tools/testsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20726/src/nice/tools/testsuite Modified Files: TestNice.java TestCase.java Log Message: Allow native compilation of testcases using gcj, with a -gcc command-line option in TestNice. Index: TestCase.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/testsuite/TestCase.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** TestCase.java 5 Aug 2004 12:33:21 -0000 1.31 --- TestCase.java 23 Feb 2005 16:58:09 -0000 1.32 *************** *** 333,341 **** compilation.destinationDir = tempDir; compilation.runtimeFile = TestNice.getRuntime(); ! nice.tools.compiler.fun.compile ! (compilation, packageName, null, null, false); return output.statusCode; } ! /** * Runs the main method of the testcase. Only if main method exists and --- 333,372 ---- compilation.destinationDir = tempDir; compilation.runtimeFile = TestNice.getRuntime(); ! ! if (TestNice.getGcc() == null) ! nice.tools.compiler.fun.compile ! (compilation, packageName, null, null, false); ! else ! { ! compilation.output = new File(tempDir, "testcase.jar").getPath(); ! nice.tools.compiler.fun.compile ! (compilation, packageName, ! new File(tempDir, "testcase.exe").getPath(), ! TestNice.getGcc() + "/bin/gcj", ! false); ! } ! return output.statusCode; } ! ! public void runNative() throws TestSuiteException { ! try { ! String[] env = null; ! if (TestNice.getGcc() != null) ! env = new String[]{ "LD_LIBRARY_PATH=" + TestNice.getGcc() + "/lib" }; ! ! Process p = Runtime.getRuntime().exec(TestNice.getTempFolder() + "/testcase.exe", env); ! CharArrayWriter out = new CharArrayWriter(); ! int exitValue = nice.tools.compiler.dispatch.waitFor(p, out); ! // Print the output of the execution. ! System.out.println(out.toString()); ! if (exitValue != 0) ! throw new TestSuiteException("Exit code: " + exitValue); ! } ! catch(IOException e) { ! throw new TestSuiteException(e.getMessage()); ! } ! } ! /** * Runs the main method of the testcase. Only if main method exists and *************** *** 352,355 **** --- 383,394 ---- System.setErr(out); try { + + if (TestNice.getGcc() != null) + { + runNative(); + return; + } + + for(Iterator iter = _niceSourceFiles.iterator(); iter.hasNext();) { NiceSourceFile sourceFile = (NiceSourceFile)iter.next(); Index: TestNice.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/testsuite/TestNice.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** TestNice.java 2 Mar 2004 21:44:27 -0000 1.30 --- TestNice.java 23 Feb 2005 16:57:57 -0000 1.31 *************** *** 132,137 **** */ private static Output _output = new ConsoleOutput(); ! ! /** * TODO --- 132,145 ---- */ private static Output _output = new ConsoleOutput(); ! ! ! /** ! The <b>home</b> directory of gcc. ! If you want to use the system-wide version of gcc on a Unix machine, ! this should likely be set to "/usr". ! */ ! private static String _gcc = null; ! ! /** * TODO *************** *** 263,266 **** --- 271,276 ---- if ("-output".equalsIgnoreCase(s)) setOutput(args[i++]); + else if ("-gcc".equalsIgnoreCase(s)) + setGcc(args[i++]); else if ("-comment".equalsIgnoreCase(s)) _writeComments = true; *************** *** 279,283 **** /** * Sets the output of the test engine ! * * @param output TODO */ --- 289,293 ---- /** * Sets the output of the test engine ! * * @param output TODO */ *************** *** 287,291 **** return; } ! output = output.toLowerCase(); if (output.endsWith(".html") || output.endsWith(".htm")) --- 297,301 ---- return; } ! output = output.toLowerCase(); if (output.endsWith(".html") || output.endsWith(".htm")) *************** *** 299,302 **** --- 309,321 ---- + private static void setGcc(String gcc) { + _gcc = gcc; + + // When doing native compilation, we need a jarred runtime + if (_runtime == null) + _runtime = "share/java/nice.jar"; + } + + /** *************** *** 518,521 **** --- 537,546 ---- + static String getGcc() { + return _gcc; + } + + + /** * Returns whether comments should be written to output |
From: Daniel B. <bo...@us...> - 2005-02-23 16:09:26
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6393/web Modified Files: manual.xml Log Message: Use nicer syntax for printTuple (suggested by rfe #1124210). Index: manual.xml =================================================================== RCS file: /cvsroot/nice/Nice/web/manual.xml,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** manual.xml 8 Feb 2005 13:01:25 -0000 1.45 --- manual.xml 23 Feb 2005 16:08:59 -0000 1.46 *************** *** 1272,1282 **** (int, int) minMax(int x, int y) = x < y ? (x, y) : (y, x); ! void printTuple((int, int) tuple) { - /** Declare two local variables, and assign to each the corresponding value - in the tuple. - */ - (int x, int y) = tuple; - println("(" + x + ", " + y + ")"); } --- 1272,1277 ---- (int, int) minMax(int x, int y) = x < y ? (x, y) : (y, x); ! void printTuple((int x, int y)) { println("(" + x + ", " + y + ")"); } *************** *** 1288,1291 **** --- 1283,1293 ---- } ]]></programlisting> + + <para> + Note that <literal>printTuple</literal> has only one argument, + which is a tuple. We give the names <literal>x</literal> and + <literal>y</literal> to the two components of this tuple, so that + we can use them directly in the implementation of the method. + </para> </example> |
From: Daniel B. <bo...@us...> - 2005-02-22 16:57:31
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19762/src/bossa/syntax Modified Files: statement.nice Log Message: Avoid to set an imprecise bytecode location when a more precise one is available. Index: statement.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/statement.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** statement.nice 14 Jan 2005 16:41:27 -0000 1.2 --- statement.nice 22 Feb 2005 16:57:21 -0000 1.3 *************** *** 54,58 **** } ! if (s.location() != null) s.location().write(res[i]); } --- 54,58 ---- } ! if (s.location() != null && ! res[i].hasLocation()) s.location().write(res[i]); } |
From: Daniel B. <bo...@us...> - 2005-02-22 16:57:30
|
Update of /cvsroot/nice/Nice/src/gnu/expr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19762/src/gnu/expr Modified Files: Expression.java Log Message: Avoid to set an imprecise bytecode location when a more precise one is available. Index: Expression.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/expr/Expression.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Expression.java 3 Nov 2003 18:32:06 -0000 1.5 --- Expression.java 22 Feb 2005 16:57:18 -0000 1.6 *************** *** 166,169 **** --- 166,174 ---- } + public boolean hasLocation() + { + return getFile() != null && position != 0; + } + /** Return the Type used to represent the values of this Expression. */ public Type getType() |
From: Daniel B. <bo...@us...> - 2005-02-22 13:09:56
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20458/src/bossa/syntax Modified Files: customConstructor.nice Log Message: Avoid unnecessary cast. Index: customConstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/customConstructor.nice,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** customConstructor.nice 22 Feb 2005 10:27:09 -0000 1.22 --- customConstructor.nice 22 Feb 2005 13:09:44 -0000 1.23 *************** *** 188,194 **** void resolveCCThis(Statement stmt, Located thisLoc, NiceClass classe) { ! void missingThisError() { ! User.error(thisLoc, "The last statement must be a call to 'this' constructor"); } --- 188,194 ---- void resolveCCThis(Statement stmt, Located thisLoc, NiceClass classe) { ! UserError missingThisError() { ! return User.error(thisLoc, "The last statement must be a call to 'this' constructor"); } *************** *** 202,213 **** if (! (last instanceof ExpressionStmt)) ! missingThisError(); ! ! ExpressionStmt expstmt = cast(last); ! if (! (expstmt.exp instanceof CallExp)) missingThisError(); ! CallExp call = cast(expstmt.exp); if (! (call.function instanceof IdentExp)) --- 202,211 ---- if (! (last instanceof ExpressionStmt)) ! throw missingThisError(); ! if (! (last.exp instanceof CallExp)) missingThisError(); ! CallExp call = cast(last.exp); if (! (call.function instanceof IdentExp)) |
From: Daniel B. <bo...@us...> - 2005-02-22 13:00:40
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17388/src/bossa/syntax Modified Files: loop.nice Log Message: Replaced 'new LinkedList([...])' with '[...]' Index: loop.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/loop.nice,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** loop.nice 22 Feb 2005 10:27:07 -0000 1.12 --- loop.nice 22 Feb 2005 13:00:20 -0000 1.13 *************** *** 133,137 **** loc: loc, nullness: /*sure*/2); ! let getiter = createCallExp(createIdentExp(new LocatedString("forIterator", loc)), container); let iter = new LocatedString(loc.uniqueIdentifier("for_in_iter_"), loc); let init = new LocalVariable(iter, itertype, true, getiter); --- 133,137 ---- loc: loc, nullness: /*sure*/2); ! let getiter = createCallExp(createIdentExp(new LocatedString("forIterator", loc)), container); let iter = new LocatedString(loc.uniqueIdentifier("for_in_iter_"), loc); let init = new LocalVariable(iter, itertype, true, getiter); *************** *** 140,146 **** let getvar = createCallExp(createIdentExp(new LocatedString("next", loc)), iterexp); let assign = new LocalVariable(varName, vartype, true, getvar); ! let loop = new LoopStmt(whileExp: cond, loopBody: createBlock(new LinkedList([assign, body])), testFirst: true); ! return createBlock(new LinkedList([init, loop])); } --- 140,146 ---- let getvar = createCallExp(createIdentExp(new LocatedString("next", loc)), iterexp); let assign = new LocalVariable(varName, vartype, true, getvar); ! let loop = new LoopStmt(whileExp: cond, loopBody: createBlock([assign, body]), testFirst: true); + return createBlock([init, loop]); } |
From: Daniel B. <bo...@us...> - 2005-02-22 12:53:42
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15145/src/bossa/parser Modified Files: Parser.jj Log Message: Make sure try and synchronized statements have real blocks as substatements so that scoping works as expected. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.310 retrieving revision 1.311 diff -C2 -d -r1.310 -r1.311 *** Parser.jj 22 Feb 2005 10:27:10 -0000 1.310 --- Parser.jj 22 Feb 2005 12:53:16 -0000 1.311 *************** *** 2838,2847 **** } { ! "try" body=Block() { res = new TryStmt(body); } ( "catch" "(" tc=typeConstructorIdent() i=ident() ")" b=Block() { res.addCatch(tc, i, b); } )* ! [ "finally" b=Block() { res.setFinally(b); } ] { return res; } } --- 2838,2847 ---- } { ! "try" body=AlwaysBlock() { res = new TryStmt(body); } ( "catch" "(" tc=typeConstructorIdent() i=ident() ")" b=Block() { res.addCatch(tc, i, b); } )* ! [ "finally" b=AlwaysBlock() { res.setFinally(b); } ] { return res; } } *************** *** 2867,2871 **** { Expression object; Statement body; } { ! "synchronized" "(" object=Expression() ")" body=Block() { return new SynchronizedStmt(object, body); } } --- 2867,2871 ---- { Expression object; Statement body; } { ! "synchronized" "(" object=Expression() ")" body=AlwaysBlock() { return new SynchronizedStmt(object, body); } } |
From: Daniel B. <bo...@us...> - 2005-02-22 12:53:28
|
Update of /cvsroot/nice/Nice/testsuite/compiler/statements/variables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15145/testsuite/compiler/statements/variables Modified Files: scoping.testsuite Log Message: Make sure try and synchronized statements have real blocks as substatements so that scoping works as expected. Index: scoping.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/statements/variables/scoping.testsuite,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** scoping.testsuite 7 Oct 2004 22:03:45 -0000 1.2 --- scoping.testsuite 22 Feb 2005 12:53:15 -0000 1.3 *************** *** 20,21 **** --- 20,58 ---- this(); } + + /// PASS + try { + int x = 1; + } catch(Error e) { + int x = 2; + } finally { + int x = 3; + } + + /// PASS + try { + int x = 1; + } catch(Error e) { + } + int x = 2; + + /// PASS + try { + } catch(Error e) { + int x = 1; + } + int x = 2; + + /// PASS + try { + } finally { + int x = 1; + } + int x = 2; + + /// PASS + String s = ""; + synchronized(s) { + int x = 1; + } + int x = 2; |
From: Daniel B. <bo...@us...> - 2005-02-22 12:29:36
|
Update of /cvsroot/nice/Nice/regtest/basic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7306/regtest/basic Modified Files: syntax.nice Log Message: while(false) is now illegal. Index: syntax.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/syntax.nice,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** syntax.nice 2 Dec 2003 20:34:43 -0000 1.9 --- syntax.nice 22 Feb 2005 12:28:58 -0000 1.10 *************** *** 6,14 **** { // While with empty body ! while(false) {} // For with empty body ! for (;false;) {} --- 6,14 ---- { // While with empty body ! while(1 == 2) {} // For with empty body ! for (;1 == 2;) {} *************** *** 35,37 **** ! // We put this comment on the last line, without a trailing newline. \ No newline at end of file --- 35,39 ---- ! // We put a comment on the last line, without a trailing newline. ! // Local Variables: *** ! // require-final-newline:nil *** \ No newline at end of file |
From: Daniel B. <bo...@us...> - 2005-02-22 10:29:08
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16668/src/bossa/syntax Modified Files: typecheck.nice loop.nice locals.nice customConstructor.nice block.nice analyse.nice Log Message: Avoid building blocks that contain a single statement, unless necessary for scoping reasons. Index: analyse.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/analyse.nice,v retrieving revision 1.129 retrieving revision 1.130 diff -C2 -d -r1.129 -r1.130 *** analyse.nice 17 Jan 2005 18:26:14 -0000 1.129 --- analyse.nice 22 Feb 2005 10:27:09 -0000 1.130 *************** *** 765,769 **** l.whileExp = analyse(l.whileExp, info); if (notNull(l.whileExp).isFalse()) ! info.setUnreachable(); } --- 765,769 ---- l.whileExp = analyse(l.whileExp, info); if (notNull(l.whileExp).isFalse()) ! throw error(l.loopBody, "This statement is never executed"); } Index: customConstructor.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/customConstructor.nice,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** customConstructor.nice 17 Jan 2005 18:26:18 -0000 1.21 --- customConstructor.nice 22 Feb 2005 10:27:09 -0000 1.22 *************** *** 193,208 **** } ! Block block = cast(stmt); ! ! if (block.statements.length == 0) ! missingThisError(); - Statement last = block.last; - if (last instanceof Block) - { - resolveCCThis(last, thisLoc, classe); - return; - } - if (! (last instanceof ExpressionStmt)) missingThisError(); --- 193,204 ---- } ! var last = stmt; ! while (last instanceof Block) ! { ! if (last.statements.length == 0) ! missingThisError(); ! last = last.last; ! } if (! (last instanceof ExpressionStmt)) missingThisError(); Index: block.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/block.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** block.nice 16 Jan 2005 00:28:21 -0000 1.4 --- block.nice 22 Feb 2005 10:27:09 -0000 1.5 *************** *** 136,146 **** } ! public Block createBlock(List<Statement> statements) { ! let res = new Block(statements: cast(null)); ! let stmts = res.cutInBlocks(statements); ! res.statements = stmts; ! if (stmts.length > 0) ! res.setLocation(stmts[0].location()); ! return res; } --- 136,161 ---- } ! public Statement createBlock(List<Statement> statements) = ! createBlock(statements, false, null); ! ! /** ! @param always When true, always create a block. When false, a block might ! not be created if there are not several statements. ! */ ! public Statement createBlock(List<Statement> statements, boolean always, ! ?Location loc) { ! if (!always && statements.size() == 1) ! return statements[0]; ! ! let res = new Block(statements: cast(null)); ! let stmts = res.cutInBlocks(statements); ! res.statements = stmts; ! ! if (loc != null) ! res.setLocation(loc); ! else if (stmts.length > 0) ! res.setLocation(stmts[0].location()); ! ! return res; } Index: loop.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/loop.nice,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** loop.nice 16 Jan 2005 00:28:21 -0000 1.11 --- loop.nice 22 Feb 2005 10:27:07 -0000 1.12 *************** *** 23,27 **** ?Expression whileExp; final Statement loopBody; ! final ?Block iterationStatements = null; final boolean testFirst; --- 23,27 ---- ?Expression whileExp; final Statement loopBody; ! final ?Statement iterationStatements = null; final boolean testFirst; *************** *** 88,106 **** return "while (" + whileExp + ")" + loopBody; ! Statement[] itStatements = notNull(iterationStatements).statements; ! String itStats = ""; ! for (int i = 0; i<itStatements.length; i++) ! { ! String tmp = itStatements[i].toString(); ! itStats += tmp.substring(0, tmp.lastIndexOf(';')); ! if (i<itStatements.length-1) itStats += ", "; ! } ! return "for(; " + whileExp + " ;" + itStats + ")\n " + loopBody; } } public Statement createForLoop ! (Expression test, Block update, Statement body, List<Statement> inits) { inits.add(new LoopStmt(whileExp:test, loopBody: body, iterationStatements: update, testFirst: true)); --- 88,121 ---- return "while (" + whileExp + ")" + loopBody; ! String itStats = iterationStatementsToString(notNull(iterationStatements)); ! return "for(; "whileExp"; "itStats")\n "loopBody; } } + private String iterationStatementsToString(Statement s) + { + String res = s.toString(); + return res.substring(0, res.lastIndexOf(';')); + } + + iterationStatementsToString(Block iterationStatements) + { + Statement[] itStatements = iterationStatements.statements; + + StringBuffer res = new StringBuffer(); + for (int i = 0; i < itStatements.length; i++) + { + String tmp = itStatements[i].toString(); + res.append(tmp.substring(0, tmp.lastIndexOf(';'))); + if (i < itStatements.length - 1) res.append(", "); + } + + return res.toString(); + } + + public Statement createForLoop ! (Expression test, Statement update, Statement body, List<Statement> inits) { inits.add(new LoopStmt(whileExp:test, loopBody: body, iterationStatements: update, testFirst: true)); Index: locals.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/locals.nice,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** locals.nice 16 Jan 2005 00:28:21 -0000 1.10 --- locals.nice 22 Feb 2005 10:27:07 -0000 1.11 *************** *** 45,49 **** generateCode() { ! throw Internal.error("Should not be called"); } --- 45,59 ---- generateCode() { ! /* ! This declaration is not inside a block, so it must be on its own. ! We still need to compile it, because the computation of the value ! can have side effects and for testing/debugging purposes. ! */ ! ! gnu.expr.Expression[] inits = cast(new gnu.expr.Expression[1]); ! let letExp = new gnu.expr.LetExp(inits); ! inits[0] = this.compile(letExp); ! letExp.setBody(gnu.expr.QuoteExp.voidExp); ! return letExp; } Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -d -r1.124 -r1.125 *** typecheck.nice 16 Jan 2005 00:28:21 -0000 1.124 --- typecheck.nice 22 Feb 2005 10:26:42 -0000 1.125 *************** *** 828,832 **** { s.exp = s.exp.noOverloading(); ! typecheck(s.exp); } --- 828,833 ---- { s.exp = s.exp.noOverloading(); ! try { typecheck(s.exp); } ! catch (bossa.util.UserError ex) { throw ensureLocated(ex, s); } } |
From: Daniel B. <bo...@us...> - 2005-02-22 10:28:31
|
Update of /cvsroot/nice/Nice/testsuite/compiler/statements/flow In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16668/testsuite/compiler/statements/flow Modified Files: reachability.testsuite Log Message: Avoid building blocks that contain a single statement, unless necessary for scoping reasons. Index: reachability.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/statements/flow/reachability.testsuite,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** reachability.testsuite 30 Nov 2003 14:24:35 -0000 1.7 --- reachability.testsuite 22 Feb 2005 10:26:33 -0000 1.8 *************** *** 1,5 **** /// FAIL ! while (false) { ! /*/// FAIL HERE */ {} // Unreachable } --- 1,9 ---- /// FAIL ! while (false) /*/// FAIL HERE */ { ! } ! ! /// FAIL ! while (false) /*/// FAIL HERE */ { ! {} // Unreachable } *************** *** 13,18 **** /// FAIL ! for (;false;) { ! /*/// FAIL HERE */ {} // Unreachable } --- 17,26 ---- /// FAIL ! for (;false;) /*/// FAIL HERE */ { ! } ! ! /// FAIL ! for (;false;) /*/// FAIL HERE */ { ! {} // Unreachable } |
From: Daniel B. <bo...@us...> - 2005-02-22 10:28:13
|
Update of /cvsroot/nice/Nice/testsuite/compiler/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16668/testsuite/compiler/syntax Modified Files: loops.testsuite Log Message: Avoid building blocks that contain a single statement, unless necessary for scoping reasons. Index: loops.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/syntax/loops.testsuite,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** loops.testsuite 30 Nov 2003 14:24:35 -0000 1.4 --- loops.testsuite 22 Feb 2005 10:26:32 -0000 1.5 *************** *** 4,8 **** /// PASS ! for (int x = 0, boolean ok = false; false;) {} /// PASS --- 4,8 ---- /// PASS ! for (int x = 0, boolean ok = false; ok;) {} /// PASS |
From: Daniel B. <bo...@us...> - 2005-02-22 10:28:11
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16668/src/bossa/parser Modified Files: Parser.jj Log Message: Avoid building blocks that contain a single statement, unless necessary for scoping reasons. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.309 retrieving revision 1.310 diff -C2 -d -r1.309 -r1.310 *** Parser.jj 21 Feb 2005 12:44:54 -0000 1.309 --- Parser.jj 22 Feb 2005 10:27:10 -0000 1.310 *************** *** 2376,2380 **** LOOKAHEAD(2) res=LabeledStatement() ! | res=Block() | res=RealStatementExpression() | res=IfStatement() --- 2376,2380 ---- LOOKAHEAD(2) res=LabeledStatement() ! | res=AlwaysBlock() | res=RealStatementExpression() | res=IfStatement() *************** *** 2420,2423 **** --- 2420,2437 ---- Statement Block() : + { Statement res; } + { + res = _Block(false) + { return res; } + } + + Statement AlwaysBlock() : + { Statement res; } + { + res = _Block(true) + { return res; } + } + + Statement _Block(boolean always) : { Token first, last; Statement s; List statements; } { *************** *** 2429,2435 **** { last = getToken(0); ! Statement res = bossa.syntax.dispatch.createBlock(statements); ! res.setLocation(makeLocation(first, last)); ! return res; } } --- 2443,2448 ---- { last = getToken(0); ! return bossa.syntax.dispatch.createBlock(statements, always, ! makeLocation(first, last)); } } *************** *** 2728,2732 **** Statement ForStatement() : ! { Block update = null; Statement loop = null, body, statexp; Expression cond = null; --- 2741,2745 ---- Statement ForStatement() : ! { Statement update = null; Statement loop = null, body, statexp; Expression cond = null; *************** *** 2774,2778 **** } ! Block StatementExpressionList() : { Statement s; List statements=new LinkedList(); } { --- 2787,2791 ---- } ! Statement StatementExpressionList() : { Statement s; List statements=new LinkedList(); } { |
From: Daniel B. <bo...@us...> - 2005-02-22 10:28:05
|
Update of /cvsroot/nice/Nice/testsuite/compiler/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16668/testsuite/compiler/functions Modified Files: return.testsuite Log Message: Avoid building blocks that contain a single statement, unless necessary for scoping reasons. Index: return.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/functions/return.testsuite,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** return.testsuite 13 Jun 2003 14:57:51 -0000 1.3 --- return.testsuite 22 Feb 2005 10:26:36 -0000 1.4 *************** *** 45,49 **** // local function int f() ! /* /// FAIL HERE */ { ! if (x > 0) return x; } --- 45,49 ---- // local function int f() ! { ! /* /// FAIL HERE */ if (x > 0) return x; } |
From: Daniel B. <bo...@us...> - 2005-02-21 19:04:30
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32304/src/bossa/syntax Modified Files: symbol.nice Log Message: More robust implementation of toString. Index: symbol.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/symbol.nice,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** symbol.nice 16 Jan 2005 00:28:21 -0000 1.12 --- symbol.nice 21 Feb 2005 19:03:57 -0000 1.13 *************** *** 196,203 **** toString() { ! if (type == null) return notNull(syntacticType) + " " + name; ! return notNull(type) + " " + name; } } --- 196,206 ---- toString() { ! if (type != null) ! return notNull(type) + " " + name; ! ! if (syntacticType != null) return notNull(syntacticType) + " " + name; ! return ""name; } } |
From: Daniel B. <bo...@us...> - 2005-02-21 12:45:13
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28234/src/bossa/parser Modified Files: Parser.jj Log Message: Whitespace cleanup. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.308 retrieving revision 1.309 diff -C2 -d -r1.308 -r1.309 *** Parser.jj 17 Jan 2005 13:16:56 -0000 1.308 --- Parser.jj 21 Feb 2005 12:44:54 -0000 1.309 *************** *** 101,105 **** } ! SPECIAL_TOKEN : { <SINGLE_LINE_COMMENT: "//" (~["\n", "\r"])* ("\n" | "\r" | "\r\n" )? > } --- 101,105 ---- } ! SPECIAL_TOKEN : { <SINGLE_LINE_COMMENT: "//" (~["\n", "\r"])* ("\n" | "\r" | "\r\n" )? > } [...2239 lines suppressed...] )* --- 2827,2831 ---- "try" body=Block() { res = new TryStmt(body); } ! ( "catch" "(" tc=typeConstructorIdent() i=ident() ")" b=Block() { res.addCatch(tc, i, b); } )* *************** *** 2843,2847 **** t = "assert" condition = SideEffectFreeExpression() ! ( ":" message = SideEffectFreeExpression() { call = bossa.syntax.dispatch.createCallExp(symb(t), condition, message); } | --- 2843,2847 ---- t = "assert" condition = SideEffectFreeExpression() ! ( ":" message = SideEffectFreeExpression() { call = bossa.syntax.dispatch.createCallExp(symb(t), condition, message); } | |
From: Daniel B. <bo...@us...> - 2005-02-20 22:34:40
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28181 Modified Files: NEWS Log Message: Give the end of the method as the location of implicit returns, so as to make debuggers display sensible lines when jumping to the end of a void method. Index: NEWS =================================================================== RCS file: /cvsroot/nice/Nice/NEWS,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** NEWS 19 Feb 2005 16:00:26 -0000 1.61 --- NEWS 20 Feb 2005 22:34:26 -0000 1.62 *************** *** 24,27 **** --- 24,28 ---- UnknownTypes as type parameters instead of being ignored. * Number of errors and warning are printed to the console. + * Improved source information for debuggers. * Generated classes are smaller, thanks to smaller debugging information. * Native compilation with gcj is twice faster. |
From: Daniel B. <bo...@us...> - 2005-02-20 22:09:49
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22241/src/bossa/syntax Modified Files: methodImplementation.nice Log Message: Give the end of the method as the location of implicit returns, so as to make debuggers display sensible lines when jumping to the end of a void method. Index: methodImplementation.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/methodImplementation.nice,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** methodImplementation.nice 16 Jan 2005 00:28:21 -0000 1.12 --- methodImplementation.nice 20 Feb 2005 22:09:40 -0000 1.13 *************** *** 141,144 **** --- 141,150 ---- ref = this.createRef(); nice.tools.code.Gen.setMethodBody(compiledMethod, body.generateCode()); + + /* We remember the end of the method's body as its location. + This information is used to give the line number of implicit + returns at the end of void methods. + */ + body.location().writeEnd(compiledMethod); } |
From: Daniel B. <bo...@us...> - 2005-02-20 22:09:48
|
Update of /cvsroot/nice/Nice/src/bossa/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22241/src/bossa/util Modified Files: Location.java Log Message: Give the end of the method as the location of implicit returns, so as to make debuggers display sensible lines when jumping to the end of a void method. Index: Location.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/util/Location.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Location.java 1 Jul 2004 11:52:08 -0000 1.29 --- Location.java 20 Feb 2005 22:09:40 -0000 1.30 *************** *** 96,99 **** --- 96,103 ---- } + public void writeEnd(gnu.expr.Expression exp) + { + } + public void write(gnu.expr.Declaration decl) { *************** *** 171,175 **** return startLine; } ! public int getColumn() { --- 175,179 ---- return startLine; } ! public int getColumn() { *************** *** 201,204 **** --- 205,214 ---- } + public void writeEnd(gnu.expr.Expression exp) + { + super.write(exp); + exp.setLine(endLine, endColumn); + } + public void write(gnu.expr.Declaration decl) { |
From: Daniel B. <bo...@us...> - 2005-02-20 22:09:48
|
Update of /cvsroot/nice/Nice/src/gnu/expr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22241/src/gnu/expr Modified Files: LambdaExp.java Log Message: Give the end of the method as the location of implicit returns, so as to make debuggers display sensible lines when jumping to the end of a void method. Index: LambdaExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/expr/LambdaExp.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** LambdaExp.java 20 Feb 2005 21:20:01 -0000 1.29 --- LambdaExp.java 20 Feb 2005 22:09:39 -0000 1.30 *************** *** 489,493 **** && (! Compilation.usingTailCalls || isModuleBody() || isClassMethod() || isHandlingTailCalls())) ! code.emitReturn(); code.popScope(); // Undoes enterScope in allocParameters } --- 489,500 ---- && (! Compilation.usingTailCalls || isModuleBody() || isClassMethod() || isHandlingTailCalls())) ! { ! // The line of a method is by convention it's last one, ! // specifically to make this feature possible. ! if (getLine() > 0) ! code.putLineNumber(getFile(), getLine()); ! ! code.emitReturn(); ! } code.popScope(); // Undoes enterScope in allocParameters } |
From: Daniel B. <bo...@us...> - 2005-02-20 21:20:11
|
Update of /cvsroot/nice/Nice/src/bossa/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8827/src/bossa/modules Modified Files: Package.java Log Message: Don't include a SourceFile attribute in the generated classes. It's only SourceDebugExtension that can give accurate source information. Index: Package.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Package.java,v retrieving revision 1.135 retrieving revision 1.136 diff -C2 -d -r1.135 -r1.136 *** Package.java 16 Feb 2005 16:24:33 -0000 1.135 --- Package.java 20 Feb 2005 21:20:02 -0000 1.136 *************** *** 676,682 **** res.setSimple(true); res.body = QuoteExp.voidExp; - // This is not true, but useful to make some Java-centric tools happy. - // The real file info in the the SourceDebugExtension attribute. - res.setFile(name.substring(name.lastIndexOf('.') + 1) + ".nice"); res.needsConstructor = true; return res; --- 676,679 ---- |
From: Daniel B. <bo...@us...> - 2005-02-20 21:20:10
|
Update of /cvsroot/nice/Nice/src/gnu/expr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8827/src/gnu/expr Modified Files: LambdaExp.java Log Message: Don't include a SourceFile attribute in the generated classes. It's only SourceDebugExtension that can give accurate source information. Index: LambdaExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/expr/LambdaExp.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** LambdaExp.java 20 Feb 2005 13:20:03 -0000 1.28 --- LambdaExp.java 20 Feb 2005 21:20:01 -0000 1.29 *************** *** 998,1002 **** name = comp.generateUniqueName(name); frameType = new ClassType(name); ! frameType.setSourceFile(outerClass.getFile()); } else --- 998,1003 ---- name = comp.generateUniqueName(name); frameType = new ClassType(name); ! if (outerClass.getFile() != null) ! frameType.setSourceFile(outerClass.getFile()); } else |
From: Daniel B. <bo...@us...> - 2005-02-20 13:20:23
|
Update of /cvsroot/nice/Nice/src/gnu/expr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10410/src/gnu/expr Modified Files: LambdaExp.java Log Message: Revert to revision 1.26 since the case of falsely reachable points because of 'assert false' is handled in the more general case by stdlib/nice/lang/inline/Assert.java revision 1.8. Index: LambdaExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/expr/LambdaExp.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** LambdaExp.java 25 Dec 2004 15:51:44 -0000 1.27 --- LambdaExp.java 20 Feb 2005 13:20:03 -0000 1.28 *************** *** 482,510 **** { if (comp.method.reachableHere() && (! Compilation.usingTailCalls || isModuleBody() || isClassMethod() || isHandlingTailCalls())) ! { ! /* If there is a value to return, or the method returns void, ! then emit a return. ! */ ! if (code.SP > 0 || comp.method.getReturnType().isVoid()) ! code.emitReturn(); ! else ! /* ! This can happen for unreachable code, like after an ! 'assert false' in a non-void method. ! ! It can also be because reachableHere is not computed properly. ! */ ! { ! // Throw an error explaining the situation. ! ClassType error = ClassType.make("java.lang.Error"); ! code.emitNew(error); ! code.emitDup(); ! code.emitPushString("Invalid location reached. Enable assertion checking to get more precise information"); ! code.emitInvokeSpecial(error.getDeclaredMethod("<init>", new Type[]{Type.string_type})); ! code.emitThrow(); ! } ! } code.popScope(); // Undoes enterScope in allocParameters } --- 482,493 ---- { if (comp.method.reachableHere() + /* Work-around since reachableHere is not computed properly: + Only return if the method is void or if there is a value + on the stack. + */ + && (code.SP > 0 || comp.method.getReturnType().isVoid()) && (! Compilation.usingTailCalls || isModuleBody() || isClassMethod() || isHandlingTailCalls())) ! code.emitReturn(); code.popScope(); // Undoes enterScope in allocParameters } |
From: Daniel B. <bo...@us...> - 2005-02-19 16:00:35
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16435 Modified Files: NEWS Log Message: Mention smaller classes and faster native compilation. Index: NEWS =================================================================== RCS file: /cvsroot/nice/Nice/NEWS,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** NEWS 19 Feb 2005 13:25:31 -0000 1.60 --- NEWS 19 Feb 2005 16:00:26 -0000 1.61 *************** *** 24,27 **** --- 24,29 ---- UnknownTypes as type parameters instead of being ignored. * Number of errors and warning are printed to the console. + * Generated classes are smaller, thanks to smaller debugging information. + * Native compilation with gcj is twice faster. * Bug fixes (disallowed redefinition of parameters, execution order of initializers in super classes, visibility checking of java classes, |