Show HN: Larksson-lang: everything is a map or an atom

arthurzhu291 pts0 comments

GitHub - arthurzhu29/larksson · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

arthurzhu29

larksson

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>11 Commits<br>11 Commits

src

src

.gitignore

.gitignore

Cargo.lock

Cargo.lock

Cargo.toml

Cargo.toml

README.md

README.md

REFERENCE.md

REFERENCE.md

sample.larks

sample.larks

syntax-sugar.md

syntax-sugar.md

View all files

Repository files navigation

" href="#name-formerly-larksson">

A small homoiconic language: programs and data have the same shape because they are the same thing.

lines!<br>.ops.add. = { args: { left: 2, right: 3 }, return: 0, trigger: 0 }<br>.var.sum. = (.ops.add.return.)

That runs 2 + 3, stores 5 in .var.sum., and dumps the final state of root. Three things to notice: add is a value with a particular shape, the assignment to a key called trigger is what causes computation to happen, and the result is read back through a path. Every operation works this way.

The conceit

There are exactly two kinds of values: integers and maps. Strings are maps from indices to character codes. Arrays are maps from indices to their elements. Paths are maps from indices to their components. Programs are maps from indices to statements. Statements are maps from indices to their parts. There is no notion of "expression" separate from "data" because the language doesn't have one — there's just data, and a few places where the runtime interprets it.

This pays off when you want to construct a program at runtime and execute it. You build it as a map. You hand it to run. That is the whole story.

Running it

cargo run -- sample.larks

Reads from the given file, or from stdin if no path is given. The final state of root prints to stdout when the program finishes.

More

The full reference is in REFERENCE.md. Start there if you want to write something.

About

No description, website, or topics provided.

Resources

Readme

Uh oh!

There was an error while loading. Please reload this page.

Activity

Stars

stars

Watchers

watching

Forks

forks

Report repository

Releases

No releases published

Packages

Uh oh!

There was an error while loading. Please reload this page.

Contributors

Uh oh!

There was an error while loading. Please reload this page.

Languages

Rust<br>100.0%

You can’t perform that action at this time.

from reload maps search cargo indices

Related Articles