Skip to content

Added retro programming languages #1101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,55 @@
"image": {
"baseImage": "public.ecr.aws/lambda/provided:al2023"
}
},
{
"displayName": "ada (gnat)",
"runtime": "provided.al2",
"handler": "handler",
"path": "ada",
"architectures": ["x86_64", "arm64"]
},
{
"displayName": "assembler (binutils)",
"runtime": "provided.al2",
"handler": "handler",
"path": "asm",
"architectures": ["x86_64", "arm64"]
},
{
"displayName": "cobol (cobc)",
"runtime": "provided.al2",
"handler": "handler",
"path": "cobol",
"architectures": ["x86_64", "arm64"]
},
{
"displayName": "fortran (gfortran)",
"runtime": "provided.al2",
"handler": "handler",
"path": "fortran",
"architectures": ["x86_64", "arm64"]
},
{
"displayName": "lisp (sbcl)",
"runtime": "provided.al2",
"handler": "handler",
"path": "lisp",
"architectures": ["x86_64", "arm64"]
},
{
"displayName": "oberon (obnc)",
"runtime": "provided.al2",
"handler": "handler",
"path": "oberon",
"architectures": ["x86_64", "arm64"]
},
{
"displayName": "pascal (fpc)",
"runtime": "provided.al2",
"handler": "handler",
"path": "pascal",
"architectures": ["x86_64", "arm64"]
}
]
}
13 changes: 13 additions & 0 deletions s3-uploader/runtimes/ada/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM amazonlinux:2 AS builder
ENV APP_BASE_DIR=/tmp
WORKDIR $APP_BASE_DIR
RUN yum install gcc-gnat zip -y
COPY lambda lambda
WORKDIR $APP_BASE_DIR/lambda
RUN gnatmake MaxdayLambda.ada
RUN rm -f MaxdayLambda.*
RUN zip -r $APP_BASE_DIR/code.zip .

FROM scratch
COPY --from=builder /tmp/code.zip /code.zip
ENTRYPOINT ["/code.zip"]
19 changes: 19 additions & 0 deletions s3-uploader/runtimes/ada/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

DIR_NAME="./runtimes/$1"

if [ $2 = "x86_64" ]; then
ARCH="linux/amd64"
elif [ $2 = "arm64" ]; then
ARCH="linux/arm64/v8"
else
echo "The process architecture $2 is set incorrectly. The value can only be either x86_64 or arm64."
exit 1
fi

rm ${DIR_NAME}/code_${2}.zip 2> /dev/null

docker build ${DIR_NAME} --platform ${ARCH} -t maxday/ada_${2}
dockerId=$(docker create maxday/ada_${2})

docker cp $dockerId:/code.zip ${DIR_NAME}/code_${2}.zip
6 changes: 6 additions & 0 deletions s3-uploader/runtimes/ada/lambda/MaxdayLambda.ada
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
with Ada.Text_IO; use Ada.Text_IO;

procedure MaxdayLambda is
begin
Put_Line ("Hello from Ada!");
end MaxdayLambda;
34 changes: 34 additions & 0 deletions s3-uploader/runtimes/ada/lambda/bootstrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh

set -euo pipefail

# Processing Loop
while true
do
echo "handler: $_HANDLER"
HEADERS="$(mktemp)"
# Get an event. The HTTP request will block until one is received
EVENT_DATA=$(curl -sS -LD "$HEADERS" -X GET "http://${AWS_LAMBDA_RUNTIME_API}/2018-06-01/runtime/invocation/next")
echo "event data: $EVENT_DATA"

# Extract request ID by scraping response headers received above
REQUEST_ID=$(grep -Fi Lambda-Runtime-Aws-Request-Id "$HEADERS" | tr -d '[:space:]' | cut -d: -f2)
echo "request id: $REQUEST_ID"

# Execute the handler function from the script
echo "ls -lh $(pwd) (current working dir)"
echo "$(ls -lh .)"
#RESPONSE=$($_HANDLER)
RESPONSE=$(/var/task/MaxdayLambda)

# Necessary API Gateway response format
JSON_RESPONSE='
{
"isBase64Encoded": false,
"statusCode": 200,
"body": "'"$RESPONSE"'"
}'

# Send the response
curl -X POST "http://${AWS_LAMBDA_RUNTIME_API}/2018-06-01/runtime/invocation/$REQUEST_ID/response" -d "${JSON_RESPONSE}"
done
13 changes: 13 additions & 0 deletions s3-uploader/runtimes/asm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM amazonlinux:2 AS builder
ENV APP_BASE_DIR=/tmp
WORKDIR $APP_BASE_DIR
RUN yum install binutils zip -y
COPY lambda lambda
WORKDIR $APP_BASE_DIR/lambda
RUN as -o lambda_$(uname -m).o lambda_$(uname -m).s && ld -o lambda lambda_$(uname -m).o
RUN rm -f lambda_*
RUN zip -r $APP_BASE_DIR/code.zip .

FROM scratch
COPY --from=builder /tmp/code.zip /code.zip
ENTRYPOINT ["/code.zip"]
19 changes: 19 additions & 0 deletions s3-uploader/runtimes/asm/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

DIR_NAME="./runtimes/$1"

if [ $2 = "x86_64" ]; then
ARCH="linux/amd64"
elif [ $2 = "arm64" ]; then
ARCH="linux/arm64/v8"
else
echo "The process architecture $2 is set incorrectly. The value can only be either x86_64 or arm64."
exit 1
fi

rm ${DIR_NAME}/code_${2}.zip 2> /dev/null

docker build ${DIR_NAME} --platform ${ARCH} -t maxday/asm_${2}
dockerId=$(docker create maxday/asm_${2})

docker cp $dockerId:/code.zip ${DIR_NAME}/code_${2}.zip
34 changes: 34 additions & 0 deletions s3-uploader/runtimes/asm/lambda/bootstrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh

set -euo pipefail

# Processing Loop
while true
do
echo "handler: $_HANDLER"
HEADERS="$(mktemp)"
# Get an event. The HTTP request will block until one is received
EVENT_DATA=$(curl -sS -LD "$HEADERS" -X GET "http://${AWS_LAMBDA_RUNTIME_API}/2018-06-01/runtime/invocation/next")
echo "event data: $EVENT_DATA"

# Extract request ID by scraping response headers received above
REQUEST_ID=$(grep -Fi Lambda-Runtime-Aws-Request-Id "$HEADERS" | tr -d '[:space:]' | cut -d: -f2)
echo "request id: $REQUEST_ID"

# Execute the handler function from the script
echo "ls -lh $(pwd) (current working dir)"
echo "$(ls -lh .)"
#RESPONSE=$($_HANDLER)
RESPONSE=$(/var/task/lambda)

# Necessary API Gateway response format
JSON_RESPONSE='
{
"isBase64Encoded": false,
"statusCode": 200,
"body": "'"$RESPONSE"'"
}'

# Send the response
curl -X POST "http://${AWS_LAMBDA_RUNTIME_API}/2018-06-01/runtime/invocation/$REQUEST_ID/response" -d "${JSON_RESPONSE}"
done
19 changes: 19 additions & 0 deletions s3-uploader/runtimes/asm/lambda/lambda_aarch64.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.data
hello:
.ascii "Hello from Assembler!\n"

len = . - hello

.text
.global _start

_start:
mov x0, 1 // file descriptor: stdout
ldr x1, =hello // pointer to message
ldr x2, =len // message length
mov x8, 64 // syscall: write
svc 0 // make syscall

mov x0, 0 // status: 0
mov x8, 93 // syscall: exit
svc 0 // make syscall
19 changes: 19 additions & 0 deletions s3-uploader/runtimes/asm/lambda/lambda_x86_64.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.data
hello:
.string "Hello from Assembler!"

.text
.global _start

_start:
# write our string to stdout
mov $1, %rax # syscall: write
mov $1, %rdi # file descriptor: stdout
mov $hello, %rsi # pointer to message
mov $21, %rdx # message length
syscall

# exit
mov $60, %rax # syscall: exit
xor %rdi, %rdi # status: 0
syscall
24 changes: 24 additions & 0 deletions s3-uploader/runtimes/cobol/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM amazonlinux:2 AS builder
ARG GNUCOBOL_VER=3.2
ENV APP_BASE_DIR=/tmp
WORKDIR $APP_BASE_DIR
RUN yum install tar gzip make gcc gmp-devel zip -y
RUN curl -o gnucobol.tgz "https://nav.dl.sourceforge.net/project/gnucobol/gnucobol/${GNUCOBOL_VER}/gnucobol-${GNUCOBOL_VER}.tar.gz"
RUN mkdir gnucobol && tar -xvvzf gnucobol.tgz --strip-components 1 -C gnucobol && rm -f gnucobol.tgz
WORKDIR "${APP_BASE_DIR}/gnucobol"
RUN ./configure --without-db
RUN make && make install
WORKDIR $APP_BASE_DIR
RUN rm -rf gnucobol
COPY lambda lambda
WORKDIR $APP_BASE_DIR/lambda
RUN mkdir lib && cp /usr/local/lib/libcob.so.4 lib
RUN cobc -x lambda.cob
RUN rm -f lambda.cob
### Only for debug
#ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$APP_BASE_DIR/lambda/lib
RUN zip -r $APP_BASE_DIR/code.zip .

FROM scratch
COPY --from=builder /tmp/code.zip /code.zip
ENTRYPOINT ["/code.zip"]
19 changes: 19 additions & 0 deletions s3-uploader/runtimes/cobol/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

DIR_NAME="./runtimes/$1"

if [ $2 = "x86_64" ]; then
ARCH="linux/amd64"
elif [ $2 = "arm64" ]; then
ARCH="linux/arm64/v8"
else
echo "The process architecture $2 is set incorrectly. The value can only be either x86_64 or arm64."
exit 1
fi

rm ${DIR_NAME}/code_${2}.zip 2> /dev/null

docker build ${DIR_NAME} --platform ${ARCH} -t maxday/cobol_${2}
dockerId=$(docker create maxday/cobol_${2})

docker cp $dockerId:/code.zip ${DIR_NAME}/code_${2}.zip
36 changes: 36 additions & 0 deletions s3-uploader/runtimes/cobol/lambda/bootstrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh

set -euo pipefail

# Processing Loop
while true
do
echo "handler: $_HANDLER"
HEADERS="$(mktemp)"
# Get an event. The HTTP request will block until one is received
EVENT_DATA=$(curl -sS -LD "$HEADERS" -X GET "http://${AWS_LAMBDA_RUNTIME_API}/2018-06-01/runtime/invocation/next")
echo "event data: $EVENT_DATA"

# Extract request ID by scraping response headers received above
REQUEST_ID=$(grep -Fi Lambda-Runtime-Aws-Request-Id "$HEADERS" | tr -d '[:space:]' | cut -d: -f2)
echo "request id: $REQUEST_ID"

# Execute the handler function from the script
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LAMBDA_TASK_ROOT/lib
echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
echo "ls -lh $(pwd) (current working dir)"
echo "$(ls -lh .)"
#RESPONSE=$($_HANDLER)
RESPONSE=$(/var/task/lambda)

# Necessary API Gateway response format
JSON_RESPONSE='
{
"isBase64Encoded": false,
"statusCode": 200,
"body": "'"$RESPONSE"'"
}'

# Send the response
curl -X POST "http://${AWS_LAMBDA_RUNTIME_API}/2018-06-01/runtime/invocation/$REQUEST_ID/response" -d "${JSON_RESPONSE}"
done
5 changes: 5 additions & 0 deletions s3-uploader/runtimes/cobol/lambda/lambda.cob
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. maxdaylambda.
PROCEDURE DIVISION.
DISPLAY "Hello from COBOL!".
STOP RUN.
16 changes: 16 additions & 0 deletions s3-uploader/runtimes/fortran/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM amazonlinux:2 AS builder
ENV APP_BASE_DIR=/tmp
WORKDIR $APP_BASE_DIR
RUN yum install gcc-gfortran zip -y
COPY lambda lambda
WORKDIR $APP_BASE_DIR/lambda
RUN gfortran lambda.f90 -o lambda
RUN rm -f lambda.f90
RUN mkdir lib && cp /usr/lib64/libgfortran.so.4 lib
### Only for debug
#ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$APP_BASE_DIR/lambda/lib
RUN zip -r $APP_BASE_DIR/code.zip .

FROM scratch
COPY --from=builder /tmp/code.zip /code.zip
ENTRYPOINT ["/code.zip"]
19 changes: 19 additions & 0 deletions s3-uploader/runtimes/fortran/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

DIR_NAME="./runtimes/$1"

if [ $2 = "x86_64" ]; then
ARCH="linux/amd64"
elif [ $2 = "arm64" ]; then
ARCH="linux/arm64/v8"
else
echo "The process architecture $2 is set incorrectly. The value can only be either x86_64 or arm64."
exit 1
fi

rm ${DIR_NAME}/code_${2}.zip 2> /dev/null

docker build ${DIR_NAME} --platform ${ARCH} -t maxday/fortran_${2}
dockerId=$(docker create maxday/fortran_${2})

docker cp $dockerId:/code.zip ${DIR_NAME}/code_${2}.zip
Loading
Loading