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

luke-lang

v0.0.29

Published

A programing language platform

Downloads

13

Readme

luke

luke as an abstract, extendable programming language and platform that allows custom syntax for domain specific solutions.

Important: The luke project is in early stage and under development. It's not yet production ready. If you'd like to contribute to the code or the module ecosystem, feel free to open a PR.

Table of contents

Resources

| Resource | Description | | ------------- |-------------| | Luke Website | Official website of the luke project | | Luke Module Catalog | Complete collection and documentation of luke modules |
| Luke on npm | Official npm package |
| Luke on GitHub | Official luke core repo |

Examples

Code

print "Starting luke program";

Modules

// 1. Use a module (local or remote)

use rest.luke.js;
use https://domain.com/rest.luke.js;

// 3. Use module-specific code

ns rest; // (set the module namespace)
POST {name "Hello"} to https://api.com/resource

Install

luke runs on JavaScript Engines and can be used on Node, Browsers and via it's CLI.

CLI

$ npm i luke --global

npm module

npm i luke --save

Browser

<script src="luke.js">

Usage

After you have installed luke via npm, you can use it in your terminal as an interactive CLI or run your luke script files

Interactive Shell

$ luke
$ print "Hello World!"
"Hello World"

You can also include existing luke files into your interactive shell:

$ luke include main.luke

Run a File

// hello.luke
print "I am a luke file"
$ luke run hello.luke
"I am a luke file"

Embedded (JavaScript)

luke scripts can also be run inside JavaScript:

// For Node.js
const luke = require('luke-lang');

// For browsers:
<script src="luke.js"/>
luke.parse('print "Hello, I am embedded"')

Language

The luke language aims to provide simple language to build solutions that are taylored for different domains and problems.

The main concepts of luke are:

  • Simple language design, understandable for developers and non-developers
  • Custom syntax creation
  • Open and free platform for syntax modules

language architecture

Check out the Modules

Default module

luke comes with a built-in default module, which is initalized by default. The default module contains some basic functionalities.

Some code examples from the default module:

| Code | Description | | ------------- |-------------| | print "I'm a luke program" | Print something | | var color blue | Set a variable | | print color | Print variable content | | download https://....com | Download a file | | list modules | List all used modules | | list commands | List all commands from available modules |

Full reference

Syntax from the default namespace will automatically be available in any other module-specific namespace.

Custom syntax, modules

The luke language is a platform for different syntax. Each syntax ist delivered using a module. Basically any module syntax can be different, however they are all aimed at simplicity.

module packing

Create a syntax

Building your own custom syntax is fairly simple. It's defined using a JavaScript Object with a common structure.

lang = {
  $: {
    mymodule: { // your namespace name
      echo: {
        follow: ["{param}", "$and"],
        method: function(ctx, param){
          console.log(param)
        }
      },
      and: {
        follow: ["{param}", "$and"],
        method: function(ctx, param){
          console.log(param)
        }
      }
    }
  }
}
module.exports = lang;

The required keys and fields in your syntax definition are:

| Key | Description | Example | | ------------- |-------------| -----| | lang.$.NAMESPACE | The name of your moudle/namespace | example | | lang.$.NAMESPACE.TOKEN | Custom tokens | echo | | lang.$.NAMESPACE.TOKEN.follow | A list of possible tokens that can follow. | ["{param}", "$and"] | | lang.$.NAMESPACE.TOKEN.method | The function to be executed, when that token ist parsed | function(param){console.log(param)} |

Follow tokens can be defined as follows:

| Follow token | Description | | ------------- |-------------| | $and | Corresponds to the exact token without the leading dollar sign. | | {param} | A custom input of any type. This will be available as single parameter in your method: method: function(param){} | | {param1,param2} | Multiple custom inputs followed by another. These will be available as object parameter: method: function(obj){//obj.param1, obj.param2} |

Define your available tokens as keys under the "$" object. Each key has an attached method, which will be executed, when that token is parsed and an array follow, which defines, which tokens can follow the current token.

Following tokens

Following tokens can either be wildcards for user input ({param}) or another token, specified with a leading "$" (e.g. $and).

These instructions let you create token chains and build your own syntax.


|-------------- Statement ------------|

  echo    "Peter"   and  "Nicole"   ;

   ^        ^        ^      ^       ^
command  command  command command delimeter;

 $.echo  {param}   $.and  {param}

Publish syntax as module

Your custom syntax modules can be contributed to the official luke module repo.

Learn more: Luke Module Repo

License

luke is open source and released under the MIT License.

See the license