Syntax & Symbols

How It Works

NoShift.js uses ^ (caret) as a prefix to represent shifted symbols. The mapping is based on a Japanese JIS keyboard layout.

Symbol Map

This symbol mapping is based on the NoShift.js developer's keyboard (JIS layout).

Developer's Keyboard
Shifted Key NoShift.js
! ^1
" ^2
Capitalize ^3
$ ^4
% ^5
& ^6
' ^7
( ^8
) ^9
^ (Caret/XOR) ^0
= ^-
Shifted Key NoShift.js
~ ^^
| ^\
` ^@
{ ^[
} ^]
+ ^;
* ^:
< ^,
> ^.
? ^/

Template expression: ^4^[${

Capitalize Modifier

^3 capitalizes the next character. Useful for class names, constants, etc.:

class ^3animal ^[
  constructor^8name^9 ^[
    this.name ^- name;
  ^]
^]

Compiles to:

class Animal {
  constructor(name) {
    this.name = name;
  }
}

Comments

Line comments use // as usual. Block comments use /^: to open and ^:/ to close:

// line comment

/^: block comment ^:/

/^:
  multi-line
  block comment
^:/

Compiles to:

// line comment

/* block comment */

/*
  multi-line
  block comment
*/

Escaping in Strings

Inside string literals (^2...^2, ^7...^7, ^@...^@), ^ sequences are not converted to shifted symbols. This allows you to include literal ^ characters:

^2^5^2
^7^5^7
^@^5^@

Compiles to:

"^5"
'^5'
`^5`

Template Literals

Template literals use ^@ (backtick) and template expressions use ^4^[ (${) to start and ^] (}) to end:

^@^5^4^[^2Hello World!^2^]^@

Compiles to:

`^5${"Hello World!"}`

Bitwise & Shift Operations

JavaScript's bitwise operators work in NoShift.js using existing ^ sequences. The XOR operator (^) uses ^0 since the caret character is the NoShift.js prefix:

// XOR: ^0 --> ^
const a ^- 5 ^0 3;

// XOR assignment: ^0^- --> ^=
let b ^- 7;
b ^0^- 3;

// AND: ^6, OR: ^\, NOT: ^^
const c ^- 5 ^6 3;
const d ^- 5 ^\ 3;
const e ^- ^^5;

// Left shift: ^,^,  Right shift: ^.^.
const f ^- 1 ^,^, 3;
const g ^- 8 ^.^. 1;
const h ^- -1 ^.^.^. 0;

Compiles to:

// XOR: ^0 --> ^
const a = 5 ^ 3;

// XOR assignment: ^0^- --> ^=
let b = 7;
b ^= 3;

// AND: ^6, OR: ^\, NOT: ^^
const c = 5 & 3;
const d = 5 | 3;
const e = ~5;

// Left shift: ^,^,  Right shift: ^.^.
const f = 1 << 3;
const g = 8 >> 1;
const h = -1 >>> 0;

Hello World

Input:

console.log^8^2^3hello ^3world!^2^9;

Output:

console.log("Hello World!");