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

domy-lang

v1.0.0

Published

Do My Language

Downloads

11

Readme

The Domy Language

Overview

Domy is a simple boolean-centric language.

In terms of language design, Domy shares features from both imperative and functional programming paradigms, supporting functions as first class citizens and state.

Core Ideas:

  • Only boolean values exist
  • Every construct has an equivalent boolean value

Installation

Domy runs as a command line application on node.js (REPL and File Path Mode both available).

Usage: domy <filePath.do>?

Requires npm or yarn:

npm i -g domy-lang
yarn global add domy-lang

Implementation

The Lexer is inspired by Bob Nystrom's Crafting Interpreters Book chapter on Scanning.

The Parser is handmade and based on the grammar defined below, as I could not understand the TDOP Parser enough to implement it myself.

The Interpreter is a simple handmade tree walker that runs the generated parse trees.

EBNF Grammer Definition

program
   : statement*
   ;
statement
   : expression
   | 'my' id '=' statement
   | id '=' statement
   ;
expression
   : or
   | or '==' expression
   | or '!=' expression
   ;
or
   : xor
   | xor '|' or
   ;
xor
   : and
   | and '^' xor
   ;
and
   : not
   | not '&' and
   ;
not
   : term
   | '!' term
   ;
term
   : true
   | false
   | break
   | continue
   | 'return' statement?
   | 'do' arg_list block
   | 'while' statement block
   | id
   | id inv_list
   | '(' statement ')'
   | '(' statement ')' '?' statement ':' statement
   | block
   ;
id
   : letter (dash | letter | number)*
   ;
arg_list
   : '(' (id ',')* id? ')'
   ;
inv_list
   : '(' (inv ',')* inv? ')'
   ;
inv
   : statement
   ;
block
   : '{' statement* '}'
   ;
letter
   : [a-z] | [A-Z]
   ;
dash
   : '-' | '_'
   ;
number
   : [0-9]
   ;
WS
   : [\s\r\n\t] -> skip
   | '#' .* '\n' -> skip
   ;

Updates

The Beginning - 12/12/2019

Ever since I took Principles of Programming Languages in Fall 2018, I have been fascinated with learning about different programming language paradigms

Naturally, the ongoing search piqued my curiosity as to now implement my own language!

I quickly learned how to create a lexer, but when it came to parsing, I had no success regardless of how many articles and tutorials I completed.

My hope is that domy will be my first complete language, regardless of how esoteric the nature and value of it is.

Also, I had a crazy line of thought where everything returns a boolean value with no language constructs, but some of the constructs were still useful for my own sanity and for turing completeness.

MVP - 12/29/19

The language is now runnable, although there is no complete test suite as there is no language specification (so I expect tremendous amounts of undefined behavior).

It took me a long time to implement the keywords return, break, and continue, almost to the point of removing this element.

However, I realized my language would then only be boolean logic, which is pointless.

There is a great sense of relief now that I finished, as my previous languages were not even remotely close to being finished.

This journey felt like it took a lifetime although it really has been less than a month.

I am glad I am not burnt out towards the topic of programming languages and have finally reached the first milestone!

My next steps are to consider compilation, although I will first take a break to gather any new ideas and study up.

syall

Fun Fact: Domy got its name from the two language constructs do and my. Although they are not the only reserved words anymore, they were the inspiration for the name of the language.