Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Channels, fibers, oh my! #241

Merged
merged 64 commits into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
86d21e8
Add channels
MarcelGarus Aug 18, 2022
5062d56
Add ports
MarcelGarus Aug 18, 2022
d5d921a
Refactor Heap::create_list
MarcelGarus Aug 18, 2022
54a0429
Start implementing builtins
MarcelGarus Aug 18, 2022
ba2475e
Implement channels
MarcelGarus Aug 18, 2022
ea50a6e
Start implementing fibers
MarcelGarus Aug 19, 2022
b85327d
Continue implementing fibers
MarcelGarus Aug 19, 2022
47b06b5
Update docs
MarcelGarus Aug 19, 2022
37fb3cb
Fix Int
MarcelGarus Aug 21, 2022
cb0c211
Use Context instead of UseProvider when running code
MarcelGarus Aug 21, 2022
7925556
Update todos
MarcelGarus Aug 26, 2022
4ab75e0
Create better benchmark
MarcelGarus Aug 26, 2022
832f7ae
Continue implementing the pushing of operations
MarcelGarus Aug 26, 2022
3d8dd67
Merged 'better-logging' into channels
MarcelGarus Aug 26, 2022
12f8381
Continue implementing channel operations
MarcelGarus Aug 27, 2022
4620266
Merge branch 'main' into channels
MarcelGarus Sep 3, 2022
01b5ca3
Make channel more efficient
MarcelGarus Sep 3, 2022
6b41d82
Specify Rust version
MarcelGarus Sep 4, 2022
6bc1bae
Improve Packet's Debug implementation
MarcelGarus Sep 4, 2022
fa02344
Continue implementing channel (WIP)
MarcelGarus Sep 4, 2022
2814e69
Comment out Fibonacci code
MarcelGarus Sep 4, 2022
33d7a28
Improve debug output
MarcelGarus Sep 4, 2022
3ac34ec
Better todos
MarcelGarus Sep 5, 2022
e2f0a30
Restructure code
MarcelGarus Sep 5, 2022
af9ff38
Completely refactor VM architecture
MarcelGarus Sep 6, 2022
8c9ef93
Implement spawning of fibers
MarcelGarus Sep 7, 2022
a762c53
Continue implementing channels
MarcelGarus Sep 7, 2022
0602c32
Make channels work
MarcelGarus Sep 7, 2022
b09a84e
Improve code quality
MarcelGarus Sep 7, 2022
11cbc29
Improve debug output
MarcelGarus Sep 7, 2022
3b8d791
Restructure code
MarcelGarus Sep 8, 2022
0e01979
Propagate panics happening in parallel scope
MarcelGarus Sep 8, 2022
d5f95e9
Remove canceled fibers
MarcelGarus Sep 8, 2022
48d5dff
Clean up code
MarcelGarus Sep 8, 2022
14230e8
Implement try
MarcelGarus Sep 10, 2022
8f89e96
Call main function
MarcelGarus Sep 10, 2022
e0d59ce
Merge branch 'channels' of https://github.com/candy-lang/candy into c…
MarcelGarus Sep 11, 2022
8391286
Clean up cargo lints
MarcelGarus Sep 11, 2022
f3f7d49
Add main function to benchmark
MarcelGarus Sep 11, 2022
a22f716
Implement parallel builtin without channels
MarcelGarus Sep 11, 2022
d5b5f6e
Improve code quality
MarcelGarus Sep 11, 2022
da2400a
Improve code quality
MarcelGarus Sep 11, 2022
2d15b86
Implement external channels
MarcelGarus Sep 12, 2022
030f805
Don't panic when sending to a dead nursery
MarcelGarus Sep 12, 2022
26d6daa
Make it an error to sent to a dead nursery
MarcelGarus Sep 22, 2022
0db9b4d
Clean up tracer
MarcelGarus Sep 24, 2022
5670716
Fix tracer
MarcelGarus Sep 24, 2022
b370621
Make code more readable
MarcelGarus Sep 24, 2022
9e5a4d8
Refactor context
MarcelGarus Oct 3, 2022
0acb7ad
Use tear down when appropriate
MarcelGarus Oct 3, 2022
989541e
Ignore some lints
MarcelGarus Oct 3, 2022
433cea7
Update todos
MarcelGarus Oct 3, 2022
56d8b57
Ignore more lints
MarcelGarus Oct 3, 2022
7d169c4
Merge branch 'main' into channels
MarcelGarus Oct 10, 2022
c8267ca
Apply minor suggestions from code review
MarcelGarus Oct 10, 2022
8b0ebb8
Update todos
MarcelGarus Oct 10, 2022
c817906
Update Core Candy code
MarcelGarus Oct 10, 2022
3546a2f
Apply more suggestions
MarcelGarus Oct 12, 2022
375fd78
Restructure how channels to the outside work
MarcelGarus Oct 13, 2022
275f00f
Free channels
MarcelGarus Oct 13, 2022
70060b9
Merge branch 'main' into channels
MarcelGarus Oct 17, 2022
f9d8f21
Log less things during fuzzing
MarcelGarus Oct 17, 2022
d57c061
Remove let_else feature flag
MarcelGarus Oct 17, 2022
f95e722
Apply suggestions
MarcelGarus Oct 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 82 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,48 @@

A sweet programming language that is robust, minimalistic, and expressive.

Candy aims to have excellent toolingmost language features are designed with tooling in mind.
Candy aims to have excellent tooling – most language features are designed with tooling in mind.
Many languages have a strict separation between compile-time and runtime.
Candy blurs the line between those stages, for example, by replacing compile-time types with edit-time fuzzing.

## Quick introduction

* **Values are at the center of your computations.**
- **Values are at the center of your computations.**
Only a handful of predefined types of values exist:
```

```candy
3 # int
"Candy" # text
Green # symbol
[ Name: "Candy" ] # struct
{ it -> add it 2 } # closure
```
* **Minimalistic syntax.**

- **Minimalistic syntax.**
Defining variables and functions works without braces or keywords cluttering up your code.
The syntax is indentation-aware.
```

```candy
foo = 42
println message =
print message
print "\n"
println "Hello, world!"
```
* **Extensive compile-time evaluation.**

- **Extensive compile-time evaluation.**
Many values can already be computed at compile-time.
In your editor, you'll see the results on the right side:
```

```candy
foo = double 2 # foo = 4
```
* **Fuzzing instead of traditional types.**
In Candy, functions have to specify their needs *exactly.*

- **Fuzzing instead of traditional types.**
In Candy, functions have to specify their needs _exactly._
As you type, the tooling automatically tests your code with many input to see if one breaks the code:
```

```candy
foo a = # If you pass a = 0,
needs (isInt a)
math.logarithm a # then this fails because logarithm only works on positive numbers.
Expand All @@ -61,63 +68,74 @@ To get a more in-depth introduction, read the [language document](language.md).
We are currently implementing a first version of Candy in Rust.
We already have a language server that provides some tooling.

Major milestones:

* [x] build a basic parser
* [x] lower CST to AST
* [x] lower AST to HIR
* [x] build a basic interpreter
* [x] add CLI arguments for printing the CST, AST, or HIR
* [ ] make functions independent of their order in top-level scope
* [x] support importing other files (`use`)
* [x] namespaces/modules including visibility modifiers
* [ ] IDE support:
* [ ] completion, completion resolve
* [ ] hover
* [ ] signatureHelp
* [x] ~~declaration~~, definition, ~~typeDefinition~~
* [ ] implementation
* [x] references
* [x] documentHighlight
* [ ] documentSymbol
* [ ] codeAction, codeAction resolve
* [ ] codeLens, codeLens resolve, codeLens refresh
* [ ] documentLink, documentLink resolve
* [x] ~~documentColor, colorPresentation~~
* [ ] formatting
* [ ] rangeFormatting
* [ ] onTypeFormatting
* [ ] rename, prepareRename
* [x] foldingRange
* [ ] selectionRange
* [ ] prepareCallHierarchy
* [ ] callHierarchy incoming, callHierarchy outgoing
* [x] semantic tokens
* [x] ~~linkedEditingRange~~
* [ ] moniker
* [x] incremental compilation
* [ ] lists
* [x] structs
* [ ] sets
* [ ] text interpolation
* [x] constant evaluation
* [ ] fibers
* [ ] channels
* [ ] io
* [ ] random
* [ ] standard library
* [ ] pipe operator
* [x] auto-fuzzing
* [ ] "type" proofs
* [ ] testing
* [ ] fuzzing of the compiler itself
* [ ] clean up repo (delete a bunch of stuff!)
* [ ] package manager
* [ ] online playground
## Long-term TODOs

- Core
- io
- random
- timing
- environment variables
- HTTP, UDP
- compiler
- make functions independent of their order in top-level scope
- lists
- text interpolation
- fibers, channels
- patterns
- pipe operator
- "type" proofs
- fuzzing of the compiler itself
- package root marker
- package path dependencies
- performance
- multithreading
- object deduplication
- profiler
- memory representation
- inlining of ints/etc.
- size of an object
- heap management
- LLVM, WASM
- IDE support:
- generate debug files
- [ ] completion, completion resolve
- [ ] hover
- [ ] signatureHelp
- [x] ~~declaration~~, definition, ~~typeDefinition~~
- [ ] implementation
- [x] references
- [x] documentHighlight
- [ ] documentSymbol
- [ ] codeAction, codeAction resolve
- [ ] codeLens, codeLens resolve, codeLens refresh
- [ ] documentLink, documentLink resolve
- [x] ~~documentColor, colorPresentation~~
- [ ] formatting
- [ ] rangeFormatting
- [ ] onTypeFormatting
- [ ] rename, prepareRename
- [x] foldingRange
- [ ] selectionRange
- [ ] prepareCallHierarchy
- [ ] callHierarchy incoming, callHierarchy outgoing
- [x] semantic tokens
- [x] ~~linkedEditingRange~~
- [ ] moniker
- packages
- logging
- HTTP Server
- Markdown
- custom binary serialization
- Cap'n Proto
- DateTime?
- SI?
- MongoDB?
- package manager
- online playground
- clean up repo (delete a bunch of stuff!)

## Short-term TODOs

- casing of module names
- fix fault attribution
- rearchitect tracing
- new name?
Expand All @@ -137,7 +155,6 @@ Major milestones:
- distinguish packages from normal modules
- complain about comment lines with too much indentation
- develop guidelines about how to format reasons
- module files: `.candy` vs `_.candy`?

## How to use Candy

Expand Down
1 change: 1 addition & 0 deletions compiler/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ tower-lsp = "0.17.0"
tracing = "0.1"
tracing-subscriber = { version = "0.2.0", features = ["registry"] }
unicode-segmentation = "1.9.0"
url = "2.2.2"

[target.x86_64-unknown-linux-gnu]
linker = "/usr/bin/clang"
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/compiler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ These are the compiler stages:
* LIR ("Low-level Intermediate Representation"): An instruction code for a stack-based virtual machine.

Note that if an error occurs in a compilation stage, we don't immediately abort but rather just try to contain the error in a subtree of the code and emit an error node.
This means that even if you have a syntax error (missing parentheses, etc.), the tooling in other parts of the source still works – including autocompletion, edit-time evaluation, formatting, etc.
This means that even if you have a syntax error (missing parentheses, etc.), the tooling in other parts of the source still works – including auto-completion, edit-time evaluation, formatting, etc.
You can even *run* the code – it will simply panic during runtime if it encounters the part with the syntax error.
2 changes: 2 additions & 0 deletions compiler/src/compiler/comment/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod rcst;
pub mod string_to_rcst;
Loading