在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):meric/l2l开源软件地址(OpenSource Url):https://github.com/meric/l2l开源编程语言(OpenSource Language):Lua 74.9%开源软件介绍(OpenSource Introduction):l2lThis language is a superset of Lisp and Lua. Exampleboolean.lisp, implements @import quasiquote
@import quote
@import fn
@import local
@import do
@import let
@import cond
(fn circuit_and (invariant cdr output truth)
(cond cdr
(let (
car (:car cdr)
ref (lua_name:unique "_and_value"))
`\
local \,ref = \,\(expize(invariant, car, output))
if \,ref then
\,(cond (:cdr cdr)
(circuit_and invariant (:cdr cdr) output truth)
`\\,truth = \,ref)
else
\,truth = false
end)))
(fn expize_and (invariant cdr output)
(let (ref (lua_name:unique "_and_bool"))
(table.insert output `\local \,ref = true)
(table.insert output (circuit_and invariant cdr output ref))
ref))
(fn statize_and (invariant cdr output)
(to_stat (expize_and invariant cdr output)))
(fn circuit_or (invariant cdr output truth)
(cond cdr
(let (
car (:car cdr)
ref (lua_name:unique "_or_value"))
`\
if not \,truth then
local \,ref = \,\(expize(invariant, car, output))
if \,ref then
\,truth = \,ref
end
end
\,(cond (:cdr cdr)
(circuit_or invariant (:cdr cdr) output truth)))))
(fn expize_or (invariant cdr output)
(let (ref (lua_name:unique "_or_bool"))
(table.insert output `\local \,ref = false)
(table.insert output (circuit_or invariant cdr output ref))
ref))
(fn statize_or (invariant cdr output)
(to_stat (expize_or invariant cdr output)))
{
lua = {
["and"] = {expize=expize_and, statize=statize_and},
["or"] = {expize=expize_or, statize=statize_or}
}
} Quick Start# Requires https://github.com/meric/leftry cloned as a sibling to this repo.
git clone [email protected]:meric/leftry.git
git clone [email protected]:meric/l2l.git
cd l2l
make clean
make test
make repl Run the following commands:
Syntax HighlightingNamingLisp names are mangled into Lua by replacing non lua compliant characters with lua compliant characters. (See the mangle function in l2l/reader.lua). Lisp names can contain dashes, dots, alphabets, numbers, underscores, and many
more characters, but they must not consist of two dots consecutively unless
the name is This is so the compiler can mangle lua field accessor names
Features
Philosophy
Obligatory
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论