A language specifically tailored for writing clean solutions for Advent of Code.
Warning
It is currently in a very early, exploratory stage.
The idea of creating Linefeed was born when I did Advent of Code 2024, where I wanted a language specifically tailored for writing clean solutions for Advent of Code:
- It's a reference to having to read and print lines of text, each separated by a line feed.
- It's a nod to the Christmassy origin of Advent of Code. The common acronym for line feed is LF, which sounds like elf.
To demonstrate the syntax and features of Linefeed, solutions for Advent of Code 2020 have been implemented in Linefeed. They can be found in tests/linefeed/advent_of_code_2020.
I've also included a syntax-highlighted sample snippet in the bottom of this README.
Linefeed includes an LSP server that provides semantic token highlighting.
From the root of the repository:
cargo install --path linefeed-lspExample configuration for Neovim (using astrolsp):
linefeed_lsp = {
cmd = { "linefeed-lsp" },
filetypes = { "linefeed" },
root_dir = require("lspconfig.util").root_pattern "*.lf",
on_attach = function(client, bufnr)
-- Enable semantic token highlighting if server supports it
if client.server_capabilities.semanticTokensProvider then
vim.lsp.semantic_tokens.start(bufnr, client.id)
end
end,
}See #1 for a tracking issue.
Linefeed includes a built-in VM profiler to analyze runtime performance. Enable it by compiling with the profile-vm feature:
cargo run --bin linefeed --features profile-vm -- your_program.lfThis prints a summary to stderr showing:
- Instruction frequency and timing
- Source code hotspots
- Function call statistics
To export full (non-truncated) profiler data to a file, set the LINEFEED_PROFILE_OUTPUT environment variable:
LINEFEED_PROFILE_OUTPUT=profile.txt cargo run --bin linefeed --features profile-vm -- your_program.lfFor completeness sake, here's a sample Linefeed snippet with syntax highlight (from the language server):
