Skip to content

PremadeS/shakespeare-plus-plus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shakespeare++

In the realm of code, Shakespeare++ doth reign, a language so tender, that toucheth the very heart, With words most noble and syntax most poetic, it transforms the art of programming into a sonnet of logic and elegance.

Prithee, try our VSCode extension.

And verily, explore our online playground.

Installation

Ensure thy Node.js hath been setup upon thou device

For Linux and Mac

Open thy terminal and inscribe thy following command:

npm install -g shakespeareplusplus

Shouldst thou be met with a permission error, thou might need to prefix the command with sudo to grant it proper authority.

sudo npm install -g shakespeareplusplus

For Windows

Open thy Powershell in administrator mode and inscribe thy following command:

 npm install -g shakespeareplusplus 

Execute thy command to run thou script

Set-ExecutionPolicy RemoteSigned

Learneth more about Powershell ExecutionPolicy

Invoke this command to discern the location of Node.js upon thine system, and thus add it to thy Path Environment Variable (add the "folder" where node.js is installed)

node -p "process.execPath"

Run

To commence thy execution of thou script

In Repl Mode:

shakespeare++

Execute a (.spp) file:

shakespeare++ <filename>

Syntax

Variable Declaration

granteth yonder varName withUtmostRespect

Variable Initialization

granteth yonder varName equivalethTo value withUtmostRespect

Constant Initialization

  steadFast yonder varName equivalethTo value withUtmostRespect

Array Initialization

granteth yonder arr[] equivalethTo {10 20 "30" ...} withUtmostRespect

Accessing Array

Access first element

arr addethPolitelyWith 0

Access second element

arr addethPolitelyWith 1

Function

summonThouMechanism function(parameter1 invokeThouComma parameter2...) {
	<statements>
	<last statement will automatically be returned
}

Demonstration: Behold! thy sum of two numerical values

summonThouMechanism sum(x invokeThouComma y){
	x addethPolitelyWith y
}

Object initialization

granteth yonder obj equivalethTo {
	shake summonThyColon 10 invokeThouComma
	speare summonThyColon "plusplus" invokeThouComma
	sum summonThyColon summonThouMechanism s(x invokeThouComma y) {
		x addethPolitelyWith y
	} 
} withUtmostRespect

printethThouWordsForAllToSee(obj fullethStop shake)
printethThouWordsForAllToSee(obj fullethStop speare)
printethThouWordsForAllToSee(obj fullethStop sum(10 invokeThouComma 20))

For Loop

will runneth thy loop 10 times

forsoothCyclethThroughThyRange(
    granteth yonder i equivalethTo 0 withUtmostRespect
    i `lessThanThou` 10 withUtmostRespect
    i equivalethTo i addethPolitelyWith 1 withUtmostRespect) {
	<statements>
}

Note: don't forget the `` in lessThanThou

While Loop

whilstThouConditionHolds(*condition*) {
	<statements>
}

If Statement

providethThouFindestThyConditionTrue(*condition*) {
	<statements>
}

Else Statement

elsewiseRunnethThis {
	<statements>
}

If Else Statement

providethThouFindestThyConditionTrue(*condition*) {
	<statements>
} elsewiseRunnethThis {
	<statements>
}

If Else If Statement

providethThouFindestThyConditionTrue(*condition*) {
	<statements>
} elsewiseRunnethThis providethThouFindestThyConditionTrue(*condition*) {
	<statements>
}

Null

ashollowAsAFoolsHead

False

asFalseAsAFlimsyFabric

True

asTrueAsTheLightOfDay

Binary Operators:

=

equivalethTo

+

addethPolitelyWith

-

subtractethPolitelyWith

*

multiplethPolitelyWith

/

dividethPolitelyWith

%

modulethPolitelyWith

Comparsion:

Note: Don't forget the ` at the start and end

&&

`andeth`

||

`either`

==

`equivalethTo`

!=

`notEquivalethTo`

<

`lessThanThou`

>

`greaterThanThou`

<=

`lessThanEquivalethToThou`

>=

`greaterThanEquivalethToThou`

Others:

.

fullethStop

,

invokeThouComma

:

summonThyColon

Statement Terminator

withUtmostRespect

calculationShenanigans Object:

abs()

calculationShenanigans fullethStop unveilThyAbsoluteWorth(value)

sqrt()

calculationShenanigans fullethStop revealThouRootsWhimsy(value)

random()

calculationShenanigans fullethStop witnessThisErrantDigit(min invokeThouComma max)

log2()

calculationShenanigans fullethStop logOfTwosMeasure(value)

log10()

calculationShenanigans fullethStop logOfTenFold(value)

max()

calculationShenanigans fullethStop greatestOfThemAll(val1 invokeThouComma val2...)

Note: can take any number of arguments

min()

calculationShenanigans fullethStop littlestOfThemAll(val1 invokeThouComma val2...)

Note: can take any number of arguments

Time:

revealThyTime()

Note: returns the current timestamp in milliseconds since (January 1, 1970, 00:00:00 UTC)

Input:

inputString()

readethThineStringInput()

inputNum()

readethThineNumInput()

Import Other (.spp) Files:

summonYonFile("filename.spp")

Comments:

scribeThyThoughtsInSecretLines
*anything*
endethSecretLines

Honours

  • Thanks be unto thee, tylerlaceby, for the wondrous series thou hast bestowed.

  • Gratitude be unto thee, FaceDev, for the inspiration thou hast bestowed.

About

Lo! A merry tongue, spun with TypeScript's magic!

Topics

Resources

License

Stars

Watchers

Forks