Compare commits
No commits in common. "master" and "v0.1.1" have entirely different histories.
|
@ -0,0 +1,15 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2020 CismonX <admin@cismon.net>
|
||||||
|
#
|
||||||
|
# Copying and distribution of this file, with or without modification, are
|
||||||
|
# permitted in any medium without royalty, provided the copyright notice and
|
||||||
|
# this notice are preserved. This file is offered as-is, without any warranty.
|
||||||
|
#
|
||||||
|
|
||||||
|
ignore:
|
||||||
|
- "src/logging.c"
|
||||||
|
- "src/mnemonic.c"
|
||||||
|
coverage:
|
||||||
|
range: 50..90
|
||||||
|
round: down
|
||||||
|
precision: 2
|
23
.drone.yml
23
.drone.yml
|
@ -1,23 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (C) 2021 CismonX <admin@cismon.net>
|
|
||||||
#
|
|
||||||
# Copying and distribution of this file, with or without modification, are
|
|
||||||
# permitted in any medium without royalty, provided the copyright notice and
|
|
||||||
# this notice are preserved. This file is offered as-is, without any warranty.
|
|
||||||
#
|
|
||||||
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: default
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: build
|
|
||||||
image: pureos/byzantium
|
|
||||||
commands:
|
|
||||||
- apt -y update
|
|
||||||
- apt -y install wget build-essential autoconf automake dejagnu
|
|
||||||
- autoreconf --install
|
|
||||||
- ./configure CFLAGS='-O0 -g -std=c99 -Wall -Wextra -Wpedantic --coverage'
|
|
||||||
- make
|
|
||||||
- make check
|
|
||||||
- gcov src/*.c
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2020 CismonX <admin@cismon.net>
|
||||||
|
#
|
||||||
|
# Copying and distribution of this file, with or without modification, are
|
||||||
|
# permitted in any medium without royalty, provided the copyright notice and
|
||||||
|
# this notice are preserved. This file is offered as-is, without any warranty.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Attributes for GitHub Linguist
|
||||||
|
*.h linguist-language=c
|
||||||
|
tests/* linguist-detectable=false
|
||||||
|
configure.ac linguist-detectable=false
|
||||||
|
Makefile.am linguist-detectable=false
|
|
@ -0,0 +1,49 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2020 CismonX <admin@cismon.net>
|
||||||
|
#
|
||||||
|
# Copying and distribution of this file, with or without modification, are
|
||||||
|
# permitted in any medium without royalty, provided the copyright notice and
|
||||||
|
# this notice are preserved. This file is offered as-is, without any warranty.
|
||||||
|
#
|
||||||
|
|
||||||
|
language: c
|
||||||
|
|
||||||
|
os:
|
||||||
|
- linux
|
||||||
|
- osx
|
||||||
|
|
||||||
|
dist: bionic
|
||||||
|
|
||||||
|
compiler:
|
||||||
|
- gcc
|
||||||
|
- clang
|
||||||
|
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
update: true
|
||||||
|
packages:
|
||||||
|
- dejagnu
|
||||||
|
homebrew:
|
||||||
|
update: true
|
||||||
|
packages:
|
||||||
|
- dejagnu
|
||||||
|
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- export GCOV_BIN=`test $TRAVIS_COMPILER = clang && echo 'llvm-cov gcov' || echo gcov`
|
||||||
|
- test $TRAVIS_OS_NAME = osx && export PATH=$PATH:/Library/Developer/CommandLineTools/usr/bin || true
|
||||||
|
|
||||||
|
script:
|
||||||
|
- autoreconf --install
|
||||||
|
- ./configure CFLAGS='-O0 -g -Wall -Wextra -Wpedantic -coverage'
|
||||||
|
- make
|
||||||
|
- make check
|
||||||
|
- $GCOV_BIN src/*.c
|
||||||
|
- sudo make install
|
||||||
|
- command -v u6a u6ac
|
||||||
|
|
||||||
|
after_success:
|
||||||
|
- test $TRAVIS_OS_NAME = osx && true || bash <(curl -s https://codecov.io/bash)
|
63
README.md
63
README.md
|
@ -1,54 +1,43 @@
|
||||||
<!--
|
<!--
|
||||||
Copyright (C) 2020,2021 CismonX <admin@cismon.net>
|
Copyright (C) 2020 CismonX <admin@cismon.net>
|
||||||
|
|
||||||
Copying and distribution of this file, with or without modification, are
|
Copying and distribution of this file, with or without modification, are
|
||||||
permitted in any medium without royalty, provided the copyright notice and
|
permitted in any medium without royalty, provided the copyright notice and
|
||||||
this notice are preserved. This file is offered as-is, without any warranty.
|
this notice are preserved. This file is offered as-is, without any warranty.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
U6a
|
# U6a
|
||||||
===
|
|
||||||
|
|
||||||
[![Build Status]](https://drone.cismon.net/esolangs/u6a) [![License]](LICENSE)
|
[![Travis CI](https://travis-ci.com/esolangs/u6a.svg)](https://travis-ci.com/esolangs/u6a)
|
||||||
|
[![Codecov](https://codecov.io/gh/esolangs/u6a/branch/master/graphs/badge.svg)](https://codecov.io/gh/esolangs/u6a)
|
||||||
|
[![LICENSE](https://img.shields.io/badge/license-GPL--3.0--or--later-blue.svg)](LICENSE)
|
||||||
|
|
||||||
Implementation of Unlambda, an esoteric programming language.
|
Implementation of Unlambda, an esoteric programming language.
|
||||||
|
|
||||||
Description
|
## Description
|
||||||
-----------
|
|
||||||
|
|
||||||
The U6a project provides a bytecode compiler and a runtime system for the
|
The U6a project provides a bytecode compiler and a runtime system for the [Unlambda](http://www.madore.org/~david/programs/unlambda/) programming language.
|
||||||
[Unlambda] programming language.
|
|
||||||
|
|
||||||
Ideas behind this implementation can be found [here][U6a wiki].
|
Ideas behind this implementation can be found [here](https://github.com/esolangs/u6a/wiki/Developer's-Notes-on-Implementing-Unlambda).
|
||||||
|
|
||||||
U6a is free software. You can redistribute it and/or modify it under the
|
U6a is free software. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
terms of the GNU General Public License as published by the Free Software
|
|
||||||
Foundation, either version 3 of the License, or (at your option) any later
|
|
||||||
version.
|
|
||||||
|
|
||||||
Getting Started
|
## Getting Started
|
||||||
---------------
|
|
||||||
|
|
||||||
To install U6a from source, see INSTALL.md.
|
To install U6a from source, see [INSTALL](INSTALL).
|
||||||
|
|
||||||
Usage (See the u6ac(1) and u6a(1) man pages for details):
|
Usage (See [**u6ac**(1)](man/u6ac.1) and [**u6a**(1)](man/u6a.1) man pages for details):
|
||||||
|
|
||||||
# Compile an Unlambda source file into bytecode.
|
```bash
|
||||||
u6ac -o foo.unl.bc foo.unl
|
# Compile an Unlambda source file into bytecode.
|
||||||
# Execute the bytecode file.
|
u6ac -o foo.unl.bc foo.unl
|
||||||
u6a foo.unl.bc
|
# Execute the bytecode file.
|
||||||
|
u6a foo.unl.bc
|
||||||
|
```
|
||||||
|
|
||||||
Future Plans
|
## Future Plans
|
||||||
------------
|
|
||||||
|
|
||||||
* Interactive debugger: u6adb
|
* Interactive debugger: `u6adb`
|
||||||
* More compile-time optimizations
|
* More compile-time optimizations
|
||||||
* More test cases
|
* More test cases
|
||||||
* LLVM backend for u6ac
|
* LLVM backend for `u6ac`
|
||||||
|
|
||||||
<!-- Reference Links -->
|
|
||||||
|
|
||||||
[Build Status]: https://drone.cismon.net/api/badges/esolangs/u6a/status.svg
|
|
||||||
[License]: https://img.shields.io/badge/license-GPL--3.0--or--later-blue.svg
|
|
||||||
[Unlambda]: http://www.madore.org/~david/programs/unlambda/
|
|
||||||
[U6a wiki]: https://git.cismon.net/esolangs/u6a/wiki/Implementing-Unlambda
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ dnl this notice are preserved. This file is offered as-is, without any warranty.
|
||||||
dnl
|
dnl
|
||||||
|
|
||||||
AC_PREREQ([2.69])
|
AC_PREREQ([2.69])
|
||||||
AC_INIT([u6a], [0.1.2], [bug-report@cismon.net])
|
AC_INIT([u6a], [0.01], [bug-report@cismon.net])
|
||||||
AM_INIT_AUTOMAKE([foreign])
|
AM_INIT_AUTOMAKE([foreign])
|
||||||
AC_CONFIG_SRCDIR([src/u6a.c])
|
AC_CONFIG_SRCDIR([src/u6a.c])
|
||||||
AC_CONFIG_HEADERS([config.h])
|
AC_CONFIG_HEADERS([config.h])
|
||||||
|
|
12
man/u6a.1
12
man/u6a.1
|
@ -1,4 +1,4 @@
|
||||||
.TH "U6A" "1" "Jan 30, 2020" "0.1.1" "U6a User Manual"
|
.TH "U6A" "1" "Jan 30, 2020" "0.1.1" "U6A User Manual"
|
||||||
.
|
.
|
||||||
.SH NAME
|
.SH NAME
|
||||||
u6a - Runtime for the Unlambda programming language
|
u6a - Runtime for the Unlambda programming language
|
||||||
|
@ -49,9 +49,8 @@ Prints version number, then exit.
|
||||||
.TP
|
.TP
|
||||||
Version compatiblility:
|
Version compatiblility:
|
||||||
Definition of Unlambda bytecode may differ across multiple versions of u6a.
|
Definition of Unlambda bytecode may differ across multiple versions of u6a.
|
||||||
Execution result is guaranteed to be consistent when both major and minor
|
Execution result is guaranteed to be consistent when both major and minor versions of bytecode file and the interpreter matches.
|
||||||
versions of bytecode file and the interpreter matches. Otherwise, the code
|
Otherwise, the code may not work as expected and the interpreter will refuse to execute unless
|
||||||
may not work as expected and the interpreter will refuse to execute unless
|
|
||||||
.B -f
|
.B -f
|
||||||
option is provided.
|
option is provided.
|
||||||
.TP
|
.TP
|
||||||
|
@ -73,6 +72,5 @@ they could be read by the current Unlambda program.
|
||||||
.SH COPYRIGHT
|
.SH COPYRIGHT
|
||||||
Copyright (c) 2020 CismonX <admin@cismon.net>
|
Copyright (c) 2020 CismonX <admin@cismon.net>
|
||||||
.PP
|
.PP
|
||||||
Copying and distribution of this file, with or without modification, are
|
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty, provided the copyright notice and this notice are preserved.
|
||||||
permitted in any medium without royalty, provided the copyright notice and
|
This file is offered as-is, without any warranty.
|
||||||
this notice are preserved. This file is offered as-is, without any warranty.
|
|
||||||
|
|
33
man/u6ac.1
33
man/u6ac.1
|
@ -1,4 +1,4 @@
|
||||||
.TH "U6A" "1" "Jan 30, 2020" "0.1.1" "U6a User Manual"
|
.TH "U6A" "1" "Jan 30, 2020" "0.1.1" "U6A User Manual"
|
||||||
.
|
.
|
||||||
.SH NAME
|
.SH NAME
|
||||||
u6ac - Bytecode compiler for the Unlambda programming language
|
u6ac - Bytecode compiler for the Unlambda programming language
|
||||||
|
@ -14,8 +14,7 @@ Read and compile Unlambda code from the given
|
||||||
or
|
or
|
||||||
.B STDIN
|
.B STDIN
|
||||||
if "-" is given.
|
if "-" is given.
|
||||||
Compilation result is saved in a special bytecode format, which can be executed
|
Compilation result is saved in a special bytecode format, which can be executed with
|
||||||
with
|
|
||||||
.BR u6a (1).
|
.BR u6a (1).
|
||||||
.
|
.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
|
@ -39,17 +38,15 @@ to the beginning of
|
||||||
.IR out-file .
|
.IR out-file .
|
||||||
Defaults to "#!/usr/bin/env u6a\\n".
|
Defaults to "#!/usr/bin/env u6a\\n".
|
||||||
.TP
|
.TP
|
||||||
\fB\-O\fR[\fIoptimization-level\fR]
|
\fB\-O[\fIoptimization-level\fR]
|
||||||
Compile-time optimization level.
|
Compile-time optimization level.
|
||||||
.BR \-O0 :
|
.BR \-O0 :
|
||||||
Turn off optimization.
|
Turn off optimization.
|
||||||
.BR \-O1 (default):
|
.BR \-O1 (default):
|
||||||
Turn on basic optimizations, including constant folding & propagation,
|
Turn on basic optimizations, including constant folding & propagation, dead code elimination, etc.
|
||||||
dead code elimination, etc.
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-syntax\-only\fR
|
\fB\-\-syntax\-only\fR
|
||||||
Only check for lexical and syntactic correctness of the source file, and skips
|
Only check for lexical and syntactic correctness of the source file, and skips bytecode generation.
|
||||||
bytecode generation.
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-S\fR
|
\fB\-S\fR
|
||||||
Produce mnemonic pseudo-instructions instead of bytecode.
|
Produce mnemonic pseudo-instructions instead of bytecode.
|
||||||
|
@ -72,24 +69,21 @@ Prints version number, then exit.
|
||||||
.SS Unlambda
|
.SS Unlambda
|
||||||
.TP
|
.TP
|
||||||
Language features:
|
Language features:
|
||||||
All features of Unlambda 2.0 are supported, including I/O functions,
|
All features of Unlambda 2.0 are supported, including I/O functions, continuations and promises.
|
||||||
continuations and promises.
|
|
||||||
.TP
|
.TP
|
||||||
Comments:
|
Comments:
|
||||||
Text in line comments is not restricted to ASCII only. UTF-8 format is also
|
Text in line comments is not restricted to ASCII only. UTF-8 format is also supported.
|
||||||
supported.
|
|
||||||
.TP
|
.TP
|
||||||
Function names:
|
Function names:
|
||||||
Charactor X in functions
|
Charactor X in functions
|
||||||
.B .X
|
.B .X
|
||||||
and
|
and
|
||||||
.B ?X
|
.B ?X
|
||||||
must be printable ASCII or "\\n" (beware if you are using Windows-style
|
must be printable ASCII or "\\n" (beware if you are using Windows-style newlines), and are case-sensitive.
|
||||||
newlines), and are case-sensitive. Other builtin function names are
|
Other builtin function names are case-insensitive.
|
||||||
case-insensitive.
|
|
||||||
.SS Code Size
|
.SS Code Size
|
||||||
Unlambda code size should not be larger than 4MiB (not counting comments and
|
Unlambda code size should not be larger than 4MiB (not counting comments and whitespaces).
|
||||||
whitespaces). You may change this limit in
|
You may change this limit in
|
||||||
.B defs.h
|
.B defs.h
|
||||||
and rebuild U6a for larger code to compile.
|
and rebuild U6a for larger code to compile.
|
||||||
.
|
.
|
||||||
|
@ -99,6 +93,5 @@ and rebuild U6a for larger code to compile.
|
||||||
.SH COPYRIGHT
|
.SH COPYRIGHT
|
||||||
Copyright (c) 2020 CismonX <admin@cismon.net>
|
Copyright (c) 2020 CismonX <admin@cismon.net>
|
||||||
.PP
|
.PP
|
||||||
Copying and distribution of this file, with or without modification, are
|
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty, provided the copyright notice and this notice are preserved.
|
||||||
permitted in any medium without royalty, provided the copyright notice and
|
This file is offered as-is, without any warranty.
|
||||||
this notice are preserved. This file is offered as-is, without any warranty.
|
|
||||||
|
|
|
@ -49,6 +49,6 @@
|
||||||
#define U6A_MAGIC 0xDC /* Latin 'U' with diaeresis */
|
#define U6A_MAGIC 0xDC /* Latin 'U' with diaeresis */
|
||||||
#define U6A_VER_MAJOR 0x00
|
#define U6A_VER_MAJOR 0x00
|
||||||
#define U6A_VER_MINOR 0x01
|
#define U6A_VER_MINOR 0x01
|
||||||
#define U6A_VER_PATCH 0x02
|
#define U6A_VER_PATCH 0x01
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -98,6 +98,6 @@ const char*
|
||||||
u6a_logging_get_prog_name_();
|
u6a_logging_get_prog_name_();
|
||||||
|
|
||||||
#define u6a_info_verbose(stage, info_message, ...) \
|
#define u6a_info_verbose(stage, info_message, ...) \
|
||||||
u6a_info_verbose_("%s: [%s] " info_message ".\n", u6a_logging_get_prog_name_(), stage, __VA_ARGS__)
|
u6a_info_verbose_("%s: [%s] " info_message ".\n", u6a_logging_get_prog_name_(), stage, ##__VA_ARGS__)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -75,7 +75,7 @@ u6a_parse(struct u6a_token* token_arr, uint32_t token_len, struct u6a_ast_node**
|
||||||
}
|
}
|
||||||
free(pstack);
|
free(pstack);
|
||||||
*ast_arr = ast;
|
*ast_arr = ast;
|
||||||
u6a_info_verbose(info_parse, "%s", "completed");
|
u6a_info_verbose(info_parse, "completed");
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
parse_failed:
|
parse_failed:
|
||||||
|
|
|
@ -10,7 +10,7 @@ set tool "default"
|
||||||
set timeout 20
|
set timeout 20
|
||||||
|
|
||||||
puts "Downloading files..."
|
puts "Downloading files..."
|
||||||
exec wget --quiet "ftp://ftp.madore.org/pub/madore/unlambda/unlambda-2.0.0.tar.gz"
|
exec wget --quiet "http://www.eleves.ens.fr:8080/home/madore/unlambda-2.0.0.tar.gz"
|
||||||
puts "Extracting archive..."
|
puts "Extracting archive..."
|
||||||
exec tar -zxvf "unlambda-2.0.0.tar.gz" >& /dev/null
|
exec tar -zxvf "unlambda-2.0.0.tar.gz" >& /dev/null
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue