Skip to content
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

Add new Perl (perl.2) implementation #626

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d81a81d
perl.2: Pass step0 basic
ingydotnet Feb 1, 2023
19ca5c0
perl.2: Add step0 readline support
ingydotnet Feb 1, 2023
2b01e58
perl.2: Pass step1 basic
ingydotnet Feb 1, 2023
9c15197
perl.2: Pass step1 all
ingydotnet Feb 2, 2023
977bc25
perl.2: Pass step2 basic
ingydotnet Feb 3, 2023
ad43fba
perl.2: Pass step2 all
ingydotnet Feb 4, 2023
f524ceb
perl.2: Pass step3 all
ingydotnet Feb 4, 2023
f965029
perl.2: Refactor run.pl into repl and lib/REPL.pm
ingydotnet Feb 4, 2023
02116d6
perl.2: Pass step4 basic
ingydotnet Feb 5, 2023
c1be35d
perl.2: Pass step4 all
ingydotnet Feb 5, 2023
a8d3e5d
perl.2: Refactor Perl code
ingydotnet Feb 6, 2023
e042fae
perl.2: Pass step5 all
ingydotnet Feb 6, 2023
8d7a471
perl.2: Pass step6 all
ingydotnet Feb 10, 2023
9959a54
perl.2: Refactor for cleaner type objects
ingydotnet Feb 11, 2023
bb11e90
perl.2: Pass step7 basic
ingydotnet Feb 11, 2023
a995ad3
perl.2: Pass step7 all
ingydotnet Feb 12, 2023
148eb69
perl.2: Pass step8 basic
ingydotnet Feb 14, 2023
9547d68
perl.2: Pass step8 all
ingydotnet Feb 14, 2023
21959a5
perl.2: Remove Mo dependency
ingydotnet Feb 14, 2023
e17f2fd
perl.2: Pass step9 basic
ingydotnet Feb 16, 2023
8cd7b52
perl.2: Refactor Core functions in alpha order
ingydotnet Feb 16, 2023
cea1be6
perl.2: Pass step9 all
ingydotnet Feb 19, 2023
a2656fe
perl.2: Pass stepA all
ingydotnet Feb 20, 2023
c4031e3
perl.2: Pass self-hosting all
ingydotnet Feb 21, 2023
a03fd6d
perl.2: Add Makefile rule for testing self-hosting
ingydotnet Feb 27, 2023
3f919fb
perl.2: Add Dockerfile support
ingydotnet Feb 27, 2023
de7617c
perl.2: Improvements to ReadLine behavior
ingydotnet Feb 27, 2023
f3dec1c
perl.2: Add perl.2 to README.md and metadata files
ingydotnet Feb 27, 2023
ff8e94e
perl.2: Fix ci.sh to build new impl images
ingydotnet Feb 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions IMPLS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ IMPL:
- {IMPL: objc}
- {IMPL: ocaml}
- {IMPL: perl}
- {IMPL: perl.2}
- {IMPL: perl6}
- {IMPL: php}
- {IMPL: picolisp}
Expand Down
3 changes: 2 additions & 1 deletion Makefile.impls
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ wasm_MODE = wasmtime
IMPLS = ada ada.2 awk bash basic bbc-basic c c.2 chuck clojure coffee common-lisp cpp crystal cs d dart \
elisp elixir elm erlang es6 factor fantom fennel forth fsharp go groovy gnu-smalltalk \
guile haskell haxe hy io janet java java-truffle js jq julia kotlin livescript logo lua make mal \
matlab miniMAL nasm nim objc objpascal ocaml perl perl6 php picolisp pike plpgsql \
matlab miniMAL nasm nim objc objpascal ocaml perl perl.2 perl6 php picolisp pike plpgsql \
plsql powershell prolog ps purs python python.2 r racket rexx rpython ruby ruby.2 rust scala scheme skew sml \
swift swift3 swift4 swift5 tcl ts vala vb vhdl vimscript wasm wren yorick xslt zig

Expand Down Expand Up @@ -159,6 +159,7 @@ objc_STEP_TO_PROG = impls/objc/$($(1))
objpascal_STEP_TO_PROG = impls/objpascal/$($(1))
ocaml_STEP_TO_PROG = impls/ocaml/$($(1))
perl_STEP_TO_PROG = impls/perl/$($(1)).pl
perl.2_STEP_TO_PROG = impls/perl.2/$($(1)).pl
perl6_STEP_TO_PROG = impls/perl6/$($(1)).pl
php_STEP_TO_PROG = impls/php/$($(1)).php
picolisp_STEP_TO_PROG = impls/picolisp/$($(1)).l
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ FAQ](docs/FAQ.md) where I attempt to answer some common questions.
| [Objective C](#objective-c) | [Joel Martin](https://github.com/kanaka) |
| [OCaml](#ocaml-4010) | [Chris Houser](https://github.com/chouser) |
| [Perl](#perl-5) | [Joel Martin](https://github.com/kanaka) |
| [Perl #2](#perl-5-2) | [Ingy döt Net](https://github.com/ingydotnet) |
| [Perl 6](#perl-6) | [Hinrik Örn Sigurðsson](https://github.com/hinrik) |
| [PHP](#php-53) | [Joel Martin](https://github.com/kanaka) |
| [Picolisp](#picolisp) | [Vasilij Schneidermann](https://github.com/wasamasa) |
Expand Down Expand Up @@ -831,6 +832,17 @@ cd impls/perl
perl stepX_YYY.pl
```

### Perl 5 #2

This Perl 5 implementation should work with perl 5.10.1 and later.

```
cd impls/perl.2
perl ./repl
make test
make test-self-host
```

### Perl 6

The Perl 6 implementation was tested on Rakudo Perl 6 2016.04.
Expand Down
4 changes: 3 additions & 1 deletion ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ if [ -z "${NO_DOCKER}" ]; then
img_impl=$(echo "${MAL_IMPL:-${IMPL}}" | tr '[:upper:]' '[:lower:]')
# We could just use make DOCKERIZE=1 instead but that does add
# non-trivial startup overhead for each step.
MAKE="docker run -i -u $(id -u) -v `pwd`:/mal kanaka/mal-test-${img_impl%%-mal} ${MAKE}"
image=kanaka/mal-test-${img_impl%%-mal}
docker pull "$image" || make "docker-build^${IMPL}"
MAKE="docker run -i -u $(id -u) -v `pwd`:/mal $image ${MAKE}"
fi

case "${ACTION}" in
Expand Down
1 change: 1 addition & 0 deletions docs/graph/base_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ languages:
- [objc , Objective C , C , Static , []]
- [ocaml , OCaml , ML , Static , []]
- [perl , Perl , C , Dynamic , []]
- [perl.2 , Perl , C , Dynamic , []]
- [perl6 , Perl 6 , C , Dynamic , []]
- [php , PHP , C , Dynamic , []]
- [picolisp , Picolisp , Lisp , Dynamic , []]
Expand Down
3 changes: 3 additions & 0 deletions impls/perl.2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/test*
/Guide.md
/ToDo
41 changes: 41 additions & 0 deletions impls/perl.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM ubuntu:jammy
MAINTAINER Ingy döt Net <[email protected]>

##########################################################
# General requirements for testing or common across many
# implementations
##########################################################

RUN apt-get -y update

# Required for running tests
RUN apt-get -y install make python3

# Some typical implementation and test requirements
RUN apt-get -y install curl libreadline-dev libedit-dev

RUN mkdir -p /mal
WORKDIR /mal

##########################################################
# Specific implementation requirements
##########################################################

RUN ln -s python3 /usr/bin/python

RUN apt-get -y install \
build-essential \
cpanminus \
libperl-dev \
libreadline-dev \
perl \
&& true

RUN cpanm -n \
Term::ReadLine \
Term::ReadLine::Gnu \
Tie::IxHash \
XXX \
&& true

ENV PERL5LIB=/mal/impls/perl.2/lib
37 changes: 37 additions & 0 deletions impls/perl.2/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
SHELL := bash

ROOT := $(shell cd ../.. && pwd)
BASE := $(shell pwd)

export PERL5LIB := $(BASE)/lib

ifndef BASIC
export DEFERRABLE := 1
export OPTIONAL := 1
endif

IMPL ?= $(shell basename $(BASE))

ALL_TESTS := $(shell echo test-{{0..9},A})

GREP_RESULTS := grep -E '(^TEST RESULTS|: .* tests$$)'


default:

test:
time $(MAKE) test-all BASIC=$(BASIC) |& $(GREP_RESULTS)

test-all: $(ALL_TESTS)

test-self-host: docker-build
time $(MAKE) -C $(ROOT) MAL_IMPL=$(IMPL) test^mal^step{{0..4},{6..9},A} |& \
$(GREP_RESULTS)

$(ALL_TESTS):
time $(MAKE) --no-print-directory -C $(ROOT) test^$(IMPL)^step$(@:test-%=%) \
DEFERRABLE=$(DEFERRABLE) OPTIONAL=$(OPTIONAL)

docker-build:
$(MAKE) -C $(ROOT) docker-build^$(IMPL)
@echo