MESSAGE
DATE | 2016-04-26 |
FROM | Christopher League
|
SUBJECT | Re: [Hangout-NYLXS] heart burn
|
From hangout-bounces-at-nylxs.com Wed Apr 27 00:07:50 2016 Return-Path: X-Original-To: archive-at-mrbrklyn.com Delivered-To: archive-at-mrbrklyn.com Received: from www.mrbrklyn.com (www.mrbrklyn.com [96.57.23.82]) by mrbrklyn.com (Postfix) with ESMTP id 434D7163D48; Wed, 27 Apr 2016 00:07:50 -0400 (EDT) X-Original-To: hangout-at-nylxs.com Delivered-To: hangout-at-nylxs.com Received: by mrbrklyn.com (Postfix, from userid 1000) id 53C2F162A0A; Wed, 27 Apr 2016 00:06:55 -0400 (EDT) Resent-From: Ruben Safir Resent-Date: Wed, 27 Apr 2016 00:06:55 -0400 Resent-Message-ID: <20160427040655.GC1115-at-www.mrbrklyn.com> Resent-To: hangout-at-nylxs.com X-Original-To: ruben-at-mrbrklyn.com Delivered-To: ruben-at-mrbrklyn.com Received: from B-EXH-EDGE1.liunet.edu (b-edge1.smtp.liu.edu [148.4.248.206]) by mrbrklyn.com (Postfix) with ESMTP id 3FBE9161224 for ; Tue, 26 Apr 2016 09:59:20 -0400 (EDT) Received: from B-EXH-3.liunet.edu (148.4.250.212) by B-EXH-EDGE1.liunet.edu (148.4.248.206) with Microsoft SMTP Server (TLS) id 14.3.210.2; Tue, 26 Apr 2016 09:59:14 -0400 Received: from localhost (96.250.202.133) by B-EXH-3.liunet.edu (148.4.250.212) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Tue, 26 Apr 2016 09:59:19 -0400 From: Christopher League To: Ruben Safir In-Reply-To: <571EFDE3.3090603-at-mrbrklyn.com> References: <571EFDE3.3090603-at-mrbrklyn.com> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-unknown-linux-gnu) Date: Tue, 26 Apr 2016 09:59:17 -0400 Message-ID: <878u00qxmy.fsf-at-lydrik.home.lan> MIME-Version: 1.0 X-Originating-IP: [96.250.202.133] X-ClientProxiedBy: U-EXH-CAS.liunet.edu (148.4.184.26) To B-EXH-3.liunet.edu (148.4.250.212) X-Content-Filtered-By: Mailman/MimeDel 2.1.17 Subject: Re: [Hangout-NYLXS] heart burn X-BeenThere: hangout-at-nylxs.com X-Mailman-Version: 2.1.17 Precedence: list Reply-To: NYLXS Discussions List List-Id: NYLXS Discussions List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============1496153992==" Errors-To: hangout-bounces-at-nylxs.com Sender: "hangout"
--===============1496153992== Content-Type: multipart/signed; boundary="===-=-="; micalg=pgp-sha256; protocol="application/pgp-signature"
--===-=-= Content-Type: multipart/alternative; boundary="==-=-="
--==-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable
I feel like the comment summarizes what TestTypeChecker is meant to do:
// All the files in `test/bad/` should parse correctly, but contain typ= e errors. // All the files in `tests/good/` should parse correctly, with no type = errors.
Each test file should print out whatever your TypeChecker prints out, in terms of tracing or error messages, but otherwise it just relies on the counter to be accurate:
chk.parseErrors
counts the number of errors reported by the lexer or parser. It gets incremented by the `syntaxError` method in `TypeChecker`, which would get called by ANTLR each time it reports an error because we do
parser.addErrorListener(this);
The other counter, over which you have more control, is:
chk.visitor.errors
So that is defined in `TypeCheckingVisitor`. So you should increment it whenever you report a type error. In the given code, that is done in the `error()` method, which is called by `typeMismatch()`, `checkNumArgs()` and perhaps a few other places.
There isn't really an expected output vs an actual output of the type checker, it only comes down to what those two counters say:
- All the files in `test/bad/` should parse correctly (`chk.parseErrors=3D=3D0`) but contain type errors (`chk.visitor.errors= >0`).
- All the files in `tests/good/` should parse correctly (`chk.parseErrors=3D=3D0`), with no type errors (`chk.visitor.errors=3D=3D0`).
Your `gradle run` should output lines like these, right?
**** PASS **** good/105-var-reassign.txt **** syntax=3D0, type=3D0 **** FAIL **** good/106-var-reassign-coerce.txt **** syntax=3D0, type= =3D1 **** PASS **** good/110-if-lt.txt **** syntax=3D0, type=3D0
Anything *in between* those lines is the output of your type checker itself, whether error messages about type mismatches, or debugging output, for which I used the `trace()` method.
CL
Ruben Safir writes:
> import org.antlr.v4.runtime.ANTLRFileStream; > > > Please Tell me what you expect this to do. What I need to know is what > you expected to happen and what happened so I can fix it. > > > > > import java.io.File; > import java.io.IOException; > import java.util.Arrays; > > // All the files in `test/bad/` should parse correctly, but contain type > errors. > // All the files in `tests/good/` should parse correctly, with no type > errors. > public class TestTypeChecker { > > static int numTests =3D 0; > static int numPass =3D 0; > > public static void main(String[] args) throws IOException { > testInDir("tests/bad", false); > testInDir("tests/good", true); > System.err.printf("\nPassed %d/%d tests.\n\n", numPass, numTests); > } > > private static void testInDir(String dir, boolean good) throws > IOException { > String[] fileList =3D new File(dir).list(); > Arrays.sort(fileList); > for(String name : fileList) { > TypeChecker chk =3D new TypeChecker(new ANTLRFileStream( > dir + File.separator + name)); > boolean pass; > if(good) { > pass =3D chk.parseErrors =3D=3D 0 && chk.visitor.errors = =3D=3D 0; > } > else { > pass =3D chk.parseErrors =3D=3D 0 && chk.visitor.errors >= 0; > } > System.err.printf("**** %s **** %s/%s **** syntax=3D%d, > type=3D%d\n\n", > pass? "PASS" : "FAIL", > good? "good" : "bad", > name, > chk.parseErrors, > chk.visitor.errors > ); > numTests++; > if(pass) numPass++; > } > } > > > } > --=20 > So many immigrant groups have swept through our town > that Brooklyn, like Atlantis, reaches mythological > proportions in the mind of the world - RI Safir 1998 > http://www.mrbrklyn.com > > DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 > http://www.nylxs.com - Leadership Development in Free Software > http://www2.mrbrklyn.com/resources - Unpublished Archive > http://www.coinhangout.com - coins! > http://www.brooklyn-living.com > > Being so tracked is for FARM ANIMALS and and extermination camps, > but incompatible with living as a free human being. -RI Safir 2013
--==-=-= MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"
I feel like the comment summarizes what TestTypeChecker is meant to do: // All the files in `test/bad/` should parse correctly, but contain type errors. // All the files in `tests/good/` should parse correctly, with no type errors.
Each test file should print out whatever your TypeChecker prints out, in terms of tracing or error messages, but otherwise it just relies on the counter to be accurate: chk.parseErrors
counts the number of errors reported by the lexer or parser. It gets incremented by the syntaxError method in TypeChecker, which would get called by ANTLR each time it reports an error because we do parser.addErrorListener(this);
The other counter, over which you have more control, is: chk.visitor.errors
So that is defined in TypeCheckingVisitor. So you should increment it whenever you report a type error. In the given code, that is done in the error() method, which is called by typeMismatch(), checkNumArgs() and perhaps a few other places.
There isn't really an expected output vs an actual output of the type checker, it only comes down to what those two counters say: * All the files in test/bad/ should parse correctly (chk.parseErrors==0) but contain type errors (chk.visitor.errors>0). * All the files in tests/good/ should parse correctly (chk.parseErrors==0), with no type errors (chk.visitor.errors==0).
Your gradle run should output lines like these, right? **** PASS **** good/105-var-reassign.txt **** syntax=0, type=0 **** FAIL **** good/106-var-reassign-coerce.txt **** syntax=0, type=1 **** PASS **** good/110-if-lt.txt **** syntax=0, type=0
Anything in between those lines is the output of your type checker itself, whether error messages about type mismatches, or debugging output, for which I used the trace() method.
CL
Ruben Safir [1]ruben-at-mrbrklyn.com writes:
import org.antlr.v4.runtime.ANTLRFileStream;
Please Tell me what you expect this to do. What I need to know is what you expected to happen and what happened so I can fix it.
import java.io.File; import java.io.IOException; import java.util.Arrays;
// All the files in test/bad/ should parse correctly, but contain type errors. // All the files in tests/good/ should parse correctly, with no type errors. public class TestTypeChecker { static int numTests = 0; static int numPass = 0;
public static void main(String[] args) throws IOException { testInDir("tests/bad", false); testInDir("tests/good", true); System.err.printf("\nPassed %d/%d tests.\n\n", numPass, numTests); }
private static void testInDir(String dir, boolean good) throws
IOException { String[] fileList = new File(dir).list(); Arrays.sort(fileList); for(String name : fileList) { TypeChecker chk = new TypeChecker(new ANTLRFileStream( dir + File.separator + name)); boolean pass; if(good) { pass = chk.parseErrors == 0 && chk.visitor.errors == 0; } else { pass = chk.parseErrors == 0 && chk.visitor.errors > 0; } System.err.printf("**** %s **** %s/%s **** syntax=%d, type=%d", pass? "PASS" : "FAIL", good? "good" : "bad", name, chk.parseErrors, chk.visitor.errors ); numTests++; if(pass) numPass++; } }
}
So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world - RI Safir 1998 http://www.mrbrklyn.com
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 http://www.nylxs.com - Leadership Development in Free Software http://www2.mrbrklyn.com/resources - Unpublished Archive http://www.coinhangout.com - coins! http://www.brooklyn-living.com
Being so tracked is for FARM ANIMALS and and extermination camps, but incompatible with living as a free human being. -RI Safir 2013
References
1. mailto:ruben-at-mrbrklyn.com
--==-=-=--
--===-=-= Content-Type: application/pgp-signature; name="signature.asc"
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2
iQEcBAEBCAAGBQJXH3Q1AAoJEGuLsz1PMbCLHmsH/i825nnQxL/d5o6hEKtqEPRv dc6IrjU3sVSk1nyc95YBsTkc1jnXuJkfbOGCE/dcdUHtG396LHGh6mxFFPU60eGu xQhjp96bpkDHLvKyCuSpHyyaTBH1+SFZdx6/j+SVLeFudRmNLBl+J7PW7a4QSOzf 2Joqecx7wbNG5tZ2uyQAGbWK+TFfo1R2g1afb49DqptCBIZPBtNUufkrDCwyWsTu Jd7mPc503QGp56ds972MvBI5QYCBY5ydTO/tXgvCZqJ/laz0cy8i1U5eHqzZ81J7 utxMnHmziIAuj2Oy0LlNZfXLqED2d/xbSRwQVNJ+a7F07IH8U7RFlxRZ1Yteurw= =50dc -----END PGP SIGNATURE----- --===-=-=--
--===============1496153992== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline
_______________________________________________ hangout mailing list hangout-at-nylxs.com http://www.nylxs.com/ --===============1496153992==--
--===============1496153992== Content-Type: multipart/signed; boundary="===-=-="; micalg=pgp-sha256; protocol="application/pgp-signature"
--===-=-= Content-Type: multipart/alternative; boundary="==-=-="
--==-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable
I feel like the comment summarizes what TestTypeChecker is meant to do:
// All the files in `test/bad/` should parse correctly, but contain typ= e errors. // All the files in `tests/good/` should parse correctly, with no type = errors.
Each test file should print out whatever your TypeChecker prints out, in terms of tracing or error messages, but otherwise it just relies on the counter to be accurate:
chk.parseErrors
counts the number of errors reported by the lexer or parser. It gets incremented by the `syntaxError` method in `TypeChecker`, which would get called by ANTLR each time it reports an error because we do
parser.addErrorListener(this);
The other counter, over which you have more control, is:
chk.visitor.errors
So that is defined in `TypeCheckingVisitor`. So you should increment it whenever you report a type error. In the given code, that is done in the `error()` method, which is called by `typeMismatch()`, `checkNumArgs()` and perhaps a few other places.
There isn't really an expected output vs an actual output of the type checker, it only comes down to what those two counters say:
- All the files in `test/bad/` should parse correctly (`chk.parseErrors=3D=3D0`) but contain type errors (`chk.visitor.errors= >0`).
- All the files in `tests/good/` should parse correctly (`chk.parseErrors=3D=3D0`), with no type errors (`chk.visitor.errors=3D=3D0`).
Your `gradle run` should output lines like these, right?
**** PASS **** good/105-var-reassign.txt **** syntax=3D0, type=3D0 **** FAIL **** good/106-var-reassign-coerce.txt **** syntax=3D0, type= =3D1 **** PASS **** good/110-if-lt.txt **** syntax=3D0, type=3D0
Anything *in between* those lines is the output of your type checker itself, whether error messages about type mismatches, or debugging output, for which I used the `trace()` method.
CL
Ruben Safir writes:
> import org.antlr.v4.runtime.ANTLRFileStream; > > > Please Tell me what you expect this to do. What I need to know is what > you expected to happen and what happened so I can fix it. > > > > > import java.io.File; > import java.io.IOException; > import java.util.Arrays; > > // All the files in `test/bad/` should parse correctly, but contain type > errors. > // All the files in `tests/good/` should parse correctly, with no type > errors. > public class TestTypeChecker { > > static int numTests =3D 0; > static int numPass =3D 0; > > public static void main(String[] args) throws IOException { > testInDir("tests/bad", false); > testInDir("tests/good", true); > System.err.printf("\nPassed %d/%d tests.\n\n", numPass, numTests); > } > > private static void testInDir(String dir, boolean good) throws > IOException { > String[] fileList =3D new File(dir).list(); > Arrays.sort(fileList); > for(String name : fileList) { > TypeChecker chk =3D new TypeChecker(new ANTLRFileStream( > dir + File.separator + name)); > boolean pass; > if(good) { > pass =3D chk.parseErrors =3D=3D 0 && chk.visitor.errors = =3D=3D 0; > } > else { > pass =3D chk.parseErrors =3D=3D 0 && chk.visitor.errors >= 0; > } > System.err.printf("**** %s **** %s/%s **** syntax=3D%d, > type=3D%d\n\n", > pass? "PASS" : "FAIL", > good? "good" : "bad", > name, > chk.parseErrors, > chk.visitor.errors > ); > numTests++; > if(pass) numPass++; > } > } > > > } > --=20 > So many immigrant groups have swept through our town > that Brooklyn, like Atlantis, reaches mythological > proportions in the mind of the world - RI Safir 1998 > http://www.mrbrklyn.com > > DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 > http://www.nylxs.com - Leadership Development in Free Software > http://www2.mrbrklyn.com/resources - Unpublished Archive > http://www.coinhangout.com - coins! > http://www.brooklyn-living.com > > Being so tracked is for FARM ANIMALS and and extermination camps, > but incompatible with living as a free human being. -RI Safir 2013
--==-=-= MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"
I feel like the comment summarizes what TestTypeChecker is meant to do: // All the files in `test/bad/` should parse correctly, but contain type errors. // All the files in `tests/good/` should parse correctly, with no type errors.
Each test file should print out whatever your TypeChecker prints out, in terms of tracing or error messages, but otherwise it just relies on the counter to be accurate: chk.parseErrors
counts the number of errors reported by the lexer or parser. It gets incremented by the syntaxError method in TypeChecker, which would get called by ANTLR each time it reports an error because we do parser.addErrorListener(this);
The other counter, over which you have more control, is: chk.visitor.errors
So that is defined in TypeCheckingVisitor. So you should increment it whenever you report a type error. In the given code, that is done in the error() method, which is called by typeMismatch(), checkNumArgs() and perhaps a few other places.
There isn't really an expected output vs an actual output of the type checker, it only comes down to what those two counters say: * All the files in test/bad/ should parse correctly (chk.parseErrors==0) but contain type errors (chk.visitor.errors>0). * All the files in tests/good/ should parse correctly (chk.parseErrors==0), with no type errors (chk.visitor.errors==0).
Your gradle run should output lines like these, right? **** PASS **** good/105-var-reassign.txt **** syntax=0, type=0 **** FAIL **** good/106-var-reassign-coerce.txt **** syntax=0, type=1 **** PASS **** good/110-if-lt.txt **** syntax=0, type=0
Anything in between those lines is the output of your type checker itself, whether error messages about type mismatches, or debugging output, for which I used the trace() method.
CL
Ruben Safir [1]ruben-at-mrbrklyn.com writes:
import org.antlr.v4.runtime.ANTLRFileStream;
Please Tell me what you expect this to do. What I need to know is what you expected to happen and what happened so I can fix it.
import java.io.File; import java.io.IOException; import java.util.Arrays;
// All the files in test/bad/ should parse correctly, but contain type errors. // All the files in tests/good/ should parse correctly, with no type errors. public class TestTypeChecker { static int numTests = 0; static int numPass = 0;
public static void main(String[] args) throws IOException { testInDir("tests/bad", false); testInDir("tests/good", true); System.err.printf("\nPassed %d/%d tests.\n\n", numPass, numTests); }
private static void testInDir(String dir, boolean good) throws
IOException { String[] fileList = new File(dir).list(); Arrays.sort(fileList); for(String name : fileList) { TypeChecker chk = new TypeChecker(new ANTLRFileStream( dir + File.separator + name)); boolean pass; if(good) { pass = chk.parseErrors == 0 && chk.visitor.errors == 0; } else { pass = chk.parseErrors == 0 && chk.visitor.errors > 0; } System.err.printf("**** %s **** %s/%s **** syntax=%d, type=%d", pass? "PASS" : "FAIL", good? "good" : "bad", name, chk.parseErrors, chk.visitor.errors ); numTests++; if(pass) numPass++; } }
}
So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world - RI Safir 1998 http://www.mrbrklyn.com
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 http://www.nylxs.com - Leadership Development in Free Software http://www2.mrbrklyn.com/resources - Unpublished Archive http://www.coinhangout.com - coins! http://www.brooklyn-living.com
Being so tracked is for FARM ANIMALS and and extermination camps, but incompatible with living as a free human being. -RI Safir 2013
References
1. mailto:ruben-at-mrbrklyn.com
--==-=-=--
--===-=-= Content-Type: application/pgp-signature; name="signature.asc"
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2
iQEcBAEBCAAGBQJXH3Q1AAoJEGuLsz1PMbCLHmsH/i825nnQxL/d5o6hEKtqEPRv dc6IrjU3sVSk1nyc95YBsTkc1jnXuJkfbOGCE/dcdUHtG396LHGh6mxFFPU60eGu xQhjp96bpkDHLvKyCuSpHyyaTBH1+SFZdx6/j+SVLeFudRmNLBl+J7PW7a4QSOzf 2Joqecx7wbNG5tZ2uyQAGbWK+TFfo1R2g1afb49DqptCBIZPBtNUufkrDCwyWsTu Jd7mPc503QGp56ds972MvBI5QYCBY5ydTO/tXgvCZqJ/laz0cy8i1U5eHqzZ81J7 utxMnHmziIAuj2Oy0LlNZfXLqED2d/xbSRwQVNJ+a7F07IH8U7RFlxRZ1Yteurw= =50dc -----END PGP SIGNATURE----- --===-=-=--
--===============1496153992== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline
_______________________________________________ hangout mailing list hangout-at-nylxs.com http://www.nylxs.com/ --===============1496153992==--
|
|