0.0.1 • Published 4 years ago

samuellang v0.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

SamuelLang

The SamuelLang project's goal is to create an easy-to-use language that compiles directly to server-side (ExpressJS) Javascript, making it easy to build server-side apps. The handlebars templating engine is built-in.

Download

npm install samuellang

This command installs the globally available spm, samuel, and samuelit commands.

Commands

SPM

The Samuel Package Manager. Easily install 'Pages' from other's routes if they have been published to the SPM. To use packages you'll need to create a samuel.toml configuration file.

spm init

Then, edit the samuel.toml file to add all your dependencies. Then run:

spm install

Samuel

The samuel command compiles and executes a SamuelLang file. For example:

samuel main.samuel

SamuelIt

SamuelIt is the SamuelLang built-in IDE. When you use the samuelit command, you're launching the IDE.

Language Spec:

The language takes inspiration from the TOML format.

Structure of an app

Each program is called an app. Within an app there are pages, similar to routes. Pages are defined like so:

</>
  // Code here...
</about>
  // Code here...
</contact>
  // Code here...
</play>
  // Code here...

Each page has a set of actions under it. These actions are very simple.

</>
  // You may use the following as many times as you like, but they must come before an end-of-block statement:
  var: bar = eval '' // Execute JavaScript code
  // You may use only one of the following, and they must end a page block:
  send: beep // Send the word beep back as a plaintext response
  json: { foo: "bar", beep: true } // Send back JSON data
  show: foo // Display the 'foo' view with no data
  showd: foo { foo: bar } // Display the foo view with the data foo set to the variable bar