Skip to content

Commit

Permalink
renamed to c.2 and rebased onto latest master
Browse files Browse the repository at this point in the history
  • Loading branch information
fungiblecog authored and kanaka committed May 12, 2021
1 parent 9d03314 commit fe6c42e
Show file tree
Hide file tree
Showing 31 changed files with 9,980 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ package-lock.json
*/experiments
node_modules
*/notes

GPATH
GTAGS
GRTAGS
logs
old
tmp/
4 changes: 2 additions & 2 deletions Makefile.impls
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ wasm_MODE = wasmtime
# Implementation specific settings
#

IMPLS = ada ada.2 awk bash basic bbc-basic c chuck clojure coffee common-lisp cpp crystal cs d dart \
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 js jq julia kotlin livescript logo lua make mal \
matlab miniMAL nasm nim objc objpascal ocaml perl perl6 php picolisp pike plpgsql \
Expand Down Expand Up @@ -110,6 +110,7 @@ bash_STEP_TO_PROG = impls/bash/$($(1)).sh
basic_STEP_TO_PROG = $(basic_STEP_TO_PROG_$(basic_MODE))
bbc-basic_STEP_TO_PROG = impls/bbc-basic/$($(1)).bas
c_STEP_TO_PROG = impls/c/$($(1))
c.2_STEP_TO_PROG = impls/c.2/$($(1))
chuck_STEP_TO_PROG = impls/chuck/$($(1)).ck
clojure_STEP_TO_PROG = $(clojure_STEP_TO_PROG_$(clojure_MODE))
coffee_STEP_TO_PROG = impls/coffee/$($(1)).coffee
Expand Down Expand Up @@ -192,4 +193,3 @@ wren_STEP_TO_PROG = impls/wren/$($(1)).wren
yorick_STEP_TO_PROG = impls/yorick/$($(1)).i
xslt_STEP_TO_PROG = impls/xslt/$($(1))
zig_STEP_TO_PROG = impls/zig/$($(1))

28 changes: 28 additions & 0 deletions impls/c.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM ubuntu:bionic
MAINTAINER Duncan Watts <[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 python

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

RUN mkdir -p /mal
WORKDIR /mal

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

# Install gcc
RUN apt-get -y install gcc

# Libraries needed for the C impl
RUN apt-get -y install libffi-dev libgc-dev libedit-dev
93 changes: 93 additions & 0 deletions impls/c.2/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
CC = gcc

CFLAGS = -std=c99 -g -Wall

LIBS = -ledit -lgc
FFI_LIBS = -ldl -lffi

SRC = reader.c printer.c types.c env.c core.c
HEADERS = reader.h printer.h types.h env.h core.h

LIB_DIR = ./libs
LIB_LIST_H = $(LIB_DIR)/linked_list/linked_list.h
LIB_LIST_SRC = $(LIB_DIR)/linked_list/linked_list.c

LIB_MAP_H = $(LIB_DIR)/hashmap/hashmap.h
LIB_MAP_SRC = $(LIB_DIR)/hashmap/hashmap.c

LIBS_H = $(LIB_LIST_H) $(LIB_MAP_H)
LIBS_SRC = $(LIB_LIST_SRC) $(LIB_MAP_SRC)

S0_SRC = step0_repl.c
S1_SRC = step1_read_print.c reader.c types.c printer.c $(LIB_LIST_SRC)
S2_SRC = step2_eval.c reader.c types.c printer.c $(LIBS_SRC)
S3_SRC = step3_env.c reader.c types.c printer.c env.c $(LIBS_SRC)
S4_SRC = step4_if_fn_do.c $(SRC) $(LIBS_SRC)
S5_SRC = step5_tco.c $(SRC) $(LIBS_SRC)
S6_SRC = step6_file.c $(SRC) $(LIBS_SRC)
S7_SRC = step7_quote.c $(SRC) $(LIBS_SRC)
S8_SRC = step8_macros.c $(SRC) $(LIBS_SRC)
S9_SRC = step9_try.c $(SRC) $(LIBS_SRC)
SA_SRC = stepA_mal.c $(SRC) $(LIBS_SRC)

S0_HEADERS =
S1_HEADERS = reader.h types.h printer.h $(LIB_LIST_H)
S2_HEADERS = reader.h types.h printer.h $(LIBS_H)
S3_HEADERS = reader.h types.h printer.h env.h $(LIBS_H)
S4_HEADERS = $(HEADERS) $(LIBS_H)
S5_HEADERS = $(HEADERS) $(LIBS_H)
S6_HEADERS = $(HEADERS) $(LIBS_H)
S7_HEADERS = $(HEADERS) $(LIBS_H)
S8_HEADERS = $(HEADERS) $(LIBS_H)
S9_HEADERS = $(HEADERS) $(LIBS_H)
SA_HEADERS = $(HEADERS) $(LIBS_H)

S0 = step0_repl
S1 = step1_read_print
S2 = step2_eval
S3 = step3_env
S4 = step4_if_fn_do
S5 = step5_tco
S6 = step6_file
S7 = step7_quote
S8 = step8_macros
S9 = step9_try
SA = stepA_mal

.PHONY all: $(S0) $(S1) $(S2) $(S3) $(S4) $(S5) $(S6) $(S7) $(S8) $(S9) $(SA)

$(S0): $(S0_SRC) $(S0_HEADERS)
$(CC) $(CFLAGS) $(S0_SRC) $(LIBS) -o $(S0)

$(S1): $(S1_SRC) $(S1_HEADERS)
$(CC) $(CFLAGS) $(S1_SRC) $(LIBS) -o $(S1)

$(S2): $(S2_SRC) $(S2_HEADERS)
$(CC) $(CFLAGS) $(S2_SRC) $(LIBS) -o $(S2)

$(S3): $(S3_SRC) $(S3_HEADERS)
$(CC) $(CFLAGS) $(S3_SRC) $(LIBS) -o $(S3)

$(S4): $(S4_SRC) $(S4_HEADERS)
$(CC) $(CFLAGS) $(S4_SRC) $(LIBS) -o $(S4)

$(S5): $(S5_SRC) $(S5_HEADERS)
$(CC) $(CFLAGS) $(S5_SRC) $(LIBS) -o $(S5)

$(S6): $(S6_SRC) $(S6_HEADERS)
$(CC) $(CFLAGS) $(S6_SRC) $(LIBS) -o $(S6)

$(S7): $(S7_SRC) $(S7_HEADERS)
$(CC) $(CFLAGS) $(S7_SRC) $(LIBS) -o $(S7)

$(S8): $(S8_SRC) $(S8_HEADERS)
$(CC) $(CFLAGS) $(S8_SRC) $(LIBS) -o $(S8)

$(S9): $(S9_SRC) $(S9_HEADERS)
$(CC) $(CFLAGS) $(S9_SRC) $(LIBS) -o $(S9)

$(SA): $(SA_SRC) $(SA_HEADERS)
$(CC) $(CFLAGS) $(SA_SRC) $(LIBS) $(FFI_LIBS) -DWITH_FFI -o $(SA)

.PHONY clean:
rm -f $(S0) $(S1) $(S2) $(S3) $(S4) $(S5) $(S6) $(S7) $(S8) $(S9) $(SA)
Loading

0 comments on commit fe6c42e

Please sign in to comment.