Skip to content
Browse files

* Change the name of language to "Amber"

* add COPYING
  • Loading branch information...
1 parent a400bee commit 4874f4d1d6ca96915985d7a74063186d5c909b21 nineties committed with acs2 Jan 19, 2012
Showing with 138 additions and 152 deletions.
  1. +23 −0 COPYING
  2. +3 −3 Makefile
  3. +0 −26 lib/rowl/io.rl
  4. +0 −81 lib/rowl/syntax.rl
  5. +1 −0 misc/vim/ftdetect/amber.vim
  6. +37 −0 misc/vim/indent/amber.vim
  7. +62 −0 misc/vim/syntax/amber.vim
  8. +5 −5 rowl1/Makefile
  9. +2 −0 rowl1/amber
  10. +0 −2 rowl1/rowl
  11. +4 −4 rowl1/rowl1-interp.rlc
  12. +1 −23 rowl1/rowl1-util.rlc
  13. +0 −8 rowl2/main.rl
View
23 COPYING
@@ -0,0 +1,23 @@
+Amber is distributed under the MIT License.
+
+==
+Copyright (c) 2011 Koichi Nakamura <koichi.nakamur@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+==
View
6 Makefile
@@ -3,7 +3,7 @@
# Copyright (C) 2009 nineties
#
-# $Id: Makefile 2010-12-16 17:25:05 nineties $
+# $Id: Makefile 2012-01-19 22:55:46 nineties $
LIBDIR = /usr/lib
@@ -13,8 +13,8 @@ all:
install:
cd rowl1; $(MAKE) install_binaries install_libraries
- mkdir -p /usr/lib/rowl
- cp -r lib/* /usr/lib/rowl/
+ mkdir -p /usr/lib/amber
+ cp -r lib/* /usr/lib/amber/
.PHONY: clean
clean:
View
26 lib/rowl/io.rl
@@ -1,26 +0,0 @@
-# Copyright (C) 2010 nineties
-#
-# $Id: io.rl 2012-01-01 01:47:50 nineties $
-
-module std::io {
-
-print(obj): print(stdout, obj)
-print(\fullform, obj): print(stdout, \fullform, obj)
-
-read_char(): read_char(stdin)
-read_string(): read_string(stdin)
-read_line(): read_line(stdin)
-read_int(): read_int(stdin)
-
-puts(io@OutputFileStream, obj): {
- print(io, obj)
- print(io, '\n')
-}
-puts(io@OutputFileStream, \fullform, obj): {
- print(io, \fullform, obj)
- print(io, '\n')
-}
-puts(obj): puts(stdout, obj)
-puts(\fullform, obj): puts(stdout, \fullform, obj)
-
-}
View
81 lib/rowl/syntax.rl
@@ -1,81 +0,0 @@
-# Copyright (C) 2010 nineties
-#
-# $Id: lib/rowl/syntax.rl 2012-01-19 21:51:26 nineties $
-
-# Syntax definition of rowl language
-
-module (Qualified{std,syntax}) {
-
-command Include "include"
-command Import "import"
-
-infixr Qualified "::" 1
-prefix Unquote "!" 3
-prefix Quote "\\" 3
-prefix QuasiQuote "`" 3
-infixl HeadP "@" 4
-infixr Define ":" 19
-infixr Rewrite "=>" 20
-infixr Lambda "->" 13
-infixr Bind "|" 14
-
-prefix UnaryPlus "+" 5
-prefix UnaryMinus "-" 5
-prefix Not "not"5
-infixl Times "*" 6
-infixl Divide "/" 6
-infixl Mod "%" 6
-infixl Plus "+" 7
-infixl Minus "-" 7
-infixl LessThan "<" 9
-infixl GreaterThan ">" 9
-infixl LessEqual "<=" 9
-infixl GreaterEqual ">=" 9
-infixl Equal "==" 10
-infixl NotEqual "!=" 10
-infixl LogicalAnd "&&" 11
-infixl LogicalOr "||" 12
-infixr Assign "=" 17
-infixr PlusAssign "+=" 17
-infixr MinusAssign "-=" 17
-infixr TimesAssign "*=" 17
-infixr DivideAssign "/=" 17
-infixr ModAssign "%=" 17
-constr If "if"
-constr While "while"
-constr For "for"
-command Return "return"
-infixl Else "else" 18
-
-Rewrite = (x => y) -> `(Rewrite = (!x -> !y) | Rewrite)
- | Rewrite
-
-Apply{f@Symbol, args@List}: body
- => `DefineFunction{!f, !MakeExpression{\Tuple,args} -> !body}
-
-x@Symbol: value
- => `DefineVariable{!x, !value}
-
-true: \true
-false: \false
-
-+x => `UnaryPlus(!x)
--x => `UnaryMinus(!x)
-not x => `Not(!x)
-x * y => `Times(!x, !y)
-x / y => `Divide(!x, !y)
-x % y => `Mod(!x, !y)
-x + y => `Plus(!x, !y)
-x - y => `Minus(!x, !y)
-x < y => `LessThan(!x, !y)
-x > y => `GreaterThan(!x, !y)
-x >= y => `GreaterEqual(!x, !y)
-x <= y => `LessEqual(!x, !y)
-x += y => `(!x = !x + !y)
-x -= y => `(!x = !x - !y)
-x *= y => `(!x = !x * !y)
-x /= y => `(!x = !x / !y)
-x %= y => `(!x = !x % !y)
-x[y] => `Subscript(!x, !y)
-
-}
View
1 misc/vim/ftdetect/amber.vim
@@ -0,0 +1 @@
+au BufRead,BufNewFile *.ab set filetype=amber
View
37 misc/vim/indent/amber.vim
@@ -0,0 +1,37 @@
+" Vim indent file
+" Language: Amber
+" Maintainers: nineties <nineties48@gmail.com>
+" Last Change: 2012 Jan 19
+
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+setlocal indentexpr=GetAmberIndent()
+setlocal indentkeys=0},0),0],!^F,o,O,e
+
+if exists("*GetAmberIndent")
+ finish
+endif
+
+function! SkipBlanksAndComments(startline)
+ let lnum = a:startline
+ while lnum > 1
+ let lnum = prevnonblank(lnum)
+ if getline(lnum) =~ '^\s*#'
+ let lnum = lnum - 1
+ else
+ break
+ endif
+ endwhile
+ return lnum
+endfunction
+
+function GetAmberIndent()
+ let theIndent = cindent(v:lnum)
+
+ return theIndent
+endfunction
+
+" vim:sw=2
View
62 misc/vim/syntax/amber.vim
@@ -0,0 +1,62 @@
+" Language: Amber
+" Maintainer: nineties <nineties48@gmail.com>
+" $Id: amber.vim 2012-01-19 23:28:07 nineties $
+
+if exists("b:current_syntax")
+" finish
+endif
+
+syn case match " case sensitive
+
+syn keyword amberConstant true false
+syn keyword amberStatement module return import include
+syn keyword amberConditional if else
+syn keyword amberRepeat while
+
+syn match amberStandardConstant "stdin\|stdout\|stderr"
+
+syn keyword amberTodo contained Todo TODO Fixme FIXME XXX
+
+syn match amberSpecial display contained "\\."
+syn match amberCharacter "'[^\\]'"
+syn match amberCharacter "'[^']*'" contains=amberSpecial
+
+syn region amberString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=amberSpecial
+
+syn match amberOperator "=>\|!\|\\\|\`\|@\|:"
+
+syn match amberHeader "\<[A-Z][a-zA-Z0\9_]*"
+
+syn match amberCurlyError "}"
+syn region amberBlock start="{" end="}" contains=ALLBUT,amberParen,amberCurlyError fold
+
+syn match amberNumber display "\d\+\>"
+syn match amberNumber display "0x\x\+\>"
+syn match amberOctal display "0\o\+\>" contains=amberOctalZero
+syn match amberOctalZero display "\<0"
+syn match amberFloat display "\d\+\.\d*\(e[-+]\=\d\+\)"
+
+syn region amberComment start=/#/ end=/$/ contains=amberTodo
+
+hi def link amberHeader Type
+hi def link amberStandardConstant Identifier
+hi def link amberOperator Operator
+hi def link amberConstant Constant
+hi def link amberStatement Statement
+hi def link amberConditional Conditional
+hi def link amberRepeat Repeat
+hi def link amberTodo Todo
+hi def link amberNumber Number
+hi def link amberOctal Number
+hi def link amberOctalZero Number
+hi def link amberFloat Float
+hi def link amberSpecialError Error
+hi def link amberSpecial SpecialChar
+hi def link amberCharacter Character
+hi def link amberString String
+hi def link amberCurlyError Error
+hi def link amberComment Comment
+
+let b:current_syntax = "amber"
+
+" vim: ts=8
View
10 rowl1/Makefile
@@ -1,9 +1,9 @@
#
-# rowl -
+# amber -
# Copyright (C) 2010 nineties
#
-# $Id: Makefile 2012-01-18 13:06:32 nineties $
+# $Id: Makefile 2012-01-19 22:51:48 nineties $
TOPDIR = ..
ROWL0DIR = $(TOPDIR)/rowl0
@@ -153,10 +153,10 @@ clean:
install:
cd $(TOPDIR); $(MAKE) install
-install_binaries: rlvm rowl
+install_binaries: rlvm amber
mkdir -p $(BINDIR)
cp $^ $(BINDIR)
install_libraries: rowl1
- mkdir -p $(LIBDIR)/rowl/bin
- cp $^ $(LIBDIR)/rowl/bin
+ mkdir -p $(LIBDIR)/amber/bin
+ cp $^ $(LIBDIR)/amber/bin
View
2 rowl1/amber
@@ -0,0 +1,2 @@
+#!/bin/sh
+rlvm /usr/lib/amber/bin/rowl1 $*
View
2 rowl1/rowl
@@ -1,2 +0,0 @@
-#!/bin/sh
-rlvm /usr/lib/rowl/bin/rowl1 $*
View
8 rowl1/rowl1-interp.rlc
@@ -2,7 +2,7 @@
; rowl - 1st generation
; Copyright (C) 2010 nineties
;
-; $Id: rowl1-interp.rlc 2012-01-18 14:22:33 nineties $
+; $Id: rowl1-interp.rlc 2012-01-19 23:01:18 nineties $
;
(import "rlvm-compile")
@@ -43,10 +43,10 @@
(init_parser path ichan)
(add_include_dir "./")
- (add_include_dir "/usr/lib/rowl/")
- (include_file "rowl/syntax.rl")
+ (add_include_dir "/usr/lib/amber/")
+ (include_file "amber/syntax.ab")
(import_module current_mod (qualified "std" (to_sym "syntax")))
- (include_file "rowl/io.rl")
+ (include_file "amber/io.ab")
(import_module current_mod (qualified "std" (to_sym "io")))
(interpret)
View
24 rowl1/rowl1-util.rlc
@@ -2,7 +2,7 @@
; rowl - 1st generation
; Copyright (C) 2010 nineties
;
-; $Id: rowl1-util.rlc 2011-12-14 01:05:55 nineties $
+; $Id: rowl1-util.rlc 2012-01-19 23:02:28 nineties $
;
(import "rlvm-compile")
@@ -185,28 +185,6 @@
(return dir)
))
-; path must be 'foo/bar/baz/XYZ.rl"
-(export fun get_modulename (path) (
- (var end (- (strlen path) 1))
- (if (< end 3) (return 0))
- (if (|| (!= (array_get char path end) 'l') (|| (!= (array_get char path (- end 1)) 'r')
- (!= (array_get char path (- end 2)) '.')))
- (return 0)
- )
- (var begin end)
- (while (> begin 0) (do
- (if (== (array_get char path begin) '/') (do
- (+= begin 1)
- break
- ))
- (-= begin 1)
- ))
- (var len (- (- end begin) 2))
- (var dst (allocate_string len))
- (strncpy dst (+ path begin) len)
- (return dst)
- ))
-
(export fun not_reachable (name) (
(flush stdout)
(output_string stderr "INTERNAL ERROR: ")
View
8 rowl2/main.rl
@@ -1,8 +0,0 @@
-#!/usr/bin/rowl
-
-# rowl - 2nd generation
-# Copyright (C) 2010 nineties
-#
-# $Id: main.rl 2012-01-19 21:40:26 nineties $
-
-puts("Hello World")

0 comments on commit 4874f4d

Please sign in to comment.
Something went wrong with that request. Please try again.