jsgo is parser for some of javascript features in Go-lang. It is for education purpose only and is done as a practice project.
- Variable declarations using
let,varandconst
let a = 10;
var b = 20;
const c = 30;- Functions and Arrow functions
function hello(name) {
return "Hello " + name;
}
const hello = (name)=> {
return "Hello " + name;
}- Supported data-types are
undefined,number,stringandnumber - String templates
const name = "John";
const greeting = `Hello ${name}`;- Supported Operators
// Mathematical Operators
+ // PLUS
- // MINUS
* // ASTERISK
^ // POWER
% // MODULUS
/ // SLASH
// Mathematical Assignment Operators
+=
-=
*=
^=
%=
/=
// The dot operator -> Member Expression in the AST
one.two.three.four
// The Spread operator
...x
// Boolean Operators
a == b
a != b
a || b
a && b
// Ternary Operator
a ? b : c- Objects
// Maybe implemented as a Map<Identifier, Expression>
let person = {Name: "Jane", Age: 20, Friend: {Name: "Jane", Age: 30}}
p = {...person, Name: "Henry"}
// Object Destructuring in function params
function hello({Name: _name}) {
return `Hello ${name}`;
}- Arrays
let grades = [10,20,30];
[a,b,c] = grades;- String Templates
let name = "Hellen";
let greeting = `Hello ${name}`;-
for,do-whileandwhileloops -
if,elseandif-elsestatements -
swithc-casestatements -
in-builtfunctions and objects
console.log("Hello World")