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

baguette

v0.1.10

Published

an extremely light-weighted scripting language designed for javascript

Downloads

14

Readme

Baguette

Baguette is an extremely light-weighted scripting language for conversation-based javascript game development.

Getting Started

Installing

install npm

sudo apt-get install npm

then install baguette

npm install -g baguette

hello world

Baguette contains two things: a compiler and a virtual machine.

compiler

Suppose we have a piece of baguette code like below:

function helloworld()
{
  a = 1+ 2 * 3;
  print("Hello World!");
  print("a="+a);
  return a;
}

We save it in helloworld.bag. Then we use the compiler - bcc, to compile it to baguette's inermediate code (.bic):

bcc helloworld.bag -o helloworld.bic

virtual machine

Baguette's virtual machine is baguette-vm.js. You can use it in any of your javascript project.

Let's run our code with node.js.

Create an npm project, and copy baguette-vm.js into the folder

mkdir baguette-helloworld
cd baguette-helloworld
npm init
cp {baguette-vm.js directory} .

Create a helloworld.js like below:

var fs = require('fs');
var BaguetteVM = require('.baguette-vm').BaguetteVM;

let gameStats = {
  a: 1,
  b: 2,
  c: 3,
};

let gameFuncs = {
  print: {
    pauseAfterComplete: false,
    funcImp: (text) => console.log(text),
  }
};

let content = fs.readFileSync('helloworld.bic', 'utf8');
let baguetteVM = new BaguetteVM(content, gameStats, gameFuncs);
let result = baguetteVM.runFunc('helloworld');

Basically, to run a baguette virtual machine, you need three things - the code (.bic file), the environment variavbles, and the environment functions.

Environment variables are defined before running the vm. Because baguette cannot define local or global variables (yet), any variable used in the code must be defined as environment variables. This is also the way the vm interact with its host.

Environment functions are also functions defined in the host. They usually contains UI functions. Among all properties of a function, pauseAfterComplete means the vm stops after this function call. User must call vm.continue() to continue running the bic code. This is used in UI functions like showText, print, etc.

Finally, run the project:

node helloworld.js

And you get the output:

Hello World!
a=7

Running the tests

Explain how to run the automated tests for this system

Break down into end to end tests

Explain what these tests test and why

Give an example

And coding style tests

Explain what these tests test and why

Give an example

Deployment

Add additional notes about how to deploy this on a live system

Built With

  • Dropwizard - The web framework used
  • Maven - Dependency Management
  • ROME - Used to generate RSS Feeds

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • Hat tip to anyone who's code was used
  • Inspiration
  • etc