Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
wbbradley committed Jul 8, 2024
1 parent eb8fd6e commit 3625374
Show file tree
Hide file tree
Showing 361 changed files with 588 additions and 588 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**/docs
**/*.ll
**/*.ir
**/cider
**/ace
**/*.o
**/logs
lib # Gets mounted using -v in docker-run.sh
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ a.out
test.c
test
env
cider
!cider.*
ace
!ace.*
logs
*.llir
*.log
Expand All @@ -35,7 +35,7 @@ rt_gc
*.ll
*.html
*.pyc
!**/*.cider
!**/*.ace
*.zx
CMakeCache.txt
CMakeFiles/
Expand Down
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.4.3)
project(Cider)
project(Ace)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down Expand Up @@ -38,7 +38,7 @@ endif()
option(DEBUG "Build a Debug build" OFF)
if(DEBUG)
message("Compiling in Debug mode...")
add_definitions(-DCIDER_DEBUG)
add_definitions(-DACE_DEBUG)
add_compile_options(-std=c++17 -g -O0 -Wall -Werror ${option_flags})
else()
message("Compiling in Release mode...")
Expand All @@ -47,7 +47,7 @@ endif()

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lpthread -std=c++17 -Wl,-rpath,${LLVM_INSTALL_PREFIX}/lib")

add_executable(cider
add_executable(ace
src/ast.cpp
src/builtins.cpp
src/class_predicate.cpp
Expand Down Expand Up @@ -98,6 +98,6 @@ add_executable(cider


message(STATUS "Using dynamic link options -L${LLVM_LIBRARY_DIR} -lLLVM")
target_link_libraries(cider -L${LLVM_LIBRARY_DIR} -lLLVM)
target_link_libraries(ace -L${LLVM_LIBRARY_DIR} -lLLVM)


6 changes: 3 additions & 3 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Development of Cider
# Development of Ace

## Machine setup

So far all development of Cider has taken place on MacOS and Linux. The most
So far all development of Ace has taken place on MacOS and Linux. The most
well-supported path is to develop on MacOS at the moment. However, all tests in
GitHub Actions are running in a Docker debian:latest container. Consult
[Dockerfile](Dockerfile) for more info on that test setup.
Expand All @@ -21,7 +21,7 @@ You will need Docker for the supported Linux test path.
#### Plugins

* If you use vim, take a look at
[vim-cider](https://github.com/ciderlang/vim-cider).
[vim-ace](https://github.com/acelang/vim-ace).


## Development workflow
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN echo "nmap ; :" >> /root/.vimrc
RUN echo "imap jk <Esc>" >> /root/.vimrc
RUN echo "imap kj <Esc>" >> /root/.vimrc

ADD . /opt/cider
WORKDIR /opt/cider
ADD . /opt/ace
WORKDIR /opt/ace

CMD bash
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Cider Programming Language
Ace Programming Language

MIT License

Expand Down
36 changes: 18 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PN = cider
PN = ace

# TODO: ifeq ($(OS),Windows_NT)
UNAME_S := $(shell uname -s)
Expand All @@ -13,7 +13,7 @@ BUILD_DIR ?= $(HOME)/var/$(PN)
SRCDIR = $(shell pwd)
LLVM_DIR ?= $(shell $(LLVM_CONFIG) --cmakedir)
prefix ?= /usr/local
BUILT_BINARY = $(BUILD_DIR)/cider
BUILT_BINARY = $(BUILD_DIR)/ace
MAKEFLAGS=--no-print-directory

# Installation-related directories
Expand All @@ -24,19 +24,19 @@ stdlibdir = $(sharedir)/lib
runtimedir = $(sharedir)/runtime
man1dir ?= $(DESTDIR)/$(prefix)/share/man/man1
manfile = $(man1dir)/$(PN).1
test_destdir ?= $(HOME)/var/cider-test
test_destdir ?= $(HOME)/var/ace-test

.PHONY: release
release:
make DEBUG= cider
make DEBUG= ace

.PHONY: debug
debug:
make DEBUG=1 cider
make DEBUG=1 ace

.PHONY: cider
cider:
-@echo "Building Cider..."
.PHONY: ace
ace:
-@echo "Building Ace..."
# make clean
make install

Expand All @@ -45,7 +45,7 @@ uninstall:
-rm -rf $(sharedir)
-rm $(bindir)/$(PN)
-rm $(manfile)
-rm $(bindir)/cider-tags
-rm $(bindir)/ace-tags

.PHONY: $(BUILT_BINARY)
$(BUILT_BINARY): $(BUILD_DIR)/Makefile
Expand All @@ -62,12 +62,12 @@ $(BUILD_DIR)/Makefile: $(LLVM_DIR)/LLVMConfig.cmake CMakeLists.txt
(cd $(BUILD_DIR) && LLVM_DIR="$(LLVM_DIR)" cmake $(SRCDIR) -DDEBUG=ON -G 'Unix Makefiles') \
fi

CIDER_LIBS=$(shell cd lib && find *.cider)
ACE_LIBS=$(shell cd lib && find *.ace)
RUNTIME_C_FILES=$(shell find runtime -regex '.*\.c$$')

.PHONY: install
install: $(BUILT_BINARY) $(addprefix $(SRCDIR)/lib/,$(CIDER_LIBS)) $(RUNTIME_C_FILES) $(SRCDIR)/$(PN).1 cider-tags
-echo "Installing Cider to ${DESTDIR}..."
install: $(BUILT_BINARY) $(addprefix $(SRCDIR)/lib/,$(ACE_LIBS)) $(RUNTIME_C_FILES) $(SRCDIR)/$(PN).1 ace-tags
-echo "Installing Ace to ${DESTDIR}..."
-echo "Making sure that various installation dirs exist..."
mkdir -p $(bindir)
-rm -rf $(stdlibdir)
Expand All @@ -78,11 +78,11 @@ install: $(BUILT_BINARY) $(addprefix $(SRCDIR)/lib/,$(CIDER_LIBS)) $(RUNTIME_C_F
mkdir -p $(runtimedir)
-echo "Copying compiler binary from $(BUILT_BINARY) to $(bindir)..."
cp $(BUILT_BINARY) $(bindir)
cp ./cider-tags $(bindir)
cp ./ace-tags $(bindir)
for f in $(RUNTIME_C_FILES); do cp "$$f" "$(runtimedir)"; done
cp $(addprefix $(SRCDIR)/lib/,$(CIDER_LIBS)) $(stdlibdir)
cp $(addprefix $(SRCDIR)/lib/,$(ACE_LIBS)) $(stdlibdir)
cp $(SRCDIR)/$(PN).1 $(man1dir)
-test -x ./cider-link-to-src && CIDER_ROOT=$(sharedir) ./cider-link-to-src
-test -x ./ace-link-to-src && ACE_ROOT=$(sharedir) ./ace-link-to-src

.PHONY: clean
clean:
Expand All @@ -95,12 +95,12 @@ install-test:

.PHONY: test
test:
-@echo "Running Tests for Cider..."
-@echo "Running Tests for Ace..."
make $(BUILT_BINARY)
$(BUILT_BINARY) unit-test
make install-test
@echo "CIDER_ROOT=$(test_destdir)/$(prefix)/share/$(PN)"
@CIDER_ROOT="$(test_destdir)/$(prefix)/share/$(PN)" \
@echo "ACE_ROOT=$(test_destdir)/$(prefix)/share/$(PN)"
@ACE_ROOT="$(test_destdir)/$(prefix)/share/$(PN)" \
"$(SRCDIR)/tests/run-tests.sh" \
"$(test_destdir)/$(prefix)/bin" \
"$(SRCDIR)"
Expand Down
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
# Cider Language
# Ace Language


[![Tests](https://github.com/ciderlang/cider/workflows/Tests/badge.svg)](https://github.com/ciderlang/cider/actions?query=workflow%3ATests)
[![Tests](https://github.com/acelang/ace/workflows/Tests/badge.svg)](https://github.com/acelang/ace/actions?query=workflow%3ATests)

## Fundamentals

Cider resembles a combination of Haskell and C, with garbage collection, eager
Ace resembles a combination of Haskell and C, with garbage collection, eager
evaluation, static type-checking, purity and impurity (when you want it), extensible infix operators,
type-classes to allow ad-hoc polymorphism, `with` control-flow semantics for bracketing resource usage, pattern-matching, and type inference.

## Quick Start

To play with Cider in Docker, try this.
To play with Ace in Docker, try this.

```
git clone https://github.com/ciderlang/cider.git
cd cider
git clone https://github.com/acelang/ace.git
cd ace
# Get a docker image set up ready to run a build (assumes Docker is running).
./docker-build.sh && ./docker-run.sh bash
# The prior command should open up a bash prompt within a new docker container.
# Build and install Cider inside this container.
# Build and install Ace inside this container.
make install
# The prior command should have installed Cider to /usr/local. Set up the
# $CIDER_ROOT environment variable.
export CIDER_ROOT="/usr/local/share/cider"
# The prior command should have installed Ace to /usr/local. Set up the
# $ACE_ROOT environment variable.
export ACE_ROOT="/usr/local/share/ace"
# Build and run a simple test program
cd
echo 'fn main() { print("Hello world.") }' > hello_world.cider
cider hello_world
echo 'fn main() { print("Hello world.") }' > hello_world.ace
ace hello_world
# Read more
man cider
man ace
```

## Description

Cider is a statically typed procedural/functional language. It is a work in
Ace is a statically typed procedural/functional language. It is a work in
progress. Please reach out if you'd like to get involved.

### Syntax
Expand Down Expand Up @@ -105,7 +105,7 @@ fn main() {

### Semantics

The evaluation of Cider is strict, not lazy. The call-by-value method of passing
The evaluation of Ace is strict, not lazy. The call-by-value method of passing
arguments is used.

### Mutability
Expand Down Expand Up @@ -138,7 +138,7 @@ fn main() {

### Encapsulation

There is no class-based encapsulation in Cider. Encapsulation can be achieved by
There is no class-based encapsulation in Ace. Encapsulation can be achieved by

1. using modules to implement Abstract Data Types, exposing only the functions
relevant to the creation, use, and lifetime of a type.
Expand All @@ -147,14 +147,14 @@ There is no class-based encapsulation in Cider. Encapsulation can be achieved by

#### Modularity

Cider lacks support for shared libraries or any shareable intermediate
Ace lacks support for shared libraries or any shareable intermediate
representation. Code complexity and leaky abstractions can still be avoided by
limiting which symbols are exposed from source modules.

### Type System

Types are inferred but type annotations are also allowed/encouraged as
documentation and sometimes necessary when types cannot be inferred. Cider
documentation and sometimes necessary when types cannot be inferred. Ace
rejects [intermediate type defaulting](https://kseo.github.io/posts/2017-01-04-type-defaulting-in-haskell.html) by design. Although, if a good
design for that comes along, it might happen.

Expand All @@ -164,14 +164,14 @@ Polymorphism comes in two flavors.

Type-based polymorphism exists at compile time in the ability to use type
variables which are re-bound per function invocation. At run-time, there are a
couple different notions of polymorphism. First, Cider supports sum types by
couple different notions of polymorphism. First, Ace supports sum types by
allowing the declaration of types with multiple data constructors. This then
relies on `match` statements (pattern matching) to branch on the run-time
value. This form of polymorphism may feel unfamiliar to folks coming from "OOP"
languages that rely on inheritance and/or abstract classes with any number of
derived implementations.

Since Cider treats functions as values and allows closure over function
Since Ace treats functions as values and allows closure over function
definitions (`fn`), you can `return` new behaviors as functions. Users of those
functions will get statically checked run-time varying behavior (aka run-time
polymorphism). For example, the `Iterable` type-class requires the definition
Expand Down Expand Up @@ -200,9 +200,9 @@ the target host.
### Learning more

The best way to learn more at this time is to read through the
`tests/test_*.cider` code.
`tests/test_*.ace` code.

TODO: struct types do not support pattern matching. proposed solution: eliminate
structs, but add names to newtypes.

[![HitCount](http://hits.dwyl.com/ciderlang/cider.svg)](http://hits.dwyl.com/ciderlang/cider)
[![HitCount](http://hits.dwyl.com/acelang/ace.svg)](http://hits.dwyl.com/acelang/ace)
6 changes: 3 additions & 3 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
- [x] int matching
- [x] tuple matching
- [x] string matching
- [x] Play: Rewrite expect.py in Cider
- [x] Play: Rewrite expect.py in Ace
- [x] decide on `with` (Python) / `using`(`dispose`) (C#) / 'defer' (Golang) style syntax for deterministic destruction - or ref-counting
- [x] Implement generic in-place sort for vectors
- [x] Ergo: Ability to import symbols from modules by name (symbol injection)
- [x] Add safety checks on casting (as)
- [x] Exercise: implement parser combinators in Cider
- [x] Exercise: implement parser combinators in Ace
- [x] Implement closures with capture by value
- [x] Implement backtracking in unification of product types
- [x] Consider marking null-terminated strings differently for FFI purposes (ended up doing this as part of "safe-unboxing" for easier FFI.
Expand All @@ -51,7 +51,7 @@
- [x] change `str` to use `wchar_t` as its underlying physical character type
- [x] use C99's `mbstowcs` and `wcstombs` to convert back and forth
- [x] propagate usage of utf8 for `char`
- [x] 'for' syntax - based on `tests/test_list_iter.cider` pattern
- [x] 'for' syntax - based on `tests/test_list_iter.ace` pattern
- [x] Ternary operator
- [x] Logical and/or (build with ternary operator)
- [x] Type refinements for ternary / conditional expressions
Expand Down
10 changes: 10 additions & 0 deletions ace-link-to-src
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
# Note this assumes ACE_SRC_DIR is $HOME/src/ace.
ACE_SRC_DIR="${ACE_SRC_DIR:-$PWD}"
ACE_ROOT="${ACE_ROOT:-/usr/local/share/ace}"

cd "$ACE_ROOT" || { printf "Couldn't cd into %s.\n" "$ACE_ROOT"; exit 1; }
rm -rf runtime
rm -rf lib
ln -s "$ACE_SRC_DIR/runtime" .
ln -s "$ACE_SRC_DIR/lib" .
18 changes: 9 additions & 9 deletions cider-tags → ace-tags
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if [ $# -eq 0 ]; then
targets=(
.
"$(maybe-dir "$(llvm-config --cppflags | xargs -n 1 echo | grep '^-I' | cut -c3-)")"
"${CIDER_ROOT:-/usr/local/share/cider}"
"${ACE_ROOT:-/usr/local/share/ace}"
)
else
targets=(
Expand All @@ -29,7 +29,7 @@ trap 'rm -f "$ztags"' EXIT
# shellcheck disable=SC2068
ctags -f "$tags_file" -R ${targets[@]} || exit 1

gather-cider-tags() {
gather-ace-tags() {
keyword=$1
code=$2
allow_indent=$3
Expand All @@ -42,7 +42,7 @@ gather-cider-tags() {
# shellcheck disable=SC2068
for target in ${targets[@]}; do
# shellcheck disable=SC2038
find -L "$target" -regex '.*\.cider$' \
find -L "$target" -regex '.*\.ace$' \
| xargs grep -ERn "^$indent$keyword$spacePlus.*" \
| sed \
-Ene \
Expand All @@ -51,12 +51,12 @@ gather-cider-tags() {
done
}

gather-cider-tags "let" "v"
gather-cider-tags "fn" "f" 1
gather-cider-tags "class" "s"
gather-cider-tags "instance" "s"
gather-cider-tags "newtype" "s"
gather-cider-tags "struct" "s"
gather-ace-tags "let" "v"
gather-ace-tags "fn" "f" 1
gather-ace-tags "class" "s"
gather-ace-tags "instance" "s"
gather-ace-tags "newtype" "s"
gather-ace-tags "struct" "s"
# TODO: support data-ctors

cat "$tags_file" >> "$ztags"
Expand Down
Loading

0 comments on commit 3625374

Please sign in to comment.