[stupid-crypto] 8 new revisions pushed by b.clifford on 2010-04-06 12:18 GMT

1 view
Skip to first unread message

stupid...@googlecode.com

unread,
Apr 6, 2010, 8:18:48 AM4/6/10
to stupi...@googlegroups.com
8 new revisions:

Revision: f059c510e7
Author: Ben Clifford <be...@hawaga.org.uk>
Date: Tue Apr 6 04:01:00 2010
Log: document IPC::Run prereq
http://code.google.com/p/stupid-crypto/source/detail?r=f059c510e7

Revision: 2cdbbb4ce3
Author: Ben Clifford <be...@hawaga.org.uk>
Date: Tue Apr 6 04:05:30 2010
Log: remove (non)standard env options and replace with perl use warnings
so...
http://code.google.com/p/stupid-crypto/source/detail?r=2cdbbb4ce3

Revision: 67c8831532
Author: Ben Clifford <be...@hawaga.org.uk>
Date: Tue Apr 6 04:09:55 2010
Log: test.sh was completely replaced by test.pl a while ago
http://code.google.com/p/stupid-crypto/source/detail?r=67c8831532

Revision: a04e91b3e1
Author: Ben Clifford <be...@hawaga.org.uk>
Date: Tue Apr 6 04:13:20 2010
Log: explicitly count number of passed tests
http://code.google.com/p/stupid-crypto/source/detail?r=a04e91b3e1

Revision: 747ac2af3e
Author: Ben Clifford <be...@hawaga.org.uk>
Date: Tue Apr 6 04:28:55 2010
Log: tests should always have an ostream
http://code.google.com/p/stupid-crypto/source/detail?r=747ac2af3e

Revision: 0859483507
Author: Ben Clifford <be...@hawaga.org.uk>
Date: Tue Apr 6 04:38:04 2010
Log: this comment test was being skipped and was only testing
functionality...
http://code.google.com/p/stupid-crypto/source/detail?r=0859483507

Revision: a8f14cc7d0
Author: Ben Clifford <be...@hawaga.org.uk>
Date: Tue Apr 6 05:11:33 2010
Log: Use indentation rather than {;} to define blocks....
http://code.google.com/p/stupid-crypto/source/detail?r=a8f14cc7d0

Revision: dc4abbc6dd
Author: Ben Clifford <be...@hawaga.org.uk>
Date: Tue Apr 6 05:16:39 2010
Log: A test for if
http://code.google.com/p/stupid-crypto/source/detail?r=dc4abbc6dd

==============================================================================
Revision: f059c510e7
Author: Ben Clifford <be...@hawaga.org.uk>
Date: Tue Apr 6 04:01:00 2010
Log: document IPC::Run prereq
http://code.google.com/p/stupid-crypto/source/detail?r=f059c510e7

Modified:
/README

=======================================
--- /README Mon Mar 22 08:50:38 2010
+++ /README Tue Apr 6 04:01:00 2010
@@ -1,4 +1,5 @@
A non-exhaustive list of prerequisites:

- Perl File::Slurp (p5-file-slurp)
-
+ Perl File::Slurp (macports: p5-file-slurp)
+ Perl IPC::Run (macports: p5-ipc-run)
+

==============================================================================
Revision: 2cdbbb4ce3
Author: Ben Clifford <be...@hawaga.org.uk>
Date: Tue Apr 6 04:05:30 2010
Log: remove (non)standard env options and replace with perl use warnings so
that
this runs on more than just freebsd.

As I understand it, this will now only show warnings for code that has
perl source in the repo: it will no longer show warnings for grammer.y or
for any external perl modules.
http://code.google.com/p/stupid-crypto/source/detail?r=2cdbbb4ce3

Modified:
/src/Stupid/C.pm
/src/Stupid/Haskell.pm
/src/Stupid/Java.pm
/src/stupid.pl
/test/test.pl

=======================================
--- /src/Stupid/C.pm Fri Apr 2 10:16:20 2010
+++ /src/Stupid/C.pm Tue Apr 6 04:05:30 2010
@@ -1,6 +1,7 @@
package Stupid::C;

use strict;
+use warnings;

use Carp;

=======================================
--- /src/Stupid/Haskell.pm Mon Mar 29 12:45:05 2010
+++ /src/Stupid/Haskell.pm Tue Apr 6 04:05:30 2010
@@ -7,6 +7,7 @@
# Types in haskell must begin with an uppercase, which is reflected here

use strict;
+use warnings;

sub Stupid::LanguageWrapper::emitCode {
my $self = shift;
=======================================
--- /src/Stupid/Java.pm Mon Mar 8 00:17:50 2010
+++ /src/Stupid/Java.pm Tue Apr 6 04:05:30 2010
@@ -1,6 +1,7 @@
package Stupid::Java;

use strict;
+use warnings;
use File::Basename;

# a note on mapping between java types and stupid types:
=======================================
--- /src/stupid.pl Fri Apr 2 07:49:18 2010
+++ /src/stupid.pl Tue Apr 6 04:05:30 2010
@@ -1,6 +1,7 @@
-#!/usr/bin/env -S perl -w
+#!/usr/bin/env perl

use strict;
+use warnings;

use grammar;
use File::Slurp;
=======================================
--- /test/test.pl Fri Apr 2 07:37:56 2010
+++ /test/test.pl Tue Apr 6 04:05:30 2010
@@ -1,6 +1,7 @@
-#!/usr/bin/env -S perl -w
+#!/usr/bin/env perl

use strict;
+use warnings;

use Getopt::Long;
use Carp;

==============================================================================
Revision: 67c8831532
Author: Ben Clifford <be...@hawaga.org.uk>
Date: Tue Apr 6 04:09:55 2010
Log: test.sh was completely replaced by test.pl a while ago
http://code.google.com/p/stupid-crypto/source/detail?r=67c8831532

Deleted:
/test/test.sh

=======================================
--- /test/test.sh Fri Feb 26 05:15:49 2010
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env bash
-
-#set -e
-#set -x
-
-trap onexit HUP INT QUIT TERM
-
-function onexit() {
- local exit_status=${1:-$?}
- echo Exiting $0 with status $exit_status
- rm /tmp/stupid.$$
- exit $exit_status
-}
-
-TARGETLANG=$1
-
-for a in *.stupid; do
- BN=$(basename -s .stupid $a)
- echo -n "testing ${BN} in ${TARGETLANG} ... "
- ./build-${TARGETLANG}.sh ${BN} >/tmp/stupid.$$ 2>&1
- if [ "$?" = "0" ] ; then
- ./${BN} >/dev/null 2>&1
- if [ "$?" = "0" ] ; then
- echo SUCCESS
- else
- echo FAIL: Execute
- fi
- else
- echo FAIL: Compile
- cat /tmp/stupid.$$
- fi
- rm /tmp/stupid.$$
-done
-
-exit 0

==============================================================================
Revision: a04e91b3e1
Author: Ben Clifford <be...@hawaga.org.uk>
Date: Tue Apr 6 04:13:20 2010
Log: explicitly count number of passed tests
http://code.google.com/p/stupid-crypto/source/detail?r=a04e91b3e1

Modified:
/test/test.pl

=======================================
--- /test/test.pl Tue Apr 6 04:05:30 2010
+++ /test/test.pl Tue Apr 6 04:13:20 2010
@@ -21,6 +21,7 @@
my $failed = 0;
my $skipped = 0;
my $ran = 0;
+my $passed = 0;
for my $test (@tests) {
++$ran;
my($base) = $test =~ /^(.*)\.stupid$/;
@@ -54,6 +55,7 @@
++$failed;
} else {
print 'OK';
+ ++$passed;
}
} else {
print 'skip';
@@ -62,4 +64,4 @@
print "\n";
}

-print "Ran $ran tests, $failed failed, $skipped skipped.\n";
+print "Ran $ran tests, $passed passed, $failed failed, $skipped
skipped.\n";

==============================================================================
Revision: 747ac2af3e
Author: Ben Clifford <be...@hawaga.org.uk>
Date: Tue Apr 6 04:28:55 2010
Log: tests should always have an ostream
http://code.google.com/p/stupid-crypto/source/detail?r=747ac2af3e

Modified:
/test/overflow32.stupid
/test/overflow8.stupid
/test/underflow32.stupid

=======================================
--- /test/overflow32.stupid Fri Apr 2 07:52:36 2010
+++ /test/overflow32.stupid Tue Apr 6 04:28:55 2010
@@ -1,7 +1,7 @@
"EXPECT-RUN-FAIL:305419896 plus32 4275878552 overflows
";

-function() test() {
+function(ostream o) test() {
uint32 a = 0x12345678;
uint32 b = 0xfedcba98;
uint32 c = 0;
=======================================
--- /test/overflow8.stupid Fri Apr 2 07:33:12 2010
+++ /test/overflow8.stupid Tue Apr 6 04:28:55 2010
@@ -1,7 +1,7 @@
"EXPECT-RUN-FAIL:129 plus8 128 overflows
";

-function() test() {
+function(ostream o) test() {
uint8 a = 129;
uint8 b = 128;
uint8 c = 0;
=======================================
--- /test/underflow32.stupid Fri Apr 2 10:16:20 2010
+++ /test/underflow32.stupid Tue Apr 6 04:28:55 2010
@@ -1,7 +1,7 @@
"EXPECT-RUN-FAIL:1 minus32 2 underflows
";

-function() test() {
+function(ostream o) test() {
uint32 a = 1;
uint32 b = 2;
uint32 c = 0;

==============================================================================
Revision: 0859483507
Author: Ben Clifford <be...@hawaga.org.uk>
Date: Tue Apr 6 04:38:04 2010
Log: this comment test was being skipped and was only testing functionality
that
is present in every other test. so remove.
http://code.google.com/p/stupid-crypto/source/detail?r=0859483507

Deleted:
/test/comment-start.stupid

=======================================
--- /test/comment-start.stupid Wed Feb 3 05:18:19 2010
+++ /dev/null
@@ -1,10 +0,0 @@
-"This comment should probably be permitted";
-
-function (uint32 t, array(uint8, 8) a) test(uint32 n, uint8 b) {
- uint32 i = 0;
-
- while (i ne32 n) {
- a[i] = b;
- }
- t = i;
-}

==============================================================================
Revision: a8f14cc7d0
Author: Ben Clifford <be...@hawaga.org.uk>
Date: Tue Apr 6 05:11:33 2010
Log: Use indentation rather than {;} to define blocks.

This shouldn't change the behaviour of programs but should make it a little
easier to read the generated Haskell code.
http://code.google.com/p/stupid-crypto/source/detail?r=a8f14cc7d0

Modified:
/src/Stupid/Haskell.pm

=======================================
--- /src/Stupid/Haskell.pm Tue Apr 6 04:05:30 2010
+++ /src/Stupid/Haskell.pm Tue Apr 6 05:11:33 2010
@@ -9,6 +9,8 @@
use strict;
use warnings;

+my $indent = "";
+
sub Stupid::LanguageWrapper::emitCode {
my $self = shift;

@@ -33,13 +35,13 @@

sub Stupid::FunctionCall::emitCode {
my $self = shift;
-
+ print "$indent";
$self->{function}->emitCall();
print ' ';
# $self->{function}->maybeAddSelf(); # do we ever need this? perhaps
not... where is it used? for object-style invocations only, I think, and in
those, the self is passed through a different syntax
$self->{args}->emitParameters();
# whats happening for return parameters here?
- print " ;\n";
+ print "\n";
}

## FUNCTODO
@@ -330,11 +332,14 @@

sub Stupid::StatementList::emitCode {
my $self = shift;
- print "do { ";
+ print "do\n";
+ my $oldindent = $indent;
+ $indent = "$indent ";
for my $s (@{$self->{statements}}) {
$s->emitCode();
}
- print " ; return () }";
+ print "${indent}return ()";
+ $indent = $oldindent;
# TODO for now we always return nothing at all - the only example I've seen
# of stupid code gives any particular return method so I arbitrarily assume
# none at all
@@ -344,7 +349,7 @@
my $self = shift;

$self->{expr}->emitCode();
- print ";";
+ # print ";";
}

# if this is only used for parameters to functions, maybe needs
@@ -401,11 +406,15 @@
# its condition is a monadic action returning a value, not a pure
# expression (despite what it superficially looks like) because
# it depends on the value of variables...
+ print "$indent";
print 'stupidwhile (';
$self->{cond}->emitCode();
- print ") (\n";
+ print ") \$ ";
+ my $oldindent=$indent;
+ $indent="$indent ";
$self->{body}->emitCode();
- print ");\n";
+ $indent=$oldindent;
+ print "\n";
}

sub Stupid::Comment::emitCode {
@@ -430,6 +439,7 @@
# should be able to pull the InST out into its own operator using
# applicative functor syntax, but I don't have my head around that at
# the moment...
+ print "$indent";
print '(writeIORefInIO (';
$self->{left}->emitLValue();
print ' )) $< ( ';
@@ -466,6 +476,7 @@
# $self->{type}->emitDeclaration($self->{name});

# now create a STRef for this variable and assign the initial value
+ print "$indent";
print $self->{name};
print ' <- (newIORef $< ( (';
$init->emitCode();

==============================================================================
Revision: dc4abbc6dd
Author: Ben Clifford <be...@hawaga.org.uk>
Date: Tue Apr 6 05:16:39 2010
Log: A test for if
http://code.google.com/p/stupid-crypto/source/detail?r=dc4abbc6dd

Added:
/test/if.stupid

=======================================
--- /dev/null
+++ /test/if.stupid Tue Apr 6 05:16:39 2010
@@ -0,0 +1,9 @@
+"EXPECT:B";
+
+function(ostream out) test() {
+ if(1 eq32 2) {
+ out.put(67);
+ } else {
+ out.put(66);
+ }
+}

Reply all
Reply to author
Forward
0 new messages