Let there be light!

This commit is contained in:
pestctrl 2024-09-20 09:40:09 -05:00 committed by Benson Chu
commit c95650c357
5 changed files with 86 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
build/
*.fasl

46
Makefile Normal file
View file

@ -0,0 +1,46 @@
EXE = sbcl
FLAGS = --no-userinit --no-sysinit --non-interactive
BUILDDIR = ./build
QL = $(BUILDDIR)/quicklisp
LIBS= $(BUILDDIR)/libs.stamp
.PHONY: all clean cleanall
all: $(BUILDDIR)/pegrep-debug
# Make executable with full debug support and slower execution time
$(BUILDDIR)/pegrep-debug: $(LIBS)
$(EXE) $(FLAGS) \
--load $(QL)/setup.lisp \
--load ./src/pegrep.asd \
--eval '(ql:quickload :alexandria)' \
--eval '(asdf:disable-output-translations)' \
--eval '(asdf:load-system :pegrep-debug)' \
--eval '(asdf:make :pegrep-debug)' \
--eval '(quit)'
# Remove binaries and fasl compiled files
clean:
rm -f build/pegrep*
find . -name "*.fasl" -type f -delete
# Remove everything, including libraries
cleanall: clean
rm -rf build
$(LIBS): $(QL)/setup.lisp
$(EXE) $(FLAGS) \
--load $(QL)/setup.lisp \
--eval '(ql:quickload :alexandria)' \
--eval '(quit)'
touch $@
$(QL)/quicklisp.lisp:
mkdir -p build/quicklisp
wget -P build/quicklisp/ http://beta.quicklisp.org/quicklisp.lisp
$(QL)/setup.lisp: $(QL)/quicklisp.lisp
$(EXE) $(FLAGS) \
--load $(QL)/quicklisp.lisp \
--eval '(quicklisp-quickstart:install :path "$(BUILDDIR)/quicklisp")' \
--eval '(quit)'

2
README.org Normal file
View file

@ -0,0 +1,2 @@
* pegrep -- When regular expressions aren't enough!
It's pronounced peg-rep, for peg-replace.

28
src/pegrep.asd Normal file
View file

@ -0,0 +1,28 @@
(require 'asdf)
(defmacro def-pegrep (name &rest args)
`(asdf:defsystem ,name
:serial t
:build-operation "program-op"
:entry-point "pegrep:entry"
:depends-on ("alexandria")
:components ((:file "pegrep"))
,@args))
(def-pegrep :pegrep
:build-pathname "../build/pegrep"
:around-compile (lambda (next)
(proclaim '(optimize
(safety 3)
(debug 0)
(speed 3)))
(funcall next)))
(def-pegrep :pegrep-debug
:build-pathname "../build/pegrep-debug"
:around-compile (lambda (next)
(proclaim '(optimize
(safety 3)
(debug 3)
(speed 0)))
(funcall next)))

8
src/pegrep.lisp Normal file
View file

@ -0,0 +1,8 @@
(defpackage :pegrep
(:use :cl :alexandria)
(:export :entry))
(in-package :pegrep)
(defun entry ()
(format t "Hello, world!~%"))