npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

impl-lang

v0.0.4

Published

Homoiconic language with minimal syntax compiling to JavaScript

Downloads

12

Readme

Impl npm version Build Status js-standard-style Gitter

This is a work in progress, the npm CLI will simply parse an Impl file and give you the JavaScript data structure right now. JavaScript code generation is obviously up next, but the reader works really well so far.

Homoiconic language with minimal syntax compiling to JavaScript.

This is essentially a toy language that's supposed to be an exercise in simple parser / compiler / language design. It's inspired by Clojure among other Lisps. The immutable persistent data structures are provided by the excellent ImmutableJS.

Some day I hope to make this language self hosting with a compiler written in Impl. I'd also like to create a React wrapper and attempt some web development with it.

Getting started

# Install the package globally.
npm install -g impl-lang

# Pipe an Impl file through the compiler.
impl < samples/fib.impl > fib.js

# Execute the compiled JavaScript!
node fib.js

# Or even compile and execute in one command.
impl < fib.impl | node

If you're working on Impl

# Fetch the dependencies. (or npm install)
make bootstrap

# Run the tests. (runs standard linting and tape tests)
make test

# Or run the tests continually.
make test-watch

Syntax

The syntax is essentially a Lisp with implied parenthesis based on new lines and indentation levels. Each line is a new list which is a child of the list at the previous level of indentation. Reducing the indentation level closes the lists. You can create a tree of lists by continually creating new lines and further levels of indentation (indentation is defined as two spaces).

There are four special characters that allow you override the implicit lists where it makes sense so you don't have to rely on new lines and indentation in every situation.

  • : - Start a child list until the end of the line.
  • ; - Break out of the current list.
  • , - Equivalent to ;:, break out and create a new sibling list until the end of the line.
  • \ - Escape the next character, even if it's a new line or one of the previous special characters. This causes the reader to skip the next character no matter what.

When writing an if that makes a call to a function, for example, you can use these special characters to make it a little more concise.

if
  some-fn "arg for some-fn"
    ; 10
    +
      fn-a
      fn-b

Becomes...

if: some-fn "arg for some-fn"
  ; 10
  +: fn-a, fn-b

; is used to close the list created by the new line, so it becomes just the value 10, which will not be executed. This allows you to return actual values as leaf nodes of the list tree. Here's a Fibonacci function as another example.

fn fib: n
  if: < n 2
    ; 1
    +
      fib: - n 2
      fib: - n 1

You could join the fib calls onto one line with +: fib: - n 2;, fib: - n 1, but keeping them on separate lines is far clearer. Here's one more example, this one takes a list of people, extracts their names and then filters out those longer than 10 characters.

fn short-names: people
  filter
    map people
      fn: person, get person "name"
    fn: name
      <: len name; 10

All lists are executed like Lisp, the first item is presumed to be a function. You must use ; to return single values.

Also, I lied, there's a fifth character, #. As you may have guessed, this is a comment, it skips the rest of the line and moves onto the next. You can also escape it if you so wish.

Integration

I've created vim-impl to provide some default buffer local settings, syntax detection and highlighting.

Author

Oliver Caldwell (@OliverCaldwell)

Why the name Impl?

Warning: Dubious reasons for this name will follow. My project just needed a name which sounded quite nice and was fairly unique.

  • There's implied lists everywhere
  • It's simple
  • I wanted it to be similar to Lisp (List Processing)

Unlicenced

Find the full unlicense in the UNLICENSE file, but here's a snippet.

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

Do what you want. Learn as much as you can. Unlicense more software.