Official website: https://lax-lang.space
Please create your own project forks or empty repositories with .lx files of my Lax programming language so that GitHub can see the interest of users of the Lax project and the popularity of the language.
Lax has S-syntax and Lisp-like code. It can help you learn programming and write programs on Linux, even a simple calculator or shell, and much more. Lax also has over 145 commands that you can use to do anything. Here's an example of Hello World:
[start [image "Hello World!"] [nl] ]
start - Creates a command chain image - Prints text nl - Creates a line break
You can also use just an image using \n:
[image "Hello World!\n"]
Here's how to work with input:
[start [spot name [input "Enter your name: "]] [image "Hello, "] [image name] [image "!"] [nl]]
spot - Creates a variable input - The simple input command will print Lax> and wait for the user to enter input. If it's quoted like "image," it will be the text inside the quotes.
Here we go. We create a variable 'name' where we assign it the value of the user's input, and then use image to display what the user entered. This is basic work with input and output, as well as variables.
And here's also a simple calculator that calculates roots, powers, and other mathematical equations:
[start [spot op_raw [input "Select operation (+, -, , /, sqrt, expt): "]] [spot op [string->sign op_raw]]
[spot is_unary [eq? op [string->sign "sqrt"]]]
[spot first_raw [if is_unary [input "Enter number: "] [input "First number: "]]] [spot first_num [to-number first_raw]] [spot first_ok [and [> [string-length first_raw] 0] [number? first_num]]]
[spot second_raw [if [not is_unary] [input "Second number: "] ""]] [spot second_num [to-number second_raw]] [spot second_ok [or is_unary [and [> [string-length second_raw] 0] [number? second_num]]]]
[spot dispatch_table [list [cons [string->sign "+"] +] [cons [string->sign "-"] -] [cons [string->sign ""] ] [cons [string->sign "/"] /] [cons [string->sign "expt"] expt] [cons [string->sign "sqrt"] sqrt] [] ] ]
[spot op_pair [assq op dispatch_table]]
[spot ans [if [not first_ok] "Error: Bad first number" [if [not second_ok] "Error: Bad second number" [if [not op_pair] "Error: Unknown operation" [start [spot func [tail op_pair]]
[if [and [eq? op [string->sign "/"]] [= second_num 0]] "Error: Division by zero" [if [and is_unary [< first_num 0]] "Error: Negative root" [if is_unary [func first_num] [func first_num second_num] ] ] ] ] ] ] ] ]
[image first_raw] [image " "] [image op_raw] [if [not is_unary] [start [image " "] [image second_raw]] ""] [image "="] [image ans] [nl] ]