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

js-ds-language-framework

v1.2.0

Published

<div> <h3> <em> Create your own truly amazing programming language from scratch. :heart: </em> </h3> </div> <div> <h4>First of all, DSLanguage.Framework has two main subsystems</h4> <ul> <li> <a href="#scanner-s

Downloads

2

Readme

DSLanguage.Framework

Scanner subsystem

This subsystem translates given text to an stream of tokens. It is necessary intermediate step for building AST (abstract syntax tree).

You can plug in this subsystem into your code as: import * as Scanner from '<path-to-framework>/DSLF.Scanner'

This subsystem has such public components:

Scanner.Token

  • Scanner.Token is the namespaces that contains basic definition for Token
  • Token is an object that contains specific information about language symbol
  • Members:
    • namespace Types
      • class Base - basic definition for type of token
      • class Basic - most frequently used types of token
    • namespace Information
      • interface Base<T> - basic definition of additional information about token
      • namespace Defaults - most frequently used types of additional information about token
        • class Placement - class that have information about token's placement
    • type Base - basic definition of token
      • type: Token.Types.Base - type of token
      • value: Token.Value - value of token
      • placement: Token.Information.Defaults.Placement - information about placement of symbol

Scanner.Types

  • Scanner.Types is the namespace that contains basic type declarations that necessary for scanner
  • Members:
    • type Cursor
    • type Accumulator

Scanner.Component

  • Scanner.Component is the basic definition for scanner component
  • Components are main functional parts of scanner (a.k.a "subscanners")
  • Members:
    • Scan(context: Scanner.Context, cursor: Scanner.Commons.Cursor): Scanner.Token.Base | void - scanning strategy

Scanner.Context

  • Scanner.Context is the basic definition for context, where components of scanner can share some information

Scanner.Base

  • Scanner.Base is the type of scanner itself
  • This class has two main methods to use:
    • Scan(input: string): Scanner.Token.Base[] - scans input by customisable handler
    • AddHandler(handler: Scanner.Handler): void - adds customisable handler

Parser subsystem

This subsystem translates given stream of token to AST (abstract syntax tree).

You can plug in this subsystem into your code as: import * as Parser from '<path-to-framework>/DSLF.Parser'

This subsystem has such public components:

Parser.Types

  • Parser.Types is the namespace that contains basic type declarations that necessary for parser

Parser.Nodes

  • Parser.Nodes is the namespace that contains basic definitions for nodes
  • Node is an element of AST (abstract syntax tree).
  • Members:
    • interface Base - basic definition of node
    • interface Translatable - definition for translatable node
      • Translatable.Translate(): string - translation strategy
    • interface Executable<T> extends Base - definition for executable node
      • Executable.Execute(context: Parser.Nodes.Additional.Context): T - execution strategy
    • namespace Default - namespace that contains default nodes realisations
      • namespace Default.Block
      • namespace Default.Primitives
    • namespace Additional
      • interface Context

Parser.Components

  • Parser.Components is the namespace that contains basic definitions for components
  • Components are the main functional parts of the parser (a.k.a "subparsers"). The main purpose of the components is generation AST (abstract syntax tree)
  • Members:
    • interface Base<T extends Parser.Nodes.Base> - definition for basic component
      • Base.Parse(environment: Environment<T>): T - parsing strategy

Parser.Layers

  • Parser.Layers is the namespace that contains basic layer definition
  • Members:
    • abstract class Base<T extends Parser.Nodes.Base> - is a part of recursive descent parsing
      • ExecuteSuccessorParser(): T - method that calls successor layer parser
    • abstract class WithReferenceToTop<T extends Parser.Nodes.Base> - is the same as Parser.Layer but with reference to top layer
      • ExecuteSuccessorParser(): T - method that calls successor layer parser
      • ExecuteTopParser(): T - method that calls top layer parser

Parser.Base

  • Parser.Base is the type of parser itself.
  • This class has two main methods you can use:
    • UseTerminal(parser: () => Parser.Component.Base<T>): void - methods that adds terminal expression parsers to base parser
    • Use(priority: number, parser: () => Parser.Component.Base<T>): void - method that adds non-terminal expression parsers to base parser with given priority (bigger priority = less priority)
    • Parse(): T[]

Examples of usage

Go to file Examples/Example.ts and look at how this used for create your own programming language

How to download and configure this package

  1. Go to folder with your project
  2. Open terminal in this folder
  3. Type npm install js-ds-language-framework --save-dev
  4. You're ready! Enjoy :heart:

This package created by Saitov Denis