LaetLang is an interpreted C style language. It has file reading/writting, TCP network calls and awaitable promises.

Related tags

Spring Boot LaetLang
Overview

LaetLang 💻

LaetLang is an interpreted C style language built by following along Robert Nystrom's book Crafting Interpreters. This is a toy language that was meant as a learning exercise, please do not use it for any projects.

A few of the things that I decided to add that were not part of the interpreter covered in the book:

Reading from a file:

var textInput = fileR("./out.txt");
print "File content is: " + textInput;

Writting to files:

fileln("./out.txt", "Hello World.");

Making a network call:

var networkResponse = net("localhost", 2000, "TEST");
print "Server responded with: " + networkResponse;

The network call is a TCP write, so a language level library for http calls could be made.

Async Network call:

var promiseResponses = nil;

for(var i = 0; i < 10; i = i + 1) {
    var address = asyncNet("localhost", 2000, listN(requestList, i));
    promiseResponses = prepend(address, promiseResponses);
}

map(PromiseResolve, promiseResponses);

A very naive implementation of promises by using an eventDict to store threaded operation results, which can then be retrieved by awaiting for the promise to resolve. This means you can do multiple network requests at the same time, and then await for the results.


Other things in the language that are straight from the book implementation of the interpreter:

Defining a function:

fun fib(n) {
    if (n <= 1) return n;
    return fib(n-2) + fib(n-1);
}

FizzBuzz is messy because of no elif :(

fun mod1(a, m, i) {
    if (m * i == a) {
        return 0;
    }
    if (m * i < a) {
        return mod1(a, m, i+1);
    }
    return a - m * (i - 1);
}

fun mod(a, b) {
    return mod1(a, b, 1);
}

for(var i = 0; i < 100; i = i + 1) {
    if (mod(i, 15) == 0) {
      print "Fizz Buzz";
    } else {
      if (mod(i, 3) == 0) {
        print "Fizz";
      } else {
        if (mod(i, 5) == 0) {
          print "Buzz";
        } else {
          print i;
        }
      }
    }
}
You might also like...

For Jack language. Most of codes were commented with their usage, which can be useful for beginner to realize the running principle of a compiler for object-oriented programming language.

Instructions: Download the Java source codes Store these codes into a local folder and open this folder Click the right key of mouse and click ‘Open i

Jan 5, 2023

The Apache Commons CSV library provides a simple interface for reading and writing CSV files of various types.

Apache Commons CSV The Apache Commons CSV library provides a simple interface for reading and writing CSV files of various types. Documentation More i

Dec 26, 2022

Application to benchmark block reading from bitcoind

BlockReader BlockReader is a small command line application to benchmark block reading performance. Currently, it is using bitcoin-cli to read blocks

Jan 18, 2022

React Native TurboModule for reading battery level.

react-native-turbo-battery React Native TurboModule for getting battery level. Installation yarn add react-native-turbo-battery Usage import { getBatt

Aug 28, 2022

LibGDX PSX-style render features

gdx-psx gdx-psx its a library for LibGDX designed to assist you in simulation of PlayStation 1 graphics with few simple steps! If you have questions o

Dec 10, 2022

Simple micro web framework written in Pragmatic Functional Java style

Pragmatica REST Example Example nano web framework written in Pragmatic Functional Java style. Example public class App { public static void main(

Oct 21, 2022

Event promoted by DevSuperior to improve the best practices of Spring with Java and has React JS as an additional.

Event promoted by DevSuperior to improve the best practices of Spring with Java and has React JS as an additional.

Semana-Spring-React (sds3.0) Introduction SDS3 is an event promoted by DevSuperior which aims to help students and programming professionals to enter

Oct 25, 2021

The Spring Boot Sample App on K8S has been implemented using GKE K8S Cluster, Spring Boot, Maven, and Docker.

gke-springboot-sampleapp 👋 The Spring Boot Sample App on K8S has been implemented using GKE K8S Cluster, Spring Boot, Maven, and Docker. Usage To be

Feb 1, 2022
Owner
Alexander Shevchenko
Alexander Shevchenko
Split into data blocks,In this format, efficient reading can be realized,Avoid unnecessary data reading operations.

dataTear 切换至:中文文档 knowledge base dataTear Split into data fragments for data management. In this format, efficient reading can be achieved to avoid un

LingYuZhao 24 Dec 15, 2022
lazy-language-loader improves loading times when changing your language by only reloading the language instead of all the game resources!

lazy-language-loader lazy-language-loader improves loading times when changing your language by only reloading the language instead of all the game re

Shalom Ademuwagun 7 Sep 7, 2022
A Zombie invasion has occurred at the Code Academy Campus and now Alcatrinha has to fight the zombies to death! (2D TopView Shooter)

Hello everyone, welcome to Zombie ACADalypse!! A Zombie invasion has occurred at the Code Academy Campus and now Alcatrinha has to fight the zombies t

Mario Vieria 1 Dec 17, 2021
A Network Observer which would provide maximum details about the network to the administrator on their screen without knowing to their users.

Smart-Network-Observer-With-Energy-Framework A Network Observer which would provide maximum details about the network to the administrator on their sc

Shrutika Ambre 5 Jul 15, 2022
Drifty is an open-source interactive File Downloader system built with java. It is currently available in CLI mode and has the GUI version under active development.

Drifty Drifty is an open-source interactive File Downloader system built using Java. It takes the link to the file, the directory where it needs to be

Saptarshi Sarkar 60 Dec 24, 2022
Decorating Spring Boot Reactive WebClient for tracing the request and response data for http calls.

SpringBoot Reactive WebClient ?? Tracing HTTP Request through a single pane of glass Decorating Spring Boot Reactive WebClient for tracing the request

Reactive Learning LLP 7 Jul 13, 2022
The project is an example of using the http web client to promote synchronous and asynchronous https calls.

Web Client Consumer Java Sample The project is an example of using the http web client to promote synchronous and asynchronous https calls. Requiremen

null 2 Jan 12, 2022
trace all binder-funcion calls on android-platform

BinderHackDemo trace all binder-funcion calls on android-platform 该demo展示了如何使用libbinderhack.so模块,trace-app自身进程binder调用情况 您可以通过该次提交,查看如何使用libbinderhack

null 4 Dec 25, 2021
Classpy is a GUI tool for investigating Java class file, Lua binary chunk, Wasm binary code, and other binary file formats.

Classpy Classpy is a GUI tool for investigating Java class file, Lua binary chunk, Wasm binary code, and other binary file formats. Inspiration This t

null 1k Dec 17, 2022
Jamal is a macro language (JAmal MAcro Language)

Jamal Macro Language Jamal is a complex text processor with a wide variety of possible use. The first version of Jamal was developed 20 years ago in P

Peter Verhas 29 Dec 20, 2022