Commit graph

136 commits

Author SHA1 Message Date
Meredith L. Patterson
1bd778f52e the Great Merge continues 2019-10-08 17:13:31 +02:00
Meredith L. Patterson
8a545c4dcf dotnet and php bindings have bitrotted, but packrat is faster now 2019-10-08 17:11:18 +02:00
Meredith L. Patterson
103a366302 fix merge conflict 2019-10-07 17:00:05 +02:00
Alex Willmer
59ba68ef84 Use byte literals in examples and unit tests
In Python 2.x an unprefixed string literal produces a byte string.
In Python 3.x an unprefixed string literal produces a textual string.

To produce a byte string in both a b prefix is needed, e.g. b'foo'.
Since I believe Hammer works predominantly with byte strings I have used
b prefixes throughout.
2019-05-10 21:59:03 +01:00
Alex Willmer
287f71d561 Fix uses of retired builtins and builtin methods
In Python 3.x

- int and long types are unified. The unified type is called int.
- the text string type (unicode) is renamed to str.
- the byte string type (str) is renamed to bytes.
- chr returns a text string (i.e. str)
- xrange is renamed to range.
- dict.has_key() is removed
-
2019-05-10 21:59:03 +01:00
Alex Willmer
0f3cadcc3e Enable absolute imports, true division, & print()
These have no effect in Python 3.x, they are the default. Enabling them
in Python 2.x, enabling them in Python 2.x allows single source
compatiblity.
2019-05-10 21:13:32 +01:00
Nicolas Léveillé
f9d8f1df7f Reactivate examples that can build on windows
This is proof that Hammer can be linked and used in a windows
program!
2016-01-31 18:11:27 +01:00
Alex Willmer
c6280a98bc Added Python versions of base64 examples
These are transliterations of the existing C files.
They're not particularly Pythonic or performant, but they're a start.

Example of usage

```
$ echo '  YW55IGNhcm5hbCBwbGVhcw==' | PYTHONPATH=../build/opt/src/bindings/python/ python base64.py
inputsize=27
input=  YW55IGNhcm5hbCBwbGVhcw==
((((89L, 87L, 53L, 53L), (73L, 71L, 78L, 104L), (99L, 109L, 53L, 104L), (98L, 67L, 66L, 119L), (98L, 71L, 86L, 104L)), (99L, 'w', '=', '=')),)
$ echo '  YW55IGNhcm5hbCBwbGVhcw==' | PYTHONPATH=../build/opt/src/bindings/python/ python base64_sem1.py
inputsize=27
input=  YW55IGNhcm5hbCBwbGVhcw==
(97L, 110L, 121L, 32L, 99L, 97L, 114L, 110L, 97L, 108L, 32L, 112L, 108L, 101L, 97L, 115L)
$ echo '  YW55IGNhcm5hbCBwbGVhcw==' | PYTHONPATH=../build/opt/src/bindings/python/ python base64_sem2.py
inputsize=27
input=  YW55IGNhcm5hbCBwbGVhcw==
(97L, 110L, 121L, 32L, 99L, 97L, 114L, 110L, 97L, 108L, 32L, 112L, 108L, 101L, 97L, 115L)
```
2015-12-04 10:20:25 +00:00
Mikael Vejdemo-Johansson
d13657a411 Changed generating functions printouts to be copy-paste-able into SageMath.
Now we can do things like:

# copy-paste from output
ring.<t,L,tie,Cn,M,Ln,I,D,J,Rn,A,K,F,G> = QQ[]
ID = ring.ideal(L - (1*Cn*t),tie - (1*Ln*t),Cn - (1*I + 1*J),M - (1*t^2),Ln - (1*D + 1*L + 1*M),I - (1*Rn*t),D - (1*Rn*t),J - (1*Ln*t),Rn - (1*F + 1*G + 1*K),A - (1*tie),K - (1*t^2),F - (1*Ln*t),G - (1*Cn*t))

# we are interested in tie in terms of t; so we want to remove anything not these two:
ID.elimination_ideal([L,Cn,M,Ln,I,D,J,Rn,A,K,F,G])

# output from this SageMath command is
# Ideal (t^3 + 2*t^2*tie + t*tie - tie) of Multivariate Polynomial Ring in t, L, tie, Cn, M, Ln, I, D, J, Rn, A, K, F, G over Rational Field
# which we can solve for tie to get tie = t^3/(1-t-2*t^2) just as expected
2015-04-10 10:05:19 +02:00
Mikael Vejdemo-Johansson
a72aff9b39 refactored out the grammar handling. handles epsilons better 2015-04-08 17:32:12 +02:00
Mikael Vejdemo-Johansson
24e9e9de7f support naming of generating functions, and 0-weighting of symbols 2015-04-08 15:29:32 +02:00
Mikael Vejdemo-Johansson
1e95eac6cd removed h_repeat_n to enable desugaring 2015-04-08 14:06:58 +02:00
Mikael Vejdemo-Johansson
5100dc69da typo 2015-04-08 13:54:30 +02:00
Mikael Vejdemo-Johansson
8039d48537 removed use of h_many to get desugars 2015-04-08 13:53:45 +02:00
Mikael Vejdemo-Johansson
61a211559e fixed build errors wrt sentinels 2015-04-08 13:46:42 +02:00
Mikael Vejdemo-Johansson
9a1812bd49 added ties to build script 2015-04-08 13:44:14 +02:00
Mikael Vejdemo-Johansson
7fdc687bd4 parsers for the grammars in the tieknots paper 2015-04-08 09:33:20 +02:00
Mikael Vejdemo-Johansson
6b8a3f262f polished generating function code more 2015-04-07 22:14:32 +02:00
Mikael Vejdemo-Johansson
107d8c092b Generating function skeleton code 2015-04-07 22:13:18 +02:00
Steven Dee
8d5f00870f Remove vacuous states in base64_sem?.c
I don't think these actually affect correctness since there's no way for
0x40 or 0x60 to show up in a parse tree anyway, but they're confusing.
2014-12-07 00:16:57 -05:00
Meredith L. Patterson
0963a9d550 that seems to be examples as its own target now 2013-12-22 18:09:23 +01:00
Dan Hirsch
69e84bcbb0 Added a void* user_data pointer to HPredicate 2013-11-23 13:01:55 -06:00
Dan Hirsch
e487d5435c Added a void* user_data pointer to HAction 2013-11-23 12:53:11 -06:00
Peter Johnson
c8fc061ea6 Ditch longs and long longs in favor of stdint.h types, which has cascading
effects throughout, including use of inttypes.h/PRI[ud]64 because printf() is
still stuck in a long world, conversion of %lu to %zu for printing values of
type size_t, and changing/renaming the g_check_cmp* family of functions.
2013-11-15 00:12:57 -05:00
Dan Hirsch
b0f567c090 Added new build system 2013-07-10 21:32:05 +02:00
Dan Hirsch
e9a7c0b83d Added new SConscript-based build system; not yet done porting 2013-06-24 21:26:07 +02:00
Dan Hirsch
d71215d494 All tests pass; lots of stuff is no longer const 2013-05-24 15:07:47 +02:00
Aur Saraf
9a6a785390 debugging info in test_parse(), more tests, fixed some of them but not others 2013-04-14 03:13:07 +03:00
Aur Saraf
e64e66b194 some tests for base64.c 2013-04-14 02:49:12 +03:00
Sven M. Hallberg
4041a5865c pass rr by reference to set_rdata 2013-04-13 14:42:36 +02:00
Sven M. Hallberg
f1f7c4f488 remove dependency on internal.h for base64_sem2 2013-02-17 17:00:04 +01:00
Sven M. Hallberg
51b9082837 remove obsolete dependency on internal.h 2013-02-17 16:49:25 +01:00
Sven M. Hallberg
d9c2c921c4 use H_MAKE_SEQN in base64_sem1 2013-02-17 16:48:35 +01:00
Sven M. Hallberg
af23f3bbf3 add more glue functions in base64_sem1 2013-02-17 16:45:29 +01:00
Sven M. Hallberg
a5c579c23d switch semantic base64 examples to pre-fab actions provided by glue.h 2013-02-17 15:53:43 +01:00
Sven M. Hallberg
b06a98ce26 fix linking of base64 example 2013-02-17 15:47:18 +01:00
Sven M. Hallberg
cc912fa98e Merge branch 'glue' into base64-example 2013-02-17 15:26:15 +01:00
Sven M. Hallberg
dd763f0c07 Merge branch 'master' into base64-example 2013-02-17 15:25:58 +01:00
Sven M. Hallberg
195e50a7f1 move glue.[ch] into the library proper 2013-02-17 15:24:13 +01:00
Sven M. Hallberg
e95aef0b09 add some docs to glue.h 2013-02-01 01:42:10 +01:00
Sven M. Hallberg
7149260a13 make h_cast a family of macros, add H_ASSERT family, make h_assert_type a macro 2013-01-25 21:52:11 +01:00
Sven M. Hallberg
18fbf6fd69 replace casting h_seq_index functions with H_INDEX macro family,
supporting varargs
2013-01-25 21:09:23 +01:00
Sven M. Hallberg
811c68fdf2 let H_INDEX and H_FIELD accept varargs for nested sequence access 2013-01-25 20:47:51 +01:00
Sven M. Hallberg
64c44522e9 use new glue api in rr.c 2013-01-25 20:17:37 +01:00
Sven M. Hallberg
b6856fdfbf indentation fix 2013-01-25 19:32:09 +01:00
Sven M. Hallberg
53bc7af36a use more glue in dns.c 2013-01-25 19:31:10 +01:00
Sven M. Hallberg
102d9e2c86 add h_seq_elements accessor 2013-01-25 19:24:04 +01:00
Sven M. Hallberg
2f312b8c1f use H_CAST in set_rdata 2013-01-25 19:16:25 +01:00
Sven M. Hallberg
690a17b1f6 fix semantic action on A records 2013-01-25 19:12:01 +01:00
Sven M. Hallberg
0e37c6b8a1 apply some simplifications to dns example 2013-01-25 19:11:02 +01:00