Commit Graph

4675 Commits

Author SHA1 Message Date
Erik Svedäng
7bd1b122bf docs: Clarifications 2020-11-24 06:45:51 +01:00
Erik Svedäng
f6a4ce9572 docs: Slight fix to README 2020-11-24 06:43:28 +01:00
Erik Svedäng
ada8cd9b48
docs: A document about running code (#1013)
* docs: A document about running code

* fix: Tweaks

* docs: More information about running code

Co-authored-by: Erik Svedang <erik@Eriks-iMac.local>
2020-11-24 06:40:31 +01:00
jacereda
9520caf658
Replace return by pure. (#1009)
* Replace return by pure.

* Remove commandHelp again.
2020-11-24 06:09:15 +01:00
Erik Svedäng
48489a5771
feat: Implicit struct init (#1003)
* feat: Can omit .init in simple cases

* fix: Don't treat unqualified modules as interface sym:s

* feat: Can handle implicit init of type inside 'use':d module

* fix: Give deftypes and sumtypes correct parent environment!

* test: A few test cases

* refactor: Remove commented out code

Co-authored-by: Erik Svedang <erik@Eriks-iMac.local>
2020-11-23 09:59:35 +01:00
Erik Svedäng
793bf19ede
docs: Remove a lot of duplicated information and refer to webpages instead (#988)
* docs: Remove a lot of duplicated information and refer to webpages instead

* fix: Remove line about (help), it does not make sense anymore

* fix: Add open-browser to nix config

Co-authored-by: Erik Svedang <erik@Eriks-iMac.local>
2020-11-23 09:58:06 +01:00
Scott Olsen
8cc2ae1f2b
Eval: Add Address to eval (#1005)
The `address` keyword is useful when one needs to circumvent Carp's
memory management for particular cases. However, the evaluator
previously didn't understand `address` in most contexts, so it proved
difficult to toy around with in the REPL.

This commit adds basic support for calling `address` in the REPL by
adding a case to the evaluator. This allows users to test out functions
that take `Ptr` arguments such as `Pointer.to-value`. The `address`
keyword only accepts a symbol as an argument (since getting the address
of a literal value doesn't always make sense (e.g. &2) and produces
invalid C):

    (def a 1)
    (address a)
    => a
    (type (address a))
    => (Ptr Int)
    (Pointer.to-value (address a))
    => 1

Note: one will still typically need to wrap it in a function in
higher-order contexts.
2020-11-23 09:32:05 +01:00
Erik Svedäng
a873099640
chore: Move some examples to test/produces-output (#989)
* chore: Moved examples that work more as tests to folder 'test/produces-output'

* fix: Corrections to the release script

* fix: Correct filename on Windows

* fix: Move more files around

* fix: Remove check-malloc example

* fix: Apparently unicode example does not work

* chore: Move nested_lambdas.carp back to examples

* chore: Remove .DS_Store files

* fix: Bring back unicode test

* test: Make sure benchmark compile (had to remove mandelbrot and n-bodies)

* fix: Replacement implementation of clock_gettime on Windows

* chore: Trigger CI

* fix: Define CLOCK_REALTIME

Co-authored-by: Erik Svedang <erik@Eriks-iMac.local>
2020-11-23 06:30:43 +01:00
jacereda
8e9f7bfd90
Split integer/floating point number representation. (#1006) 2020-11-23 06:28:30 +01:00
Erik Svedäng
26ed4b7b52
docs: Release checklist (#999)
Co-authored-by: Erik Svedang <erik@Eriks-iMac.local>
2020-11-22 22:24:04 +01:00
jacereda
244df27942
Unicode fixes (#994)
* Some compilers (tcc) will complain switching on const values.

* Fix unicode example when compiling with -std=c99.
2020-11-22 06:45:26 +01:00
Tim Dévé
6593a64a19
Adding more documentation around C Interop (#984)
* Adds C Interop documentation for Strings

* Replaces usage of triple backticks with single when used in a paragraph

* Adds link to new C Interop docs in the Language Guide

* Small tweaks to wording in C Interop doc

* Adds Array section to C Interop doc

* Adds deftemplate examples in C interop doc

* Small copy change in C interop doc

* Adds identifiers section in C interop doc
2020-11-21 21:28:42 +01:00
jacereda
4065e09247
Cleanup double negations in unit detection. (#987) 2020-11-21 12:49:00 +01:00
Scott Olsen
c1e794c4cc
More Unit type member enhancements (#986)
* Emit/Deftype: Add a few more special cases for Unit members

There were a few gaps remaining in our handling of Unit types as members
of user defined types, most notably, generic setters weren't handling
Units appropriately. This commit adds special checks for Unit types in
generic setters, and also accounts for a Unit refs:

- Specialize generic setter functions against Unit members
- Specialize calls to str/prn against Unit members in StructUtils
  (rather than accessing the struct member, which doesn't exist in the
  Unit case, we simple call Unit's prn function (added in the next
  commit).
- Don't bind references to Unit values to variables. This fixes an error
  whereby a reference to a Unit would generate invalid C such as:
  `void* _9 = &;`
  Likewise, we omit references to Units from function arguments just as
  we omit Unit values.

* Unit: Add Unit type implementations for common interfaces.

Now that Unit can be used as a member type it is subject to several
interfaces, such as prn, that it previously hadn't implemented.

This commit adds Unit.carp to core which implements `prn`, `copy`, and
`zero` for the Unit type.

* Deftype: Return null pointers for Unit getters

This is *hopefully* one of the final updates needed to fully support
Unit's as member types. Getters for fields of such types have no struct
member to read, but are expected to return a void pointer; so we return
a NULL void pointer instead.

This commit also updates our emissions for function calls to prevent
assigning the results of functions with Unit and (Ref Unit) return types
to variables.

* Emit: Filter void args from lambda calls

Just as we filter void argument types from other function calls, we now
filter them from calls to lambdas.
2020-11-21 05:57:03 +01:00
Tim Dévé
4f66803ab7
Updates mutual recursion example (#983)
so it can be executed without blowing the stack.
2020-11-20 15:12:49 +01:00
Tim Dévé
1b87bfbcb9
Skips publishing docs if the branch is not master (#985) 2020-11-20 15:11:35 +01:00
Erik Svedäng
041d929fc6 fix: Level of heading 2020-11-20 08:25:20 +01:00
Erik Svedäng
a2c4e34e1a feat: Multimedia.md 2020-11-20 08:24:36 +01:00
Erik Svedäng
e4acfe420e refactor: Clean up reptile code 2020-11-20 08:04:33 +01:00
Erik Svedäng
c99c42909f docs: Move things around in readme 2020-11-20 08:00:41 +01:00
Erik Svedäng
f690b52a83 docs: Move logo to top 2020-11-20 07:56:17 +01:00
Erik Svedäng
8bcd1dabab docs: Move gitter badge 2020-11-20 07:54:36 +01:00
Erik Svedäng
ad70be5023 refactor: Move logos into resorces directory 2020-11-20 07:52:59 +01:00
Erik Svedäng
3192d54ae9
refactor: Move emacs-mode to separate repo (#981) 2020-11-20 07:48:21 +01:00
Erik Svedang
a270365553 fix: Sort modules alphabetically (manually, for now) 2020-11-20 00:46:52 +01:00
Erik Svedang
2df93a0275 fix: One more link 2020-11-19 21:45:33 +01:00
Erik Svedang
9530bff9ab fix: Correct links 2020-11-19 21:44:49 +01:00
Erik Svedang
609acb340a Merge branch 'master' of https://github.com/carp-lang/Carp 2020-11-19 21:44:31 +01:00
Erik Svedang
0fd7c8828f chore: Remove SDL docs 2020-11-19 21:43:02 +01:00
Erik Svedäng
1631b917b0
Merge pull request #980 from scolsen/unit-fix
Reify: Add Unit as a special case
2020-11-19 21:38:25 +01:00
Erik Svedang
3df10e997c feat: Better docs structure 2020-11-19 21:24:34 +01:00
scottolsen
a5ffb1b841 Reify: Add Unit as a special case
Unit's show implementation defaults to the empty list `()`--this
presents problems when validating types, since generic type members are
replaced by the reification (a type literal) of their arguments. In the
`Unit` case, `()` yields some surprising invalid types.

So, we reify UnitTy as `Unit` instead to ensure consistency. This
permits using  Unit as a member in generic types like Result.
2020-11-19 15:15:35 -05:00
Erik Svedang
7932fc8612 fix: Regarding CARP_DIR 2020-11-19 21:12:17 +01:00
Erik Svedang
78645d0579 fix: Clean-up and clarifications regarding libraries 2020-11-19 21:10:40 +01:00
Erik Svedang
885830b15e docs: Playing around with slightly different link style 2020-11-19 20:53:46 +01:00
Erik Svedang
adaff5577f chore: Ignore html files in doc directories 2020-11-19 20:38:30 +01:00
Erik Svedang
4f7b4ef4cd fix: Bring back the test suite 2020-11-19 20:36:54 +01:00
Erik Svedang
b5d0a442fb fix: Just copy all the files in docs, for now 2020-11-19 20:29:09 +01:00
Erik Svedang
b3442bae5c fix: Subfolder? 2020-11-19 20:20:17 +01:00
Erik Svedang
6c523cf8ab fix: Wrong secret 2020-11-19 20:09:23 +01:00
Erik Svedang
ff8afed34b fix: Kebab case 2020-11-19 19:55:13 +01:00
Erik Svedäng
1ef7eac3d6
Merge pull request #979 from carp-lang/new-copy-script
fix: Trying out another copying script (temporarily removed the tests)
2020-11-19 19:48:51 +01:00
Erik Svedang
a48eb9ac9c Merge branch 'master' into new-copy-script 2020-11-19 19:48:06 +01:00
Erik Svedang
f099b5ef78 fix: Trying out another copying script (temporarily removed the tests) 2020-11-19 19:44:39 +01:00
Erik Svedang
637b66c88c fix: Trying out another copying script (temporarily removed the tests) 2020-11-19 19:43:03 +01:00
Erik Svedäng
19b609947f
Merge pull request #978 from TimDeve/simplify-macos-ci
Simplifies MacOS CI by removing custom version in setup-haskell
2020-11-19 10:03:33 +01:00
Tim Dévé
97100fb0bf Simplifies MacOS CI by removing custom version in setup-haskell 2020-11-19 08:38:34 +00:00
Erik Svedäng
b7455dc4d5
Merge pull request #977 from jacereda/nixpkgsci
Attempt to run CI jobs using Nixpkgs.
2020-11-19 08:43:09 +01:00
Jorge Acereda
0675bd6750 Attempt to run CI jobs using Nixpkgs. 2020-11-18 23:47:09 +01:00
Erik Svedang
7e5f97c30f fix: Trying random things 2020-11-18 23:40:19 +01:00