Skip to content
/ Zac Public

Interactive scripting language where you can change the comments. Winning entry for langjam0001

Notifications You must be signed in to change notification settings

sumeet/Zac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

The experience is better locally though, read on!

GoL

Since this is an interactive editor, the best examples are moving use cases.

Built-in Help

help

Workbook style examples that don't go out of sync

fib

Cargo Install Instructions

Make sure you have the Cargo package manager with a recent nightly Rust, and from inside this directory:

cargo install --path .

How To Run

As an example, open examples/hello.zac in your editor. Then, run (preferably through your editor)

zac examples/hello.zac

(or if you're a Rust coder)

cargo build --release
target/release/zac examples/hello.zac

hello

More Examples

It's Better With Syntax Highlighting

If you're using Vim, there's a syntax file 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:

:map \t :w\|:!zac %<CR>:e<CR><CR>

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 comment modification, Zac is a familiar-looking scripting language.

Comments come in two flavors, anonymous and named.

// 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.

let #changeme = // some string

// #changeme
// This is a comment with the name #changeme.
// 
// In this program, it is modified twice, once above and once below
// using the `let` expression.
//
// After running this program, this comment will instead contain:
// // some string another string

let another_string = // another string
let #changeme = cat(#changeme, chr(32), another_string)

// Named comments can be changed before and/or after they appear in the source code. Zac will throw
// an error if there are two comments in a program with the same name.

As of now, there is no specific syntax for string literals, if you need a string literal, you can make a comment.

Status

This is a proof-of-concept I made in the first Lang Jam, a 2-day competition to design a programming language around the theme first-class comments.

Submitted to the contest under the team name SOLDIER.

About

Interactive scripting language where you can change the comments. Winning entry for langjam0001

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published