Skip to content

Commit

Permalink
Merge pull request #262 from lmntal/develop
Browse files Browse the repository at this point in the history
Version 2.5.0
  • Loading branch information
sano-jin authored Apr 19, 2021
2 parents eebf0d9 + a42b938 commit 6610087
Show file tree
Hide file tree
Showing 94 changed files with 3,042 additions and 1,768 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: C/C++ CI

on: push

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
# - cc: gcc
# cxx: g++
# - cc: clang
# cxx: clang++
# - cc: gcc
# cxx: g++
# debug_flag: "--enable-debug"
# - cc: clang
# cxx: clang++
# debug_flag: "--enable-debug"
- cc: gcc
cxx: g++
slim_check_nd: "yes"
- cc: clang
cxx: clang++
slim_check_nd: "yes"
env:
DEBUG_FLAG: ${{ matrix.debug_flag }}
slim_CHECK_ND: ${{ matrix.slim_check_nd }}
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
LMNTAL_HOME: ${{ github.workspace }}/lmntal-compiler
steps:
- uses: actions/checkout@v2
- run: sudo apt -qq update
- run: sudo apt install -y ant re2c
- run: git clone https://github.com/lmntal/lmntal-compiler.git
- run: cd lmntal-compiler && ant compile && cd ..
- run: ./autogen.sh
- run: ./configure $DEBUG_FLAG
- run: make
- run: make check
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

6 changes: 6 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
SLIM (2.5.0) -- 2021/04/19
* new feature
+ add --history-management
+ add --shuffle
* refactoring

SLIM (2.4.0) -- 2019/07/15
* migrate from C into C++
* refactoring
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.1
2.5.0
3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# $Id: configure.ac,v 1.13 2008/10/05 11:22:41 riki Exp $

AC_PREREQ(2.61)
AC_INIT([SLIM], [2.4.0], [lmntal@ueda.info.waseda.ac.jp], [slim])
AC_INIT([SLIM], [2.5.0], [lmntal@ueda.info.waseda.ac.jp], [slim])
# AC_REVISION($Revision: 1.13 $)
# AC_COPYRIGHT (copyright-notice)
AC_CANONICAL_TARGET
Expand Down Expand Up @@ -322,6 +322,7 @@ AC_HEADER_TIME
# AC_CHECK_HEADERS(pty.h util.h libutil.h sys/loadavg.h)
AC_CHECK_HEADERS(sched.h syscall.h)
AC_CHECK_HEADERS(omp.h)
AC_CHECK_HEADERS(execinfo.h)

if test "$enable_tcmalloc" = "yes"; then
AC_CHECK_HEADERS(gperftools/tcmalloc.h,,
Expand Down
1 change: 1 addition & 0 deletions lib/set.lmn
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ HISTORY

set.free(Set) :- class(Set, "set") |
'$callback'('cb_set_free', Set).
set.free(set_empty) :- .

Ret = set.insert(Set, Val) :- class(Set, "set") |
'$callback'('cb_set_insert', Set, Val, Ret).
Expand Down
24 changes: 24 additions & 0 deletions lib/string.lmn
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,28 @@ S = string.join(Glue, [A]) :- string(Glue) | S = A.
S = string.join(Glue, [A,B|X]) :- string(Glue) |
S = string.concat(A, string.concat(Glue, string.join(Glue, [B|X]))).


/**
* string.replace(+Str, +SubStr, +ReplacementStr, -Ret)
*
* 文字列Str中の全てのSubStrをReplacementStrで置き換える
* @param +Str 元の文字列
* @param +SubStr 置き換えたい文字列
* @param +ReplacementStr 置き換え後の文字列
* @param -Res 結果(文字列)
*/
Ret = string.replace(S, Sub, Rep) :- string(S), string(Sub), string(Rep) |
'$callback'('string_replace', S, Sub, Rep, Ret).

/**
* string.split(+Str, +Separator, -StrList)
*
* 文字列Strを分割してStrListに格納する。分割箇所は文字列Separatorで決定する。
* @param +Str 元の文字列
* @param +Separator セパレータ。空文字の場合1文字ずつ分割される。
* @param -StrList 結果(文字列のリスト)
*/
Ret = string.split(S, Sep) :- string(S), string(Sep) |
'$callback'('string_split', S, Sep, Ret).

}.
49 changes: 21 additions & 28 deletions lib/system_ruleset.lmn
Original file line number Diff line number Diff line change
Expand Up @@ -115,97 +115,90 @@ H = '>>'(A, 0) :- H=A.
H='+.'(A, B) :- float(A),float(B),A+.B=C | H=C.

/**
* H = '-'(A,B):
* H = '-.'(A,B):
*
* H is bound to A-B
*/
H='-.'(A, B) :- float(A),float(B),A-B=C | H=C.
H='-.'(A, B) :- float(A),float(B),A-.B=C | H=C.

/**
* H = '*.'(A,B):
*
* H is bound to A*B
*/
H='*.'(A, B) :- float(A),float(B),A*B=C | H=C.
H='*.'(A, B) :- float(A),float(B),A*.B=C | H=C.

/**
* H = '/'(A,B):
* H = '/.'(A,B):
*
* H is bound to A/B
*/
H='/'(A, B) :- float(A),float(B),A/B=C | H=C.

/**
* H = mod(A,B):
*
* H is bound to A mod B
*/
H=mod(A, B) :- float(A),float(B),A mod B = C | H=C.
H='/.'(A, B) :- float(A),float(B),A/.B=C | H=C.

/*
* H='>'(A,B):
*
* H is bound to true when A>B, false otherwise
*/
H='>'(A, B) :- float(A),float(B),A>B | H=true.
H='>'(A, B) :- float(A),float(B),A=<B | H=false.
H='>'(A, B) :- float(A),float(B),A>.B | H=true.
H='>'(A, B) :- float(A),float(B),A=<.B | H=false.

/*
* H='<'(A,B):
*
* H is bound to true when A<B, false otherwise
*/
H='<'(A, B) :- float(A),float(B),A>=B | H=false.
H='<'(A, B) :- float(A),float(B),A<B | H=true.
H='<'(A, B) :- float(A),float(B),A>=.B | H=false.
H='<'(A, B) :- float(A),float(B),A<.B | H=true.

/*
* H='>='(A,B):
*
* H is bound to true when A>=B, false otherwise
*/
H='>='(A, B) :- float(A),float(B),A>=B | H=true.
H='>='(A, B) :- float(A),float(B),A<B | H=false.
H='>='(A, B) :- float(A),float(B),A>=.B | H=true.
H='>='(A, B) :- float(A),float(B),A<.B | H=false.

/*
* H='=<'(A,B):
*
* H is bound to true when A=<B, false otherwise
*/
H='=<'(A, B) :- float(A),float(B),A>B | H=false.
H='=<'(A, B) :- float(A),float(B),A=<B | H=true.
H='=<'(A, B) :- float(A),float(B),A>.B | H=false.
H='=<'(A, B) :- float(A),float(B),A=<.B | H=true.

/*
* H='=='(A,B):
*
* H is bound to true when A==B, false otherwise
*/
H='=='(A, B) :- float(A),float(B),A=B | H=true.
H='=='(A, B) :- float(A),float(B),A-B>0 | H=false.
H='=='(A, B) :- float(A),float(B),A-B<0 | H=false.
H='=='(A, B) :- float(A),float(B),A=:=.B | H=true.
H='=='(A, B) :- float(A),float(B),A-.B>.0 | H=false.
H='=='(A, B) :- float(A),float(B),A-.B<.0 | H=false.

/*
* H='!='(A,B):
*
* H is bound to true when A!=B, false otherwise
*/
H='!='(A, B) :- float(A),float(B),A=B | H=false.
H='!='(A, B) :- float(A),float(B),A-B>0 | H=true.
H='!='(A, B) :- float(A),float(B),A-B<0 | H=true.
H='!='(A, B) :- float(A),float(B),A=\=.B | H=false.
H='!='(A, B) :- float(A),float(B),A-B>.0 | H=true.
H='!='(A, B) :- float(A),float(B),A-B<.0 | H=true.

/*
* H='<<'(A,B):
*
* H is bound to A shift left by N bits
*/
H = '<<'(A, N) :- float(A),float(N),N>0 | H='<<'(A*2,N-1).
H = '<<'(A, N) :- float(A),float(N),N>0 | H='<<'(A*.2,N-.1).
H = '<<'(A, 0) :- H=A.

/*
* H='>>'(A,B):
*
* H is bound to A shift right by N bits
*/
H = '>>'(A, N) :- float(A),float(N),N>0 | H='>>'(A/2,N-1).
H = '>>'(A, N) :- float(A),float(N),N>0 | H='>>'(A/.2,N-.1).
H = '>>'(A, 0) :- H=A.

}.
47 changes: 47 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

name: lmntal-slim
version: git # just for humans, typically '1.2+git' or '1.3.2'
summary: SLIM - Slim LMNtal Imprementation # 79 char long summary
description: |
SLIM is the de-facto standard runtime of
a hierarchical graph rewriting language, LMNtal,
and also has powerful features of model checkers.
base: core18

grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots

architectures: [amd64]

parts:
lmntal-slim:
# See 'snapcraft plugins'
plugin: autotools
# install-via: prefix
source: .
configflags: ["--datadir=/snap/$SNAPCRAFT_PROJECT_NAME/current/share"]
organize:
snap/$SNAPCRAFT_PROJECT_NAME/current/share: share
build-environment:
- LMNTAL_HOME: /snap/lmntal-compiler/current/lib/lmntal-compiler
build-snaps:
- lmntal-compiler
build-packages:
- g++
- make
- automake
- autoconf
- flex
- bison
- ruby
- libtool
- re2c
- openjdk-8-jre
stage-packages:
- libgomp1

apps:
lmntal-slim:
command: slim
plugs: [home]
3 changes: 2 additions & 1 deletion src/element/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ liblmn_elm_a_SOURCES = \
queue.cpp queue.h \
st.cpp st.h \
util.cpp util.h \
vector.cpp vector.h
vector.cpp vector.h \
life_time.cpp

2 changes: 2 additions & 0 deletions src/element/element.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,7 @@
#include "conditional_ostream.hpp"
#include "optional.hpp"
#include "range_remove_if.hpp"
#include "stack_trace.hpp"
#include "life_time.hpp"

#endif /* LMN_ELEMENT_H */
40 changes: 10 additions & 30 deletions src/vm/memstack.h → src/element/life_time.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/*
* memstack.c - Membrane Stack implementation
* life_time.cpp
*
* Copyright (c) 2008, Ueda Laboratory LMNtal Group
* <lmntal@ueda.info.waseda.ac.jp>
* All rights reserved.
* Copyright (c) 2018, Ueda Laboratory LMNtal Group
* <lmntal@ueda.info.waseda.ac.jp> All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -33,33 +32,14 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*/

#ifndef LMN_MEMSTACK_H
#define LMN_MEMSTACK_H

/**
* @ingroup VM
* @defgroup Memstack
* @{
*/

typedef struct Vector *LmnMemStack;

#include "element/element.h"
#include "membrane.h"

LmnMemStack lmn_memstack_make(void);
void lmn_memstack_free(LmnMemStack memstack);
BOOL lmn_memstack_isempty(LmnMemStack memstack);
void lmn_memstack_push(LmnMemStack memstack, LmnMembraneRef mem);
LmnMembraneRef lmn_memstack_pop(LmnMemStack memstack);
LmnMembraneRef lmn_memstack_peek(LmnMemStack memstack);
void lmn_memstack_delete(LmnMemStack memstack, LmnMembraneRef mem);
void lmn_memstack_reconstruct(LmnMemStack memstack, LmnMembraneRef mem);

/* @} */
#include "life_time.hpp"

#ifdef DEBUG
namespace slim {
namespace element {
LifetimeProfiler *LifetimeProfiler::instance_ = nullptr;
}
}
#endif
Loading

0 comments on commit 6610087

Please sign in to comment.