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] ]
gus_massa•3w ago
https://lax-lang.space It has a link to SourceForge instead of GitHub
https://github.com/lax-inc/Lax
> Please create your own project forks or empty repositories with .lx files
Do you mean "new" instead of "empty"? My recomendation is to try to get real users instead of asking minimal repos.
Remember to use two spaces to activate the magic "code" mode in HN
Some functions like "eq?" use a question mark and other like "is_unary" use an underscore. It's strange.From github
> License and Restrictions
> No License.
> All rights are reserved by Lax Inc.
> Copying is strictly prohibited.
> The redistribution of source code, binaries, or the Lax compiler logic is not permitted.
> Unauthorized use of the Lax trademark or the Lax REPL CLI interface design is forbidden.
Are you selling the compiler? IIUC I can only stare at the compiler code but not download or run it. Seling compilers is very hard now. People expect an open source license, but it's hard to monetize. Some people tried with "semi-free"[1] licenses. Who can use your compiler for free? Who must pay to use it?
[1] or "semi-close", depending who is complaining. The only truly free part is to get voluntaries for complaining.
Mavox-ID•3w ago
Any questions regarding eq? In code, eq? checks whether two values point to the same object in memory (referential identity). In other functions, it's the check code itself, created earlier, not the function itself. (It's like a variable that participates as a command but is itself executed via spor. If used, it executes another command, such as eq? , but with the value entered by the user.)
For example:
[spot [is_true [x] [x]] eq? [x] [x]]
And more.
The fact that you found Sourceforge is one of the ways to download Lax, which is currently temporarily non-existent. You can download it using the button right at the beginning of the site 'Download Lax 6.0.6'. What you saw in README.md was a test version of Lax and did not apply to the current version at all. Lax currently uses MIT and you can download and edit Lax as you like and even suggest your changes through forks of the official repository. Lax is compiled very quickly using make and is not sold. Lax is simply provided in the form of only .c code, where you compile it yourself and is not immediately submitted only as a binary file, where you cannot open it like the same .c code and edit it.
Calavar•3w ago
I see that there is an MIT license file in the repo, but the readme in the repo still says there is no license and redistribution in source or binary form is explicitly forbidden. This is a discrepancy that should probably be addressed
Mavox-ID•3w ago