"The shape of a dog’s face suggests how long it will live. Dogs with sharp, pointed faces that look more like wolves typically live longer. Dogs with very flat faces, such as bulldogs, often have shorter lives.""A Great Dane named "Just Nuisance" is the only dog to have officially enlisted in the Royal Navy.""Dogs who have been spayed or neutered live longer than intact dogs.""More than 1 in 3 American families own a dog.""A Russian dog named Laika was the first animal in space, traveling around Earth in 1957."
"The shape of a dog’s face suggests how long it will live. Dogs with sharp, pointed faces that look more like wolves typically live longer. Dogs with very flat faces, such as bulldogs, often have shorter lives.""A Great Dane named "Just Nuisance" is the only dog to have officially enlisted in the Royal Navy.""Dogs who have been spayed or neutered live longer than intact dogs.""More than 1 in 3 American families own a dog.""A Russian dog named Laika was the first animal in space, traveling around Earth in 1957."
Home>Projects>

simon

Just a little playground for creating my own js dialect

SIMON

SIMONLANG

Hi my name is SIMON and this is a language I'm developing for fun. Have a look at the playground

Extensions

Installation

npm i [-g|-D|-S] @puresamari/simonlang

Usage

Compiling in js

Since the compiler is written in typescript I compiled a version you can use directly in js (as done in the playground) like this:

<script src="{{path to node_modules}}/lib/simonlang.js" defer></script>

or

<script src="https://raw.githubusercontent.com/puresamari/simon/master/lib/simonlang.js" defer></script>

to compile in js just use window.compile({{your code}}) after the above script is imported.

CLI

Once the simonlang cli is installed you can use the cli.

Compiling

to install the cli globally use

npm i -g @puresamari/simonlang

once it is installed you can use it to complie .simon files

simonlang [compile] FILENAME [-p, --print] [-o, --output OUTPUT_FILENAME] 

To compile .simon files into .js just run the compile. Writing compile is optional since its the clis default command.

Options

Thanks for stopping by and have a great day

!!!! SIMON !!!!


Language

Each line is declared with simon (the simon indicator) in the beginning. For example simon says ... or simon declares ...

Declarations

Primitive variables

A declaration is done by writing "declares" after the simon indicator and the variable name after (can be multiple words). After the variable name you can either write "is" or "are" for better semantics followed by the assigned value.

For example:

Operators

Mathematic operators

You can do mathematics in Simonlang (currently only while doing declarations)

Usage

To use mathematical operators just write chain as many of the below operators together. For example:

from:

simon declares variable with simple division is test variable divided by 10

to:

var simonvar_variable_with_simple_division = simonvar_test_variable / 10;

from

simon declares chained mathematical operators is 10 minus 10 plus 10 divided by variables are gr8 multiplied by test variable

to:

var simonvar_chained_mathematical_operators = 10 - 10 + 10 / simonvar_variables_are_gr8 * simonvar_test_variable;

Available mathematic operators:

Commands

Printing is done by writing "says" after the simon indicator

Mathematic commands (THIS IS STUPID AND WILL BE REMOVED)

Examples

Mathematical operation keywords:

Seperators:

Footer