Skip to content

elonlit/Genesis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

32 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Genesis ๐ค

Open Source Love svg2

"My frame was not hidden from you, when I was being made in secret, intricately woven in the depths of the earth. Your eyes saw my unformed substance; in your book were written, every one of them, the days that were formed for me, when as yet there was none of them" 1

Genesis is an interpreted, procedural, and Turing-complete Paleo-Hebrew programming language. Diacritical signs are forgone for simplification, though maybe Nikud can be used in prospect as a means for more reserved keywords.

Keywords โ€ข Operators โ€ข Types โ€ข Control Flow โ€ข Subroutines โ€ข Data Structures โ€ข Utilities โ€ข FAQ


Valid Keywords

Lexeme ๐ค Equivalent(s)
Print ๐ค„๐คƒ๐ค๐คŽ
Print Line ๐ค„๐คƒ๐ค๐คŽ๐ค‡
Declare/Initialize Variable ๐ค„๐ค‚๐คƒ๐ค“
Declare Subroutine ๐ค๐ค…๐ค๐ค’๐ค‘๐ค‰๐ค„
If ๐ค€๐คŒ
Then ๐ค€๐ค†
While ๐ค๐ค๐ค…๐คƒ
For ๐ค๐ค๐ค…๐ค“
For Each ๐ค๐ค๐ค…๐ค“๐คŠ๐ค‹
Sleep ๐ค‰๐ค”๐ค
Consecrate ๐ค’-๐คƒ-๐ค”

The ๐ค’-๐คƒ-๐ค” keyword, meaning literally "to consecrate" or "to purify," denotes when the scope of a subroutine or loop terminates.

Operations, Punctuation Elements, & Identifiers

Java-style syntax and precedence are preserved for most operators:

+ - addition (numbers, strings)
- - subtraction (numbers)
/ - division (numbers)
* - multiplication (numbers)
^ - power (numbers)
= - assignment (numbers, strings)
== - logical equals (numbers, strings)
=! - not equal to (numbers, strings)
< - less than (numbers)
> - greater than (numbers)
=> - greater than or equal to (numbers)
=< - less than or equal to (numbers)
&& - logical and (booleans)
|| - logical or (booleans)

However, the associativity of most operators is from right-to-left:

๐ค„๐ค‚๐คƒ๐ค“ ๐ค๐ค… = ๐คŠืด๐ค‡ - ๐ค„ืณ // 23

Identifiers can be represented by alphanumeric text (including _) and do not have to start with an alphabetic character.

Data Types & Literals

Genesis is weakly and dynamically typed, so casting between primitives is handled implicitly by the interpreter. There are three data types:

  1. Number
    • Encompasses Bytes, Shorts, Integers, Longs, Doubles, and Floats.
  2. Boolean
    • Supports literals ๐ค€๐คŒ๐ค• or ๐ค”๐ค’๐ค“, which correspond to True or False, respectively.
  3. String
    • Delimited by quotation marks, e.g. "!๐ค”๐ค‹๐ค…๐คŒ ๐ค๐ค…๐ค‹๐คŒ".

The Paleo-Hebrew alphabet may have used gematria to denote cardinal values, although there is only evidence of this on the Samaria Ostraca and Dead Sea Scroll 4Q252. This quasi-decimal isopsephic number system is adopted for a lack of an academic consensus.

In this paradigm of numerology, there is no notation for zero, and the numeric values for individual letters are added together. Each unit (1, 2, ..., 9) is assigned a separate letter, each tens (10, 20, ..., 90) a separate letter, and the first four hundreds (100, 200, 300, 400) a separate letter. The later hundreds (500, 600, 700, 800, and 900) are represented by the sum of two or three letters representing the first four hundreds. To represent numbers from 1,000 to 999,999, the same letters are reused to serve as thousands, tens of thousands, and hundreds of thousands. Biblical pseudepigrapha use these transformations extensively. Standard (normative value) encoding per the conventional affine Mispar Hechrachi method of gematria is as follows:

Decimal Hebrew ๐ค Glyph
1 Alep ๐ค€
2 Bet ๐ค
3 Gimel ๐ค‚
4 Dalet ๐คƒ
5 He ๐ค„
6 Waw ๐ค…
7 Zayin ๐ค†
8 Het ๐ค‡
9 Tet ๐คˆ
10 Yod ๐ค‰
20 Kaf ๐คŠ
30 Lamed ๐ค‹
40 Mem ๐คŒ
50 Nun ๐ค
60 Samek ๐คŽ
70 Ayin ๐ค
80 Pe ๐ค
90 Sade ๐ค‘
100 Qop ๐ค’
200 Res ๐ค“
300 Sin ๐ค”
400 Taw ๐ค•

Gershayim ืด (U+05F4 in Unicode, and resembling a double quote mark) (sometimes erroneously referred to as merkha'ot, which is Hebrew for double quote) are inserted before (to the right of) the last (leftmost) letter to indicate that the sequence of letters represents a gematric sequence of at least two Hebrew numerals (e.g., 28 โ†’ ๐คŠืด๐ค‡ and 5782 โ†’ ๐ค•๐ค•๐ค•๐ค•๐ค•๐ค•๐ค•๐ค•๐ค•๐ค•๐ค•๐ค•๐ค•๐ค•๐ค•๐ค’๐คืด๐ค).

Similarly, a single geresh ืณ (U+05F3 in Unicode, and resembling a single quote mark) is appended after (to the left of) a single letter in the case where a number is represented by a single Hebrew numeral (e.g. 100 โ†’ ๐ค’ืณ).

Control Flow

"Seek the Lord while he may be found; call on him while he is near" 2

The standard suite of loop constructs is supported. An iterative implementation for generating the first ten terms of the Fibonacci sequence using a ๐ค๐ค๐ค…๐คƒ loop is formulated as an example:

๐ค„๐ค‚๐คƒ๐ค“ ๐คŒ๐คŽ๐ค๐ค“ = ๐ค‰ืณ
๐ค„๐ค‚๐คƒ๐ค“ ๐ค“๐ค€๐ค”๐ค…๐ค = ๐ค€ืณ
๐ค„๐ค‚๐คƒ๐ค“ ๐ค”๐ค๐ค‰๐ค„ = ๐ค€ืณ - ๐ค€ืณ
๐ค„๐ค‚๐คƒ๐ค“ ๐คƒ๐ค‹๐ค๐ค’ = ๐ค€ืณ - ๐ค€ืณ
๐ค„๐ค‚๐คƒ๐ค“ ๐ค†๐คŒ๐ค๐ค‰ = ๐ค€ืณ - ๐ค€ืณ

๐ค๐ค๐ค…๐คƒ ๐คƒ๐ค‹๐ค๐ค’ <= ๐คŒ๐คŽ๐ค๐ค“:
    ๐ค„๐คƒ๐ค๐คŽ๐ค‡ ๐ค”๐ค๐ค‰๐ค„
    ๐ค†๐คŒ๐ค๐ค‰ = ๐ค“๐ค€๐ค”๐ค…๐ค + ๐ค”๐ค๐ค‰๐ค„
    ๐ค“๐ค€๐ค”๐ค…๐ค = ๐ค”๐ค๐ค‰๐ค„
    ๐ค”๐ค๐ค‰๐ค„ = ๐ค†๐คŒ๐ค๐ค‰
    ๐คƒ๐ค‹๐ค๐ค’ = ๐คƒ๐ค‹๐ค๐ค’ + ๐ค€ืณ
๐ค’-๐คƒ-๐ค”

The following ๐ค๐ค๐ค…๐ค“ loop prints out the first ten natural numbers:

๐ค๐ค๐ค…๐ค“ ๐คŒ๐คŽ๐ค๐ค“=๐ค‰ืณ,๐คŒ๐คŽ๐ค๐ค“>=๐ค€ืณ,๐คŒ๐คŽ๐ค๐ค“=๐คŒ๐คŽ๐ค๐ค“-๐ค€ืณ:
    ๐ค„๐คƒ๐ค๐คŽ๐ค‡ ๐คŒ๐คŽ๐ค๐ค“
๐ค’-๐คƒ-๐ค”

To accomplish nested operations or anamorphism, it is recommended to do a composition of subroutines.

Subroutines

"'I AM THAT I AM'" 3

Functions in Genesis are declared using the ๐ค๐ค…๐ค๐ค’๐ค‘๐ค‰๐ค„ keyword. Being void and non-parameterized, however, they are actually subroutines. There is recursion insomuch that making a self-referential call from within a subroutine is possible, but there is no means to exit that recursion to express the irrevocable danger of pride and egoism. This design follows the contention that recursion, as Peter Deutsch identified, is divine and not encompassed by the domain of human programmers, as evidenced by God identifying himself recursively.

To call on a subroutine, use the reference name with which it was defined. The following subroutine ๐ค‡๐ค‰๐ค๐ค…๐ค“ approximates the gravitational force of a 290-gram KJV Compact Ultraslim Bible one meter from a 70-kg human being:

๐ค„๐ค‚๐คƒ๐ค“ ๐คŠ๐ค…๐ค‡ = (๐ค€ืณ / (๐ค‰ืณ ^ ๐ค‰ืด๐ค€)) * (๐ค•๐ค“๐คŽืด๐ค† / ๐ค’ืณ)
๐ค„๐ค‚๐คƒ๐ค“ ๐ค•๐ค…๐ค“๐ค„ = ๐คŠืด๐คˆ / ๐ค’ืณ
๐ค„๐ค‚๐คƒ๐ค“ ๐ค€๐คƒ๐คŒ = ๐คืณ
๐ค„๐ค‚๐คƒ๐ค“ ๐คŒ๐ค“๐ค‡๐ค’ = ๐ค€ืณ

๐ค๐ค…๐ค๐ค’๐ค‘๐ค‰๐ค„ ๐ค‡๐ค‰๐ค๐ค…๐ค“:
	 ๐ค„๐ค‚๐คƒ๐ค“ ๐ค„๐ค‡๐ค‰๐ค๐ค…๐ค“ = (๐คŠ๐ค…๐ค‡ * ๐ค•๐ค…๐ค“๐ค„ * ๐ค€๐คƒ๐คŒ) / (๐คŒ๐ค“๐ค‡๐ค’ * ๐คŒ๐ค“๐ค‡๐ค’)
	 ๐ค„๐คƒ๐ค๐คŽ ๐ค„๐ค‡๐ค‰๐ค๐ค…๐ค“
๐ค’-๐คƒ-๐ค”

๐ค‡๐ค‰๐ค๐ค…๐ค“

Other examples can be found in the respository.

Data Structures

Genesis provides fixed-length untyped array data structures. Curly braces are used to initialize arrays, and elements can be accessed or mutated through square bracket index operators:

๐ค„๐ค‚๐คƒ๐ค“ ๐คŒ๐คŽ๐ค๐ค“ = {๐ค€ืณ, ๐คืณ, ๐ค‚ืณ}

๐คŒ๐คŽ๐ค๐ค“[๐คˆืณ/๐คˆืณ] = ๐ค”๐ค’๐ค“

๐ค๐ค๐ค…๐ค“๐คŠ๐ค‹ ๐ค€๐ค‹๐คŒ๐ค๐คˆ, ๐คŒ๐คŽ๐ค๐ค“:
	๐ค„๐คƒ๐ค๐คŽ๐ค‡ ๐ค€๐ค‹๐คŒ๐ค๐คˆ
๐ค’-๐คƒ-๐ค”

As denoted, ๐ค๐ค๐ค…๐ค“ or ๐ค๐ค๐ค…๐ค“๐คŠ๐ค‹ looping an array will yield its values.

Math Library & Native Utilities

Function Description ๐ค Equivalent(s)
Sqrt(#) Returns the correctly rounded positive square root of a number value. ๐ค”๐ค…๐ค“๐ค”(๐ค)
Sin(โˆ ) Returns the trigonometric sine of an angle. ๐คŽ๐ค‰๐ค(๐คˆ)
Cos(โˆ ) Returns the trigonometric cosine of an angle. ๐ค’๐ค…๐คŽ(๐คˆ)
Tan(โˆ ) Returns the trigonometric tangent of an angle. ๐คˆ๐ค(๐คˆ)
ToDegrees(C) Converts an angle measured in radians to degrees. ๐ค‹๐คƒ(๐ค’)
ToRadians(โˆ ) Converts an angle measured in degrees to radians. ๐ค‹๐ค“(๐คˆ)
Absolute(#) Returns the absolute value of a number value. ๐ค๐คŒ๐ค‡(๐ค)
Log(#) Returns the natural logarithm (base e) of a number value. (๐ค)๐ค‹๐ค…๐ค‚
Exp(#) Returns Euler's number e raised to the power of a number value. (๐ค)๐ค€๐ค’๐คŽ๐ค
Ulp(#) Returns the size of an ulp of the argument. (๐ค)๐ค€๐ค…๐ค‹๐ค
PI() Returns ฯ€ rounded to double precision. ()๐ค๐ค‰๐ค‰
Random() Returns a number value greater than or equal to 0.0 and less than 1.0. ()๐ค“๐ค๐คƒ
Evince() Returns a random Bible quote. ()๐ค๐ค“๐ค€

Some calculations:

๐ค„๐ค‚๐คƒ๐ค“ ๐ค”๐คˆ๐ค‡ = ๐คƒืณ * ๐ค๐ค‰๐ค‰() * (๐ค‰ืด๐ค ^ ๐คืณ)
๐ค„๐ค‚๐คƒ๐ค“ ๐คŒ๐ค”๐ค…๐ค‹๐ค” = (๐ค€ืณ/๐คืณ) * (๐ค„ืณ * ๐คŽืด๐คƒ * ๐คŽ๐ค‰๐ค(๐คŒืด๐ค„))
๐ค„๐ค‚๐คƒ๐ค“ ๐ค’๐ค‹ = ๐ค”๐ค…๐ค“๐ค”(๐คŽืด๐คƒ) * ๐ค“๐ค๐คƒ()

๐ค„๐คƒ๐ค๐คŽ๐ค‡ ๐ค”๐คˆ๐ค‡
๐ค„๐คƒ๐ค๐คŽ๐ค‡ ๐คŒ๐ค”๐ค…๐ค‹๐ค”
๐ค„๐คƒ๐ค๐คŽ๐ค‡ ๐ค’๐ค‹

A subroutine for calculating the energy of an electron in the ๐ค-th orbital of a hydrogenic atom in Joules:

๐ค๐ค…๐ค๐ค’๐ค‘๐ค‰๐ค„ ๐ค€๐ค๐ค“๐ค‚๐ค‰๐ค„:
๐ค„๐ค‚๐คƒ๐ค“ ๐ค = ๐คืณ
๐ค„๐ค‚๐คƒ๐ค“ ๐ค‚๐ค€๐ค…๐ค‹ = ((๐ค‚ืณ * (๐ค‰ืณ ^ ๐ค‡ืณ)) * ((๐ค‰ืด๐ค€ / ๐ค‰ืณ) * (๐ค‰ืณ ^ ๐ค†ืณ)) * (((๐ค”ืณ + ๐ค”ืณ * ๐ค‰ืณ) / (๐ค•ืด๐ค’)) * (๐ค‰ืณ ^ (๐ค…ืณ - ๐คŒืณ))) * (๐ค€ืณ - ๐คืณ)) * (๐ค€ืณ / (๐ค * ๐ค))
๐ค„๐คƒ๐ค๐คŽ ๐ค‚๐ค€๐ค…๐ค‹
๐ค’-๐คƒ-๐ค”

๐ค€๐ค๐ค“๐ค‚๐ค‰๐ค„

FAQ

Why not use Modern Hebrew?

If you are able to program in this language, I have failed.

Why are you running an interpreted language over an interpreted language?

"Wherefore, just as sin came into the world through one man, and death through sin, and so death spread to all men because all sinned" 4

Why not make an object-oriented language?

This suggestion makes me consternated. Genesis will never be object-oriented because the Bible explicitly forbids object worship:

"These prized objects are really worthless. The people who worship idols donโ€™t know this, so they are all put to shame. []Their eyes are closed, and they cannot see. Their minds are shut, and they cannot think. The person who made the idol never stops to reflect, 'Why, itโ€™s just a block of wood! I burned half of it for heat and used it to bake my bread and roast my meat. How can the rest of it be a god? Should I bow down to worship a piece of wood?'" 5

Footnotes

  1. Psalm 139:13-16 โ†ฉ

  2. Isaiah 55:6-7 โ†ฉ

  3. Exodus 3:14 โ†ฉ

  4. Romans 5:12-13 โ†ฉ

  5. Isaiah 44:9-20 โ†ฉ

About

God's actual programming language.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

โšก