Commit graph

1230 commits

Author SHA1 Message Date
Nicolas Léveillé
6b9ba6033e Allow windows users to include hammer.h
We substitute H_GCC_ATTRIBUTE to any occurence of __attribute__ and
disable its function with non gcc, non clang compilers.

We use a H_ macro so as to not pollute users' namespaces.

On windows build without c4201 so as to allow anonymous struct. This
shows hammer is not C99 compliant but rather C11.
2015-08-09 22:46:00 +02:00
Nicolas Léveillé
e7620e3e4b windows build: Build with debug symbols 2015-08-09 22:46:00 +02:00
Nicolas Léveillé
be30820023 windows build: Add build scripts + appveyor.yml
In order to guarantee that Hammer can build on Windows, an appveyor.yml
and associated build scripts will build hammer and its examples. The idea
is that as soon as the appveyor.yml exists in the repository, pull
requests that would impede Windows portability would be immediately
detected.

The scripts expect CL.EXE to be in the path, and will produce their
results in build/

The highest level of warning is enabled on CL.EXE, minus warnings that
bring CL.EXE to a level that ressembles C99. The only notable warning
that was disabled is the one that tells you about implicit truncating
conversions.

Hammer's source code has quite a few implicit conversions say from a 64bit
unsigned integer to a integer of a lesser size (signed or otherwise)
2015-08-09 22:46:00 +02:00
TQ Hirsch
402721ddb7 Merge pull request #136 from abiggerhammer/master
Fix #133
2015-08-03 00:00:06 +02:00
Meredith L. Patterson
0fb9d77e40 remove error from HSVMContext, make svm_stack_ensure_cap return bool instead 2015-08-02 23:42:38 +02:00
Meredith L. Patterson
759fbe77e5 C++ bindings needed to use system_allocator's free() too 2015-08-02 22:03:30 +02:00
Meredith L. Patterson
6bffacefaf fix memory leak introduced by putting setjmp in the wrong place 2015-08-02 21:46:57 +02:00
Meredith L. Patterson
1ffd8d9276 Fix undefined behaviour around system_allocator, issue #133. 2015-08-02 21:32:47 +02:00
Meredith L. Patterson
0653a9e48a add explicit null checks to system_allocator malloc/realloc 2015-08-02 14:34:45 +02:00
TQ Hirsch
f69698d734 Merge pull request #135 from uucidl/master
Print user defined token type while pretty printing
2015-08-01 13:52:48 +02:00
Nicolas Léveillé
2a6233b74f Print user defined token type while pretty printing
The pretty printing format chosen is USER:<token name>

We use the registry function `h_get_token_type_name` which returns 0
when no name has been defined. This will print (null) as a token name.
2015-08-01 13:42:43 +02:00
TQ Hirsch
9030136d08 Merge pull request #132 from abiggerhammer/master
Usability improvements from the tutorial
2015-07-26 18:15:50 +02:00
Meredith L. Patterson
522bc7cf05 Merge branch 'master' of github.com:abiggerhammer/hammer 2015-05-04 19:01:05 -04:00
Meredith L. Patterson
39c9096fd6 changes from tutorial: add h_literal, make h_make_bytes more practical 2015-05-04 19:00:37 -04:00
Meredith L. Patterson
33af1ec65c Merge pull request #131 from michiexile/master
Algebraic Generating Functions from parser
2015-04-11 01:16:25 +02: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
Meredith L. Patterson
8043c7f7b4 Merge pull request #24 from UpstandingHackers/master
Update from trunk
2015-03-15 23:29:57 +01:00
Meredith L. Patterson
26373bf25f Merge pull request #129 from pesco/h_bind
Add monadic bind combinator h_bind
2015-03-10 21:27:24 +01:00
Meredith L. Patterson
af260bdd58 Merge pull request #122 from mrdomino/fix-res_unamb-leak
Free res_unamb
2015-03-10 18:06:01 +01:00
Sven M. Hallberg
aa2dc7bcf5 put the message into the assert in aa_realloc 2015-03-04 14:54:42 +01:00
Sven M. Hallberg
be80fdedfc make arena-allocator implementation functions static 2015-03-04 14:52:28 +01:00
Sven M. Hallberg
9a8dca2c04 Merge branch 'master' of git://github.com/UpstandingHackers/hammer into h_bind 2015-03-04 14:47:49 +01:00
Sven M. Hallberg
1ce0ef9b8a pass a temporary arena allocator to the continuation in h_bind 2015-02-23 14:10:29 +01:00
TQ Hirsch
4e8d319d0e Merge pull request #126 from pesco/fix-h_read_bits-48
Add some missing type conversions to make h_read_bits work with count>32
2015-02-13 17:25:43 +01:00
Sven M. Hallberg
2eaf5d9052 add some missing type conversions to make h_read_bits work with count>32 2015-02-12 01:40:45 +01:00
Meredith L. Patterson
8aba9ce217 Merge pull request #125 from pesco/fix-h_seq_index_path
Descend properly in h_seq_index_path
2015-01-30 21:37:34 +01:00
Sven M. Hallberg
7ba5931095 Merge branch 'master' of git://github.com/UpstandingHackers/hammer into h_bind 2015-01-30 20:48:49 +01:00
Sven M. Hallberg
12771a5655 oh, there's t_regression.c now, neat. 2015-01-30 20:42:11 +01:00
Sven M. Hallberg
3f197ea1b0 Merge branch 'master' of git://github.com/UpstandingHackers/hammer into fix-h_seq_index_path 2015-01-30 20:37:26 +01:00
Sven M. Hallberg
341123e2ea descend properly in h_seq_index_path 2015-01-30 20:36:37 +01:00
Sven M. Hallberg
cbc7358b66 add a test that shows a bug in h_seq_index_path 2015-01-30 20:35:35 +01:00
Sven M. Hallberg
c9b2957832 add g_check_cmp_int 2015-01-30 20:35:14 +01:00
Sven M. Hallberg
78266af453 allow h_bind's function argument to return NULL as a shortcut for h_nothing_p() 2015-01-23 22:06:43 +01:00
Sven M. Hallberg
42d51ed479 add monadic bind combinator h_bind 2015-01-23 22:00:59 +01:00
Steven Dee
a0104776ed Free res_unamb 2015-01-04 21:38:04 -05:00
Meredith L. Patterson
5efaba87e8 Merge pull request #120 from thequux/fix-bug118
Fix #118
2015-01-04 04:18:11 +01:00
Meredith L. Patterson
b2f247b029 Merge pull request #116 from mrdomino/h-validate-apply
H_VALIDATE_APPLY macro
2015-01-04 04:12:06 +01:00
TQ Hirsch
af73181cf4 Fix #118
NEWS:
* Switching endianness mid-byte no longer potentially re-reads bytes.
* bit_offset now consistently refers to the number of bits already
  read.
* HParsedTokens now have a bit_length field; this is a size_t.  This
  may be removed for memory reasons.

The bit writer has not yet been updated to match; the result of
switching bit writer endianness in the middle of a byte remains
undefined.
2015-01-04 04:08:01 +01:00
Steven Dee
2dad0c48b4 H_VALIDATE_APPLY macro
I've found this especially useful in combination with my own
_attr_uint_const for things like flags and type specifiers.

It's possible that its usefulness might be diminished significantly if
there were a built-in bitfield constant parser -- that certainly would
eliminate all of my current uses of it -- but it still seems nicely
symmetric with H_ACT_APPLY.
2015-01-03 16:44:36 -05:00
Steven Dee
5abe74f890 Retab as though tabstop were 8
Tabs after the first non-tab character are crazymaking. I picked 8
because it wasn't 7 and caused the backslashes to line up on
H_ACT_APPLY.
2015-01-03 16:35:56 -05:00