nice-commit Mailing List for The Nice Programming Language (Page 112)
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-05-01 18:51:01
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv23396/F:/nice/stdlib/nice/lang Modified Files: java.nice Log Message: Made containsAll, removeAll and retainAll bivariant or something like that. Index: java.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/java.nice,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** java.nice 23 Apr 2003 21:46:04 -0000 1.20 --- java.nice 1 May 2003 18:50:57 -0000 1.21 *************** *** 104,112 **** native boolean java.util.List.addAll(int, java.util.Collection); ! <T, U | T <: U> boolean containsAll(Collection<T>, Collection<U>) = native boolean java.util.Collection.containsAll(java.util.Collection); ! <T, U | T <: U> boolean removeAll(Collection<T>, Collection<U>) = native boolean java.util.Collection.removeAll(java.util.Collection); ! <T, U | T <: U> boolean retainAll(Collection<T>, Collection<U>) = native boolean java.util.Collection.retainAll(java.util.Collection); --- 104,112 ---- native boolean java.util.List.addAll(int, java.util.Collection); ! <T, U, V | T <: V, U <: V> boolean containsAll(Collection<T>, Collection<U>) = native boolean java.util.Collection.containsAll(java.util.Collection); ! <T, U, V | T <: V, U <: V> boolean removeAll(Collection<T>, Collection<U>) = native boolean java.util.Collection.removeAll(java.util.Collection); ! <T, U, V | T <: V, U <: V> boolean retainAll(Collection<T>, Collection<U>) = native boolean java.util.Collection.retainAll(java.util.Collection); |
From: <bo...@us...> - 2003-05-01 13:30:49
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv22001 Modified Files: manual.xsl Makefile Removed Files: common.xsl Log Message: Also use the manual stysheet for the safety article. Index: manual.xsl =================================================================== RCS file: /cvsroot/nice/Nice/web/manual.xsl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** manual.xsl 24 Apr 2003 13:04:57 -0000 1.2 --- manual.xsl 1 May 2003 13:29:55 -0000 1.3 *************** *** 16,19 **** --- 16,21 ---- version='1.0' xmlns="http://www.w3.org/TR/xhtml1/transitional" + xmlns:exsl="http://exslt.org/common" + extension-element-prefixes="exsl" exclude-result-prefixes="#default"> *************** *** 22,25 **** --- 24,45 ---- <xsl:template match="type"> <xsl:call-template name="inline.monoseq"/> + </xsl:template> + + <!-- Usage: <javaexn name="SomeException"/> --> + + <xsl:template match="javaexn"> + + <xsl:element name="a"> + <xsl:attribute name="href"> + http://java.sun.com/j2se/1.3/docs/api/java/lang/<xsl:value-of select="@name"/>.html + </xsl:attribute> + <xsl:value-of select="@name"/> + </xsl:element> + + </xsl:template> + + <!-- In no.anchor.mode, just copy the name of the exception. --> + <xsl:template match="title//javaexn" mode="no.anchor.mode"> + <xsl:value-of select="@name"/> </xsl:template> Index: Makefile =================================================================== RCS file: /cvsroot/nice/Nice/web/Makefile,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Makefile 26 Apr 2003 13:34:37 -0000 1.9 --- Makefile 1 May 2003 13:30:07 -0000 1.10 *************** *** 10,20 **** PROC=xsltproc --nonet - STYLESHEET=common.xsl - STYLEOPT= .PHONY : clean send all: index.html research.html compilation.html testimonials.html install.html \ ! roadmap.html manual.html manual.pdf manual.ps send: all --- 10,18 ---- PROC=xsltproc --nonet .PHONY : clean send all: index.html research.html compilation.html testimonials.html install.html \ ! roadmap.html safety.html manual.html manual.pdf manual.ps send: all *************** *** 24,28 **** manual.html: manual.xsl manual.xml ! $(PROC) manual.xsl manual.xml > $@ manual.pdf manual.ps: manual.xml --- 22,26 ---- manual.html: manual.xsl manual.xml ! if ! $(PROC) manual.xsl manual.xml > $@; then rm manual.html; fi manual.pdf manual.ps: manual.xml *************** *** 30,36 **** %.html: %.xml new.xsl ! $(PROC) new.xsl $*.xml $(STYLEOPT) > $@ # Old style ! safety.html: %.xml $(STYLESHEET) ! $(PROC) $(STYLESHEET) $*.xml $(STYLEOPT) > $@ --- 28,34 ---- %.html: %.xml new.xsl ! $(PROC) new.xsl $*.xml > $@ # Old style ! safety.html: manual.xsl safety.xml ! if ! $(PROC) manual.xsl safety.xml > $@; then rm safety.html; fi --- common.xsl DELETED --- |
From: <bo...@us...> - 2003-05-01 13:26:32
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv20636 Modified Files: safety.xml Log Message: Use the docbook article dtd. Updated to take into account the possibility to do multiple dispatch on java methods. Index: safety.xml =================================================================== RCS file: /cvsroot/nice/Nice/web/safety.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** safety.xml 27 Apr 2003 20:21:34 -0000 1.2 --- safety.xml 1 May 2003 13:26:27 -0000 1.3 *************** *** 1,17 **** <?xml version="1.0" standalone="no"?> ! <!DOCTYPE website PUBLIC "-//Norman Walsh//DTD Website V2.0b1//EN" ! "http://docbook.sourceforge.net/release/website/2.0b1/website.dtd" [ <!ENTITY nice "Nice"> <!ENTITY java "Java"> ]> ! <webpage id="safety"> ! <config param="footlink" value="home" altval="Home"/> ! <config param="desc" value="Why programs written in Nice have less bugs"/> ! <config param="rcsdate" value="$Date$"/> ! <head> ! <title>Type safety in &nice;</title> ! <summary>Introduction</summary> ! <keywords>nice, safety, java, null pointer, exception, cast</keywords> ! </head> <section><title>Introduction</title> --- 1,23 ---- <?xml version="1.0" standalone="no"?> ! <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" ! "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ <!ENTITY nice "Nice"> <!ENTITY java "Java"> ]> ! <article> ! <articleinfo> ! <author><firstname>Daniel</firstname><surname>Bonniot</surname></author> ! <authorinitials>db</authorinitials> ! <title>Type safety in &nice;</title> ! <subtitle>Why programs written in Nice have less bugs</subtitle> ! <keywordset> ! <keyword>nice</keyword> ! <keyword>safety</keyword> ! <keyword>java</keyword> ! <keyword>null pointer</keyword> ! <keyword>exception</keyword> ! <keyword>cast</keyword> ! </keywordset> ! </articleinfo> <section><title>Introduction</title> *************** *** 235,247 **** <para> <programlisting lang="java"> ! class Object ! { ! boolean equals(Object that) ! { ! return this == that; ! } ! } ! ! class Person extends Object { String name; --- 241,245 ---- <para> <programlisting lang="java"> ! class Person { String name; *************** *** 275,283 **** <para> <programlisting lang="nice"> - <Any T> boolean equals(T this, T that); - - // default implementation - equals(this, that) = this == that; - class Person { --- 273,276 ---- *************** *** 556,558 **** </section> ! </webpage> --- 549,551 ---- </section> ! </article> |
From: <ar...@us...> - 2003-05-01 11:02:22
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv13535/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Merged the 3 parts of the funexps for cleanup. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.166 retrieving revision 1.167 diff -C2 -d -r1.166 -r1.167 *** Parser.jj 30 Apr 2003 21:52:51 -0000 1.166 --- Parser.jj 1 May 2003 11:02:17 -0000 1.167 *************** *** 1421,1437 **** } { ! ( "var" {constant = false;} t=monotype() name=ident() [ "=" ! ( LOOKAHEAD(funExp()) value=funExp() ! | LOOKAHEAD(monoSymbol() "=>") value=simpleVarFunExp() ! | value=SideEffectFreeExpression() ) ] ! | "let" {constant = true;} t=monotype() name=ident() "=" ! ( LOOKAHEAD(funExp()) value=funExp() ! | LOOKAHEAD(monoSymbol() "=>") value=simpleVarFunExp() ! | value=SideEffectFreeExpression() ) ) --- 1421,1441 ---- } { ! ( ! "var" {constant = false;} t=monotype() name=ident() [ "=" ! ( ! LOOKAHEAD(funExp()) value=funExp() ! | ! value=SideEffectFreeExpression() ) ] ! | ! "let" {constant = true;} t=monotype() name=ident() "=" ! ( ! LOOKAHEAD(funExp()) value=funExp() ! | ! value=SideEffectFreeExpression() ) ) *************** *** 1594,1640 **** { List formals; ! Constraint cst; ! Token f = null; ! FunExp res; ! } ! { ! [f = "fun"] ! cst=constraint() ! "(" formals=monoSymbols() ")" ! res=endFunExp(formals, cst) ! { ! if (f != null) ! bossa.util.User.warning(new Location(f), "The 'fun(...) =>' syntax is deprecated, just leave 'fun' away."); ! return res; ! } ! } ! ! FunExp simpleVarFunExp(): ! { MonoSymbol sym; - List formals; - FunExp res; - } - { - sym=monoSymbol() - { formals = new LinkedList(); formals.add(sym); } - res=endFunExp(formals, Constraint.True) - { return res; } - } - - FunExp endFunExp(List formals, Constraint cst): - { Statement body; Expression exp; } { "=>" ( ! body = RootShortStatement() | ! exp=Expression() ! { ! body=new ReturnStmt(exp); ! } ) { return new FunExp(cst,formals,body); } --- 1598,1624 ---- { List formals; ! Constraint cst = Constraint.True; MonoSymbol sym; Statement body; Expression exp; + Token f; } { + ( + LOOKAHEAD ( ["fun"] constraint() "(" monoSymbols() ")" ) + [ + f="fun" { bossa.util.User.warning(new Location(f), + "The 'fun(...) =>' syntax is deprecated, just leave 'fun' away."); } + ] + cst=constraint() + "(" formals=monoSymbols() ")" + | + sym=monoSymbol() { formals = new LinkedList(); formals.add(sym); } + ) "=>" ( ! body=RootShortStatement() | ! exp=Expression() { body = new ReturnStmt(exp); } ) { return new FunExp(cst,formals,body); } *************** *** 1792,1798 **** { first=getToken(1); } ! ( //TODO: simplify next lookahead after removal of the 'fun' keyword. LOOKAHEAD(funExp()) e1=funExp() - | LOOKAHEAD(monoSymbol() "=>") e1=simpleVarFunExp() | e1=ClassicExpression() ) --- 1776,1781 ---- { first=getToken(1); } ! ( LOOKAHEAD(funExp()) e1=funExp() | e1=ClassicExpression() ) |
From: <ar...@us...> - 2003-04-30 21:58:42
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1:/tmp/cvs-serv674/F:/nice/testsuite/compiler/classes Modified Files: variance.testsuite Log Message: Removed bug marker. Index: variance.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/variance.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** variance.testsuite 5 Apr 2003 11:28:53 -0000 1.1 --- variance.testsuite 30 Apr 2003 21:58:38 -0000 1.2 *************** *** 1,3 **** ! /// FAIL bug /// Toplevel interface X{} --- 1,3 ---- ! /// FAIL /// Toplevel interface X{} |
From: <ar...@us...> - 2003-04-30 21:52:55
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv31093/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: The default value of a global constant/variable can also be a funexp. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.165 retrieving revision 1.166 diff -C2 -d -r1.165 -r1.166 *** Parser.jj 30 Apr 2003 20:20:33 -0000 1.165 --- Parser.jj 30 Apr 2003 21:52:51 -0000 1.166 *************** *** 1422,1428 **** { ( "var" {constant = false;} ! t=monotype() name=ident() [ "=" value=SideEffectFreeExpression() ] | "let" {constant = true;} ! t=monotype() name=ident() "=" value=SideEffectFreeExpression() ) ";" --- 1422,1438 ---- { ( "var" {constant = false;} ! t=monotype() name=ident() ! [ "=" ! ( LOOKAHEAD(funExp()) value=funExp() ! | LOOKAHEAD(monoSymbol() "=>") value=simpleVarFunExp() ! | value=SideEffectFreeExpression() ! ) ! ] | "let" {constant = true;} ! t=monotype() name=ident() "=" ! ( LOOKAHEAD(funExp()) value=funExp() ! | LOOKAHEAD(monoSymbol() "=>") value=simpleVarFunExp() ! | value=SideEffectFreeExpression() ! ) ) ";" |
From: <ar...@us...> - 2003-04-30 21:24:39
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv19964/F:/nice/debian Modified Files: changelog Log Message: Make the merge correct. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.156 retrieving revision 1.157 diff -C2 -d -r1.156 -r1.157 *** changelog 30 Apr 2003 21:22:08 -0000 1.156 --- changelog 30 Apr 2003 21:24:32 -0000 1.157 *************** *** 7,12 **** equals(that@A) = this.x == that.x; } - * Compilation does not fail anymore if some classes on the classpath - have an invalid bytecode format. * In a method implementation, binding the type parameters should now be done in front: --- 7,10 ---- |
From: <ar...@us...> - 2003-04-30 21:22:16
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv19045/F:/nice/debian Modified Files: changelog Log Message: Updated the changelog about local an global variables. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.155 retrieving revision 1.156 diff -C2 -d -r1.155 -r1.156 *** changelog 30 Apr 2003 21:09:40 -0000 1.155 --- changelog 30 Apr 2003 21:22:08 -0000 1.156 *************** *** 7,10 **** --- 7,12 ---- equals(that@A) = this.x == that.x; } + * Compilation does not fail anymore if some classes on the classpath + have an invalid bytecode format. * In a method implementation, binding the type parameters should now be done in front: *************** *** 28,33 **** return res; } ! * Improved error messages for possibly null values in assignments (Daniel), ! and for incorrect calls to constructors (Bryn Keller). * Integer values can used as arrays of bits, as in if (x[index]) ... --- 30,54 ---- return res; } ! * Changed the syntax for local variables. The "final" keyword is deprecated ! now for local variables, use "let" instead. In addition to the standard ! "type name = ..." syntax two new forms are allowed: ! let [ type ] name = [ expression ] ! var [ type ] name = [ expression ] ! At least a type or a default value are required. ! The type can only be left away when the compiler is able to interfere ! the type which is not always possible. ! A non function example to show some aspects the new syntax: ! let int[] arr = [1,2,3,4]; // here type interference doesn't work. ! List<int> list = new ArrayList(); ! list.addAll(arr); ! for(let iter = list.iterator(); iter.hasNext();) { ! let String s; ! var i = iter.next(); ! if (i % 2 == 0) { s = "even"; } ! else { s = "odd"; } ! println(i.toString()+" is "+s); ! } ! * Added global constants similar to the global variables, the syntax is: ! let type name = somexpression ; * Integer values can used as arrays of bits, as in if (x[index]) ... *************** *** 35,38 **** --- 56,61 ---- * Compilation does not fail anymore if some classes on the classpath have an invalid bytecode format. + * Improved error messages for possibly null values in assignments (Daniel), + and for incorrect calls to constructors (Bryn Keller). * Bugfix (overloaded symbols used inside && or || expressions). |
From: <bo...@us...> - 2003-04-30 21:09:44
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv14722/debian Modified Files: changelog Log Message: Integer values can used as arrays of bits. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -d -r1.154 -r1.155 *** changelog 30 Apr 2003 20:40:04 -0000 1.154 --- changelog 30 Apr 2003 21:09:40 -0000 1.155 *************** *** 7,12 **** equals(that@A) = this.x == that.x; } - * Compilation does not fail anymore if some classes on the classpath - have an invalid bytecode format. * In a method implementation, binding the type parameters should now be done in front: --- 7,10 ---- *************** *** 32,35 **** --- 30,38 ---- * Improved error messages for possibly null values in assignments (Daniel), and for incorrect calls to constructors (Bryn Keller). + * Integer values can used as arrays of bits, as in + if (x[index]) ... + x[index] = true; + * Compilation does not fail anymore if some classes on the classpath + have an invalid bytecode format. * Bugfix (overloaded symbols used inside && or || expressions). |
From: <bo...@us...> - 2003-04-30 21:03:27
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv12326/stdlib/nice/lang Modified Files: numeric.nice Log Message: Clarified in the doc comment that bit access can only be done on integral values (and not floating-point). Index: numeric.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/numeric.nice,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** numeric.nice 30 Apr 2003 18:55:29 -0000 1.24 --- numeric.nice 30 Apr 2003 21:03:23 -0000 1.25 *************** *** 156,160 **** Get the <code>i</code>th bit of <code>x</code>. ! <code>x</code> can have any numeric type. If <code>bit</code> is larger than the number of bits of <code>x</code>, this function returns <ocde>false</code>. --- 156,160 ---- Get the <code>i</code>th bit of <code>x</code>. ! <code>x</code> can have any integral type. If <code>bit</code> is larger than the number of bits of <code>x</code>, this function returns <ocde>false</code>. *************** *** 172,176 **** <code>x</code> must be assignable (a variable or a field). ! <code>x</code> can have any numeric type. If <code>bit</code> is larger than the number of bits of <code>x</code>, this function has no effect. --- 172,176 ---- <code>x</code> must be assignable (a variable or a field). ! <code>x</code> can have any integral type. If <code>bit</code> is larger than the number of bits of <code>x</code>, this function has no effect. |
From: <bo...@us...> - 2003-04-30 20:40:10
|
Update of /cvsroot/nice/Nice/debian In directory sc8-pr-cvs1:/tmp/cvs-serv3232/debian Modified Files: changelog Log Message: Better error messages for incorrect calls to constructors. Index: changelog =================================================================== RCS file: /cvsroot/nice/Nice/debian/changelog,v retrieving revision 1.153 retrieving revision 1.154 diff -C2 -d -r1.153 -r1.154 *** changelog 30 Apr 2003 14:06:25 -0000 1.153 --- changelog 30 Apr 2003 20:40:04 -0000 1.154 *************** *** 30,34 **** return res; } ! * Improved error messages for possibly null values in assignments. * Bugfix (overloaded symbols used inside && or || expressions). --- 30,35 ---- return res; } ! * Improved error messages for possibly null values in assignments (Daniel), ! and for incorrect calls to constructors (Bryn Keller). * Bugfix (overloaded symbols used inside && or || expressions). |
From: <bo...@us...> - 2003-04-30 20:35:10
|
Update of /cvsroot/nice/Nice/src/gnu/expr In directory sc8-pr-cvs1:/tmp/cvs-serv1473/src/gnu/expr Modified Files: ClassExp.java Log Message: Make constant fields final. Index: ClassExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/expr/ClassExp.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ClassExp.java 19 Feb 2003 14:16:13 -0000 1.11 --- ClassExp.java 30 Apr 2003 20:35:05 -0000 1.12 *************** *** 301,304 **** --- 301,306 ---- if (decl.getFlag(Declaration.VOLATILE)) flags |= Access.VOLATILE; + if (decl.getFlag(Declaration.IS_CONSTANT)) + flags |= Access.FINAL; String fname = Compilation.mangleNameIfNeeded(decl.getName()); |
From: <ar...@us...> - 2003-04-30 20:20:40
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv27243/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Allow only sideEffectFreeExpressions as default values of global variables. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.164 retrieving revision 1.165 diff -C2 -d -r1.164 -r1.165 *** Parser.jj 30 Apr 2003 19:39:05 -0000 1.164 --- Parser.jj 30 Apr 2003 20:20:33 -0000 1.165 *************** *** 1422,1426 **** { ( "var" {constant = false;} ! t=monotype() name=ident() [ "=" value=Expression() ] | "let" {constant = true;} t=monotype() name=ident() "=" value=SideEffectFreeExpression() --- 1422,1426 ---- { ( "var" {constant = false;} ! t=monotype() name=ident() [ "=" value=SideEffectFreeExpression() ] | "let" {constant = true;} t=monotype() name=ident() "=" value=SideEffectFreeExpression() |
From: <ar...@us...> - 2003-04-30 20:07:48
|
Update of /cvsroot/nice/Nice/testsuite/compiler In directory sc8-pr-cvs1:/tmp/cvs-serv10830/F:/nice/testsuite/compiler Modified Files: globalVariables.testsuite Log Message: Implemented global constants: "let" type() name() "=" sideEffectFreeExpression() ";" For some unknown reason doesn't compile gnu.expr it to final fields. Index: globalVariables.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/globalVariables.testsuite,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** globalVariables.testsuite 19 Feb 2003 14:16:11 -0000 1.7 --- globalVariables.testsuite 30 Apr 2003 19:39:07 -0000 1.8 *************** *** 75,76 **** --- 75,106 ---- var int f = 0; var String v = f; + + + /// PASS + assert(x==0); + /// TOPLEVEL + let int x = 0; + + /// FAIL + s = ""; + /// TOPLEVEL + let String s = "abc"; + + /// PASS + String t = s; + /// TOPLEVEL + let String s = "abc"; + + /// PASS + /// package a + /// TOPLEVEL + let int x = 1; + /// package b import a + assert(x == 1); + + /// FAIL + /// package a + /// TOPLEVEL + let int x = 0; + /// package b import a + x = 1; |
From: <ar...@us...> - 2003-04-30 19:44:43
|
Update of /cvsroot/nice/Nice/src/bossa/modules In directory sc8-pr-cvs1:/tmp/cvs-serv10830/F:/nice/src/bossa/modules Modified Files: Package.java Log Message: Implemented global constants: "let" type() name() "=" sideEffectFreeExpression() ";" For some unknown reason doesn't compile gnu.expr it to final fields. Index: Package.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/modules/Package.java,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** Package.java 18 Apr 2003 14:50:25 -0000 1.86 --- Package.java 30 Apr 2003 19:39:04 -0000 1.87 *************** *** 556,560 **** } ! public gnu.expr.Declaration addGlobalVar(String name, Type type) { gnu.expr.Declaration declaration = new gnu.expr.Declaration(name, type); --- 556,560 ---- } ! public gnu.expr.Declaration addGlobalVar(String name, Type type, boolean constant) { gnu.expr.Declaration declaration = new gnu.expr.Declaration(name, type); *************** *** 573,576 **** --- 573,578 ---- { getImplementationClass().addDeclaration(declaration); + if (constant) declaration.setFlag(Declaration.IS_CONSTANT); + declaration.setFlag(Declaration.STATIC_SPECIFIED|Declaration.TYPE_SPECIFIED); } |
From: <ar...@us...> - 2003-04-30 19:43:42
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv10830/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Implemented global constants: "let" type() name() "=" sideEffectFreeExpression() ";" For some unknown reason doesn't compile gnu.expr it to final fields. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.163 retrieving revision 1.164 diff -C2 -d -r1.163 -r1.164 *** Parser.jj 29 Apr 2003 21:06:47 -0000 1.163 --- Parser.jj 30 Apr 2003 19:39:05 -0000 1.164 *************** *** 1418,1429 **** Monotype t; Expression value=null; } { ! "var" ! t=monotype() ! name=ident() ! [ "=" value=Expression() ] ";" ! { return new GlobalVarDeclaration(name,t,value); } } --- 1418,1431 ---- Monotype t; Expression value=null; + boolean constant; } { ! ( "var" {constant = false;} ! t=monotype() name=ident() [ "=" value=Expression() ] ! | "let" {constant = true;} ! t=monotype() name=ident() "=" value=SideEffectFreeExpression() ! ) ";" ! { return new GlobalVarDeclaration(name,t,value,constant); } } |
From: <ar...@us...> - 2003-04-30 19:39:38
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv10830/F:/nice/src/bossa/syntax Modified Files: GlobalVarDeclaration.java Module.java Log Message: Implemented global constants: "let" type() name() "=" sideEffectFreeExpression() ";" For some unknown reason doesn't compile gnu.expr it to final fields. Index: GlobalVarDeclaration.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/GlobalVarDeclaration.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** GlobalVarDeclaration.java 24 Aug 2002 14:17:27 -0000 1.14 --- GlobalVarDeclaration.java 30 Apr 2003 19:39:03 -0000 1.15 *************** *** 30,54 **** public class GlobalVarDeclaration extends Definition { ! public GlobalVarDeclaration(LocatedString name, Monotype type, Expression value) { super(name, Node.global); ! this.left = new MonoSymbol(name,type) ! { ! Declaration getDeclaration() ! { ! Declaration res = super.getDeclaration(); ! ! if (res == null) ! { ! res = module.addGlobalVar ! (left.name.toString(), ! nice.tools.code.Types.javaType(left.type)); ! setDeclaration(res); ! } - return res; - } - }; addChild(left); --- 30,40 ---- public class GlobalVarDeclaration extends Definition { ! public GlobalVarDeclaration(LocatedString name, Monotype type, Expression value, boolean constant) { super(name, Node.global); ! this.left = new GlobalVarSymbol(name,type,constant); ! this.constant = constant; addChild(left); *************** *** 57,60 **** --- 43,78 ---- } + class GlobalVarSymbol extends MonoSymbol + { + GlobalVarSymbol(LocatedString name, Monotype type, boolean con) + { + super(name,type); + constant = con; + } + + boolean constant; + + boolean isAssignable() + { + return !constant; + } + + Declaration getDeclaration() + { + Declaration res = super.getDeclaration(); + + if (res == null) + { + res = module.addGlobalVar + (left.name.toString(), + nice.tools.code.Types.javaType(left.type), + constant); + setDeclaration(res); + } + + return res; + } + } + public Collection associatedDefinitions() { *************** *** 94,100 **** public void printInterface(java.io.PrintWriter s) { ! s.print("var "+left+ ! // (value==null ? "" : " = "+value.toString())+ ! ";\n"); } --- 112,119 ---- public void printInterface(java.io.PrintWriter s) { ! if (constant) ! s.print( "let " + left + " = " +value.toString() + ";\n"); ! else ! s.print( "var " + left + ";\n"); } *************** *** 106,109 **** --- 125,129 ---- { gnu.expr.Declaration declaration = left.getDeclaration(); + if (constant) declaration.setFlag(Declaration.IS_CONSTANT); if (value == null) *************** *** 125,127 **** --- 145,148 ---- // "name" after scoping MonoSymbol left; + boolean constant; } Index: Module.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Module.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Module.java 18 Apr 2003 14:50:23 -0000 1.13 --- Module.java 30 Apr 2003 19:39:04 -0000 1.14 *************** *** 30,34 **** gnu.bytecode.ClassType createClass(String name); ! gnu.expr.Declaration addGlobalVar(String name, gnu.bytecode.Type type); gnu.expr.Expression getDispatchMethod(NiceMethod def); gnu.expr.Expression lookupPackageMethod(String methodName, String type); --- 30,34 ---- gnu.bytecode.ClassType createClass(String name); ! gnu.expr.Declaration addGlobalVar(String name, gnu.bytecode.Type type, boolean constant); gnu.expr.Expression getDispatchMethod(NiceMethod def); gnu.expr.Expression lookupPackageMethod(String methodName, String type); |
From: <bo...@us...> - 2003-04-30 19:05:48
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang/inline In directory sc8-pr-cvs1:/tmp/cvs-serv28728/stdlib/nice/lang/inline Modified Files: BitOp.java Log Message: Handle the case where the target of a get is not boolean. Index: BitOp.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/BitOp.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BitOp.java 30 Apr 2003 18:55:28 -0000 1.1 --- BitOp.java 30 Apr 2003 19:05:41 -0000 1.2 *************** *** 86,89 **** --- 86,91 ---- code.emitFi(); } + + target.compileFromStack(comp, Type.boolean_type); } |
From: <bo...@us...> - 2003-04-30 19:05:47
|
Update of /cvsroot/nice/Nice/testsuite/lib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv28728/testsuite/lib/nice/lang Modified Files: numeric.testsuite Log Message: Handle the case where the target of a get is not boolean. Index: numeric.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/lib/nice/lang/numeric.testsuite,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** numeric.testsuite 30 Apr 2003 18:55:27 -0000 1.1 --- numeric.testsuite 30 Apr 2003 19:05:40 -0000 1.2 *************** *** 29,33 **** assert lvalue[i] == (lbits[i] == 1); ! /// PASS bug byte b = byte(-1); assert b[8] == false; --- 29,33 ---- assert lvalue[i] == (lbits[i] == 1); ! /// PASS byte b = byte(-1); assert b[8] == false; *************** *** 78,79 **** --- 78,83 ---- let int i = 1; i[0] = false; + + /// COMMENT Using the result polymorphically + /// PASS + String s = 20[1].toString(); |
From: <bo...@us...> - 2003-04-30 18:56:04
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv24458/stdlib/nice/lang Modified Files: numeric.nice Log Message: Implemented handling of numeric values as arrays of bits: read access for all values, and write access for numeric variables and fields. The implementation uses the new bossa.syntax.Macro interface, which allows inlined methods to do semantic checks on their arguments. Index: numeric.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/numeric.nice,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** numeric.nice 18 Apr 2003 15:14:48 -0000 1.23 --- numeric.nice 30 Apr 2003 18:55:29 -0000 1.24 *************** *** 26,35 **** // Narrowing primitive conversions ! double double(double d) = inline nice.lang.inline.Nop(); ! float float(double d) = inline nice.lang.inline.Nop(); ! int int(double d) = inline nice.lang.inline.Nop(); ! short short(double d) = inline nice.lang.inline.Nop(); ! byte byte(double d) = inline nice.lang.inline.Nop(); ! char char(double d) = inline nice.lang.inline.Nop(); --- 26,36 ---- // Narrowing primitive conversions ! double double(double) = inline nice.lang.inline.Nop(); ! long long (double) = inline nice.lang.inline.Nop(); ! float float (double) = inline nice.lang.inline.Nop(); ! int int (double) = inline nice.lang.inline.Nop(); ! short short (double) = inline nice.lang.inline.Nop(); ! byte byte (double) = inline nice.lang.inline.Nop(); ! char char (double) = inline nice.lang.inline.Nop(); *************** *** 152,166 **** ****************************************************************/ ! // Note: we should have testcases for this section. ! // Upcasts ! long long(int) = inline nice.lang.inline.Nop(); ! // Accessing individual bits of a word ! boolean get(long x, int bit) = (x & (long(1) << bit)) != 0; ! boolean get(int x, int bit) = (x & (1 << bit)) != 0; ! /** Returns a random positive number smaller than limit. */ int random(int limit) = int(floor(random() * limit)); --- 153,185 ---- ****************************************************************/ ! /** ! Get the <code>i</code>th bit of <code>x</code>. ! <code>x</code> can have any numeric type. ! If <code>bit</code> is larger than the number of bits of ! <code>x</code>, this function returns <ocde>false</code>. + You can use this function with the array syntax: + <code>x[bit]</code> + */ + boolean get(long x, int bit) = inline nice.lang.inline.BitOp("get"); ! /** ! Set the <code>i</code>th bit of <code>x</code> ! on if <code>v</code> is <code>true</code>; ! off if <code>v</code> is <code>false</code>. ! <code>x</code> must be assignable (a variable or a field). ! ! <code>x</code> can have any numeric type. ! If <code>bit</code> is larger than the number of bits of ! <code>x</code>, this function has no effect. ! ! You can use this function with the array syntax: ! <code>x[bit] = v</code> ! */ ! void set(long x, int bit, boolean v) = inline nice.lang.inline.BitOp("set"); ! ! /** Returns a random number such that 0 <= random(limit) < limit. */ int random(int limit) = int(floor(random() * limit)); |
From: <bo...@us...> - 2003-04-30 18:55:38
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv24458/src/bossa/syntax Modified Files: VarSymbol.java TupleExp.java SymbolExp.java OverloadedSymbolExp.java MethodDeclaration.java InlinedMethod.java FormalParameters.java Expression.java CallExp.java Added Files: Macro.java Log Message: Implemented handling of numeric values as arrays of bits: read access for all values, and write access for numeric variables and fields. The implementation uses the new bossa.syntax.Macro interface, which allows inlined methods to do semantic checks on their arguments. --- NEW FILE: Macro.java --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2003 */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /**************************************************************************/ package bossa.syntax; /** A macro. This interface should be implemented by classes that are used to implement inlined methods, and that need to do some semantic checking on their actual arguments. @version $Date: 2003/04/30 18:55:31 $ @author Daniel Bonniot (bo...@us...) */ public interface Macro extends gnu.expr.Inlineable { /** For each call site, this method is called with the actual arguments of the macro. This can be used to check special requirements on the arguments that could not be expressed in the type of the macro. For instance, it might be necessary to check that a certain argument is assignable if it is modified by the macro. */ void checkSpecialRequirements(Expression[] arguments); } Index: VarSymbol.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/VarSymbol.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** VarSymbol.java 2 Sep 2002 11:46:51 -0000 1.27 --- VarSymbol.java 30 Apr 2003 18:55:29 -0000 1.28 *************** *** 54,57 **** --- 54,62 ---- } + void checkSpecialRequirements(Expression[] arguments) + { + // Do nothing by default. + } + abstract Polytype getType(); Index: TupleExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/TupleExp.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** TupleExp.java 17 Mar 2003 20:11:43 -0000 1.16 --- TupleExp.java 30 Apr 2003 18:55:30 -0000 1.17 *************** *** 47,51 **** ****************************************************************/ ! boolean isAssignable() { for (int i = 0; i < expressions.length; i++) --- 47,51 ---- ****************************************************************/ ! public boolean isAssignable() { for (int i = 0; i < expressions.length; i++) Index: SymbolExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/SymbolExp.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** SymbolExp.java 12 Mar 2003 03:32:01 -0000 1.31 --- SymbolExp.java 30 Apr 2003 18:55:30 -0000 1.32 *************** *** 31,35 **** } ! boolean isAssignable() { return symbol.isAssignable(); --- 31,35 ---- } ! public boolean isAssignable() { return symbol.isAssignable(); *************** *** 39,42 **** --- 39,47 ---- { return symbol.getFieldAccessMethod(); + } + + void checkSpecialRequirements(Expression[] arguments) + { + symbol.checkSpecialRequirements(arguments); } Index: OverloadedSymbolExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/OverloadedSymbolExp.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** OverloadedSymbolExp.java 24 Apr 2003 12:21:26 -0000 1.51 --- OverloadedSymbolExp.java 30 Apr 2003 18:55:30 -0000 1.52 *************** *** 65,69 **** } ! boolean isAssignable() { Internal.error("Overloading resolution should be done before this."); --- 65,69 ---- } ! public boolean isAssignable() { Internal.error("Overloading resolution should be done before this."); Index: MethodDeclaration.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/MethodDeclaration.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** MethodDeclaration.java 18 Apr 2003 14:50:23 -0000 1.38 --- MethodDeclaration.java 30 Apr 2003 18:55:31 -0000 1.39 *************** *** 221,224 **** --- 221,229 ---- public boolean isFieldAccess() { return false; } + void checkSpecialRequirements(Expression[] arguments) + { + // Do nothing by default. + } + /** @return true if this method is the 'main' of the program *************** *** 260,263 **** --- 265,273 ---- else return null; + } + + void checkSpecialRequirements(Expression[] arguments) + { + getDefinition().checkSpecialRequirements(arguments); } Index: InlinedMethod.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/InlinedMethod.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** InlinedMethod.java 22 Nov 2001 15:08:50 -0000 1.10 --- InlinedMethod.java 30 Apr 2003 18:55:31 -0000 1.11 *************** *** 103,107 **** " cannot be inlined, but will be called anyway"); ! return new gnu.expr.QuoteExp((gnu.mapping.Procedure) o); } --- 103,108 ---- " cannot be inlined, but will be called anyway"); ! this.procedure = (gnu.mapping.Procedure) o; ! return new gnu.expr.QuoteExp(procedure); } *************** *** 109,112 **** --- 110,121 ---- private LocatedString inlineProcedure; private String parameter; + private gnu.mapping.Procedure procedure; + + void checkSpecialRequirements(Expression[] arguments) + { + getCode(); + if (procedure instanceof bossa.syntax.Macro) + ((Macro) procedure).checkSpecialRequirements(arguments); + } public void printInterface(java.io.PrintWriter s) Index: FormalParameters.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/FormalParameters.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** FormalParameters.java 30 Apr 2003 17:26:49 -0000 1.22 --- FormalParameters.java 30 Apr 2003 18:55:31 -0000 1.23 *************** *** 124,128 **** } ! boolean isAssignable () { return false; } public gnu.expr.Expression compile () --- 124,128 ---- } ! public boolean isAssignable () { return false; } public gnu.expr.Expression compile () Index: Expression.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Expression.java,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** Expression.java 30 Apr 2003 17:45:17 -0000 1.45 --- Expression.java 30 Apr 2003 18:55:31 -0000 1.46 *************** *** 41,45 **** /** @return true iff this expression can be assigned a value. */ ! boolean isAssignable() { return false; --- 41,45 ---- /** @return true iff this expression can be assigned a value. */ ! public boolean isAssignable() { return false; *************** *** 186,189 **** --- 186,194 ---- return res; + } + + void checkSpecialRequirements(Expression[] arguments) + { + // Do nothing by default. } Index: CallExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/CallExp.java,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** CallExp.java 30 Apr 2003 17:20:43 -0000 1.75 --- CallExp.java 30 Apr 2003 18:55:32 -0000 1.76 *************** *** 244,247 **** --- 244,249 ---- function = function.resolveOverloading(this); + + function.checkSpecialRequirements(arguments.computedExpressions); } *************** *** 287,291 **** private Polytype instanciatedDomain; ! boolean isAssignable() { resolveOverloading(); --- 289,293 ---- private Polytype instanciatedDomain; ! public boolean isAssignable() { resolveOverloading(); |
From: <bo...@us...> - 2003-04-30 18:55:32
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang/inline In directory sc8-pr-cvs1:/tmp/cvs-serv24458/stdlib/nice/lang/inline Added Files: BitOp.java Log Message: Implemented handling of numeric values as arrays of bits: read access for all values, and write access for numeric variables and fields. The implementation uses the new bossa.syntax.Macro interface, which allows inlined methods to do semantic checks on their arguments. --- NEW FILE: BitOp.java --- /**************************************************************************/ /* N I C E */ /* A high-level object-oriented research language */ /* (c) Daniel Bonniot 2003 */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License, or */ /* (at your option) any later version. */ /* */ /**************************************************************************/ package nice.lang.inline; /** Bit manipulation for numeric values. @version $Date: 2003/04/30 18:55:28 $ @author Daniel Bonniot (bo...@us...) */ import gnu.mapping.Procedure; import gnu.mapping.Procedure2; import gnu.mapping.Procedure3; import gnu.expr.*; import gnu.bytecode.*; public class BitOp { public static Procedure create(String param) { if (param.equals("get")) return get; else return set; } private static BitOp.Set set = new BitOp.Set(); private static BitOp.Get get = new BitOp.Get(); // Getting a bit private static class Get extends Procedure2 implements Inlineable { public void compile (ApplyExp exp, Compilation comp, Target target) { Expression[] args = exp.getArgs(); CodeAttr code = comp.getCode(); Type type0 = args[0].getType(); boolean isLong = type0 == Type.long_type; Target t0 = Target.pushValue(type0); args[0].compile(comp, t0); if (isLong) code.emitPushLong(1); else code.emitPushInt(1); Target t1 = Target.pushValue(Type.int_type); args[1].compile(comp, t1); code.emitShl(); // This is needed for types shorter than int. if (!isLong) t0.compileFromStack(comp, Type.int_type); code.emitAnd(); if (isLong) { code.emitPushLong(0); code.emitIfEq(); code.emitPushBoolean(false); code.emitElse(); code.emitPushBoolean(true); code.emitFi(); } else { code.emitIfIntNotZero(); code.emitPushBoolean(true); code.emitElse(); code.emitPushBoolean(false); code.emitFi(); } } public Type getReturnType (Expression[] args) { return Type.boolean_type; } // Interpretation public Object apply2 (Object arg1, Object arg2) { throw new Error("Not implemented"); } } // Setting a bit private static class Set extends Procedure3 implements bossa.syntax.Macro { public void compile (ApplyExp exp, Compilation comp, Target target) { Expression[] args = exp.getArgs(); CodeAttr code = comp.getCode(); Type type0 = args[0].getType(); boolean isLong = type0 == Type.long_type; Target t0 = Target.pushValue(type0); args[0].compile(comp, t0); if (isLong) code.emitPushLong(1); else code.emitPushInt(1); Target t1 = Target.pushValue(Type.int_type); args[1].compile(comp, t1); code.emitShl(); args[2].compile(comp, Target.pushValue(Type.boolean_type)); code.emitIfIntNotZero(); code.emitIOr(); code.emitElse(); if (isLong) code.emitPushLong(-1); else code.emitPushInt(-1); code.emitXOr(); code.emitAnd(); code.emitFi(); t0.compileFromStack(comp, isLong ? Type.long_type : Type.int_type); ((ReferenceExp) args[0]).getBinding().compileStore(comp); } public Type getReturnType (Expression[] args) { return Type.void_type; } public void checkSpecialRequirements(bossa.syntax.Expression[] arguments) { if (! arguments[0].isAssignable()) bossa.util.User.error(arguments[0], "This value cannot be modified."); } // Interpretation public Object apply3 (Object arg1, Object arg2, Object arg3) { throw new Error("Not implemented"); } } } |
From: <bo...@us...> - 2003-04-30 18:55:30
|
Update of /cvsroot/nice/Nice/testsuite/lib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv24458/testsuite/lib/nice/lang Added Files: numeric.testsuite Log Message: Implemented handling of numeric values as arrays of bits: read access for all values, and write access for numeric variables and fields. The implementation uses the new bossa.syntax.Macro interface, which allows inlined methods to do semantic checks on their arguments. --- NEW FILE: numeric.testsuite --- /// PASS assert 0 <= random(3) < 3; /// PASS long i = 0; assert ! (i[0] || i[1] || i[63]); i = 2; assert ! i[0] && i[1] && ! i[2]; /// COMMENT Reading bits. /// PASS int[] ibits = [ 1,0,0,1,0,1,1,0,0,1,0,1,1,1,1,0,0,0,1,0,0,0,1,1,1,0,1,1,0,0,1,1 ]; int ivalue = -842761623; for (int i = 0; i < ibits.length; i++) assert ivalue[i] == (ibits[i] == 1); /// PASS long[] lbits = [ 0,0,0,1,0,1,1,0,0,1,0,1,1,1,1,0,0,0,1,0,0,0,1,1,1,0,1,1,0,0,1,1, 0,0,1,0,0,1,1,1,0,1,0,0,1,1,0,1,1,1,0,1,0,1,1,1,0,1,1,0,1,1,0,0 ]; long lvalue = 3957453393349605992; for (int i = 0; i < lbits.length; i++) assert lvalue[i] == (lbits[i] == 1); /// PASS bug byte b = byte(-1); assert b[8] == false; /// COMMENT Writing bits. /// PASS int[] ibits = [ 1,0,0,1,0,1,1,0,0,1,0,1,1,1,1,0,0,0,1,0,0,0,1,1,1,0,1,1,0,0,1,1 ]; int ivalue = 0; for (int i = 0; i < ibits.length; i++) ivalue[i] = (ibits[i] == 1); assert ivalue == -842761623; /// PASS long[] lbits = [ 0,0,0,1,0,1,1,0,0,1,0,1,1,1,1,0,0,0,1,0,0,0,1,1,1,0,1,1,0,0,1,1, 0,0,1,0,0,1,1,1,0,1,0,0,1,1,0,1,1,1,0,1,0,1,1,1,0,1,1,0,1,1,0,0 ]; long lvalue = 0; for (int i = 0; i < lbits.length; i++) lvalue[i] = lbits[i] == 1; assert lvalue == 3957453393349605992; /// PASS byte b = 0; b[8] = true; assert b == 0; /// PASS long i = 0; i[0] = true; assert i == 1; i[2] = true; assert i == 5; i[0] = false; assert i == 4; /// FAIL 1[0] = false; /// FAIL let int i = 1; i[0] = false; |
From: <ar...@us...> - 2003-04-30 17:56:35
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv3306/F:/nice/src/bossa/syntax Modified Files: typecheck.nice Log Message: Make compiling the compiler work again. Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** typecheck.nice 30 Apr 2003 17:40:46 -0000 1.63 --- typecheck.nice 30 Apr 2003 17:56:30 -0000 1.64 *************** *** 62,67 **** } ! CallExp callto = cast(to); ! ?FieldAccess field = callto.getField(); String toName; if (field == null) --- 62,66 ---- } ! ?FieldAccess field = to.getField(); String toName; if (field == null) |
From: <bo...@us...> - 2003-04-30 17:45:24
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv31674 Modified Files: Expression.java Log Message: Improved error messages for possibly null values in assignments. Index: Expression.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Expression.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** Expression.java 18 Feb 2003 17:57:56 -0000 1.44 --- Expression.java 30 Apr 2003 17:45:17 -0000 1.45 *************** *** 56,62 **** /** ! * @return the FieldAccessMethod behind this expression, or null */ FieldAccess getFieldAccessMethod() { return null; --- 56,72 ---- /** ! * @return the FieldAccess behind this expression, or null */ FieldAccess getFieldAccessMethod() + { + return null; + } + + /** + @return the FieldAccess if this expression resolves to a field, + which is true if it is the application a of FieldAccess to an object + value. Returns null otherwise. + */ + FieldAccess getField() { return null; |