Skip to content

Matthias1590/NumLang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NumLang

A stack-oriented programming language written in python.

Examples

// Fibonacci in NumLang

var(a, 4)
var(b, 4) push(1) b store
var(c, 4)

push(0) while b load push(100) < do
    b load print

    a load c store // Store a in c

    b load a store // Store b in a

    c load b load + b store // Add c to b

    push(1) +
end pop
// Variables in NumLang

var(age, 1) // Create a variable called age with a size of 1 byte (will be located at address 0)

push(17) age store // Store 17 in the variable age

age load // Load the value stored in age

print // Print the value stored in age


// Variables can be used in loops to keep track of the current iteration
var(i, 2) // Create a variable called i with a size of 3 bytes (will be located at address 1)
var(j, 1)
push(0) while dup push(1000) < do
    i store // Store the current iteration in i

    // Print the number if j is divisible by 11 or i is divisible by 15
    j load push(11) % push(0) ==
    i load push(15) % push(0) ==
    |
    if
        i load print
    end

    j load push(3) +
    j store
    i load push(1) + // Increment i
end pop

For more examples, take a look at the numlang/examples folder.

About

A stack-oriented programming language written in python.

Topics

Resources

Stars

Watchers

Forks

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy