Share your Programming Language Jam submissions here!

← Back to all posts
Nosh (Node + Bash)
AniruddhaPandey (3)

Introduction

Nosh is inspired by Bash piping, Python code style and clojure made on top of Node.js. This programming language in intended to be used for configuration with almost functional approach. We had Data flow paradigm in mind while creating this. This is made using the Ohm library for javascript.

Origin and Goals

Inspiration is taken form bash Unix shell where you can do pipe values into one another to generate some results, i.e this will give sorted unique names

$ cat names.txt | uniq | sort

And we want to translate this philosophy to our language.

This language is meant to be used on the web with Nosh Terminal which offers an alternative way for people to interact with the web content.

Imagine you have a personal website and want your users to have an option to do things programmatically like: subscribing to your newsletter, sorting your projects by name, etc.

Terminology

In this language we tried to introduced some new concepts. There are two major building blocks of the language.

1. Logic

Logics are equivalent to functions, variables, class, namespace, etc in other languages. Including conditional statements like if and else, there is no else if. for loop as repeat, etc. Any identifier word which is not a keyword in the language have a "<-" after it will be considered as a logic.

2. Data

Data is always a list of type Number, Text or Boolean. The below example are all valid

['hello']
[[1], [2], [3]]
[false]
[]

Examples

; In this example configuring some settings of the website

use <- site

; Output: 
; ['https://website.com']
site <- pages <- current

; Output:
; ['unsubscribed']
; ['subscribed']
show <- newsletter <- status
site <- newsletter <- ['subscribe', '[email protected]']
show <- newsletter <- status

; Output:
; [false]
; ['Error logging']
; [true]
show <- site <- account <- login <- status
site <- account <- login <- ['username', 'password']
site <- account <- signup <- ['username', 'password', '[email protected]']
show <- site <- account <- login <- status

; Output:
; ['light']
; ['dark']
show <- site <- style <- theme
site <- style <- ['dark']
show <- site <- style <- theme
; Given n, this program prints the nth fibonacci number  
; [34]

fibo <- void -> null
  <- err
fibo <- n -> null
  first <- [0]
  second <- [1]
  if <- n < [0]
    <- ['incorrect input']
  else <- n == [1]
    <- series <- first
  else <- n == [2]
    <- series <- second
  else <- [true]
    repeat <- [2, ..., n] -> i
      series <- first add second
      first <- second
      second <- series
    <- series

show <- fibo <- [9]

More examples can be found inside the examples/ directory on our repl!

Roadmap

Nosh isn't completed yet, we are still figuring out the core philosophy of the language and the ecosystem idea we have in our minds to code but you can still run some of the examples in the repl.
The main reason to make the nosh language is to be used inside the Nosh terminal that would be avaiable as a web component and you just use to add it in html like this:

<head>
  <script type="module" src="https://unpkg.com/@rednomads/nosh-terminal/dist/index.esm.js"></script>
</head>
<body>
  <!-- whole website code -->
  <nosh-terminal src="commands/" menu-bar="enable" type="text/nosh" allow="halfscreen" autostart dark />
</body>

A GIF illustrating how the terminal UI would look like

We also want our interpreter to be available as a npm package.

$ npm install nosh

And the API would look something like this:

const { interpreter } = require('nosh')
const output = interpreter.run(`
show <- ['Hello, World!']
`)

Source: https://repl.it/@RedMonads/nosh


This submission is made by team @RedMonads for the Repl lang-jam, where the language part is made by @jmanuel1 and designed by @AniruddhaPandey.

We're going to make this opensource and work on the roadmap along with developing this language more and we're looking for collaborators! If interested feel free to dm me on discord:pandevim#5847

Commentshotnewtop
drsensor (16)

That's remind me of nushell but in web component 😯

AniruddhaPandey (3)

@drsensor
Interesting we didn't know about this while making but I can see it highly overlaps our idea of Unix philosophy.

CodingCactus (3090)

Hi, what is this? Is it supposed to be a submission?