-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwondering
92 lines (65 loc) · 3.01 KB
/
wondering
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
## Zac Programming Language
An interactive scripting language where you can read and modify code comments as if they were regular strings. Add and view text-based visualizations and debugging information inside your source code file.
### [Try it in your browser right away](https://sumeet.github.io/Zac/)
The experience is better locally though, read on!
![GoL](.README_assets/GoL.gif)
Since this is an interactive editor, the best examples are moving use cases.
#### Built-in Help
![help](.README_assets/help.gif)
#### Workbook style examples that don't go out of sync
![fib](.README_assets/fib.gif)
### Cargo Install Instructions
Make sure you have the [Cargo package manager](https://crates.io/) with a recent nightly Rust, and from inside this
directory:
```console
cargo install --path .
```
### How To Run
As an example, open [examples/hello.zac](examples/hello.zac) in your editor. Then, run (preferably through your editor)
```console
zac examples/hello.zac
```
(or if you're a Rust coder)
```console
cargo build --release
target/release/zac examples/hello.zac
```
![hello](.README_assets/hello.gif)
### More Examples
- [GoL.zac](examples/GoL.zac)
- [fib.zac](examples/fib.zac)
- [help.zac](examples/help.zac)
- [the in-browser version](https://sumeet.github.io/Zac/)
### Zac Language Overview
You'll have a better time getting a feel of how the language works from looking at and running examples than from reading detailed documentation. Other than the comment modification, Zac is a familiar-looking scripting language.
Comments come in two flavors, anonymous and named.
```js
// This is an anonymous comment because it doesn't have a #identifier as
// the first line.
//
// This cannot be referenced or modified from within the code.
```
```js
let #changeme = // some string
// #changeme
// This is a comment with the name #changeme.
let another_string = // another string
let #changeme = cat(#changeme, another_string)
// Named comments can be changed before and/or after they appear in the source code. It's an error
// when ther
//
// however,
```
As of now, there is no specific syntax for string literals, if you need a string literal, you can make a comment.
#### It's Better With Syntax Highlighting
If you're using Vim, there's a [syntax file](syntax_highlighting/) in the repo. Put this in your `~/.vim/syntax` directory, or `~/.config/nvim/syntax` if you're using Neovim, and follow the instructions at the top of the file.
#### Interactive Editing
It's highly recommended that you save the file from inside of your editor instead of changing windows. Zac is meant to be used like Gofmt or Rustfmt, run every time you save your file.
In Vim, you can use the following command to save your file:
```vim
:map \t :w\|:!zac %<CR>:e<CR>
```
### Status
This is a proof-of-concept I made in the first [Lang Jam](langjam/langjam), a 2-day competition to design a programming language around the theme `first-class comments`.
Submitted to the contest under the team name SOLDIER.
<img src=".README_assets/firstclass.png" height="100px">