summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuleyman Farajli <suleyman@farajli.net>2025-01-19 20:02:29 +0400
committerSuleyman Farajli <suleyman@farajli.net>2025-01-19 20:02:29 +0400
commit999d26eb5b7fcd96feadde6ca9ee9900ac8179af (patch)
tree0b9545e4a97906a1350f6934b8f08682199f2019
parent8d0fc4dd5f70bc829f4f73b70246c02bc3f8168c (diff)
program name changed to `marp`
-rw-r--r--.gitignore2
-rw-r--r--Makefile13
-rw-r--r--README.md4
-rw-r--r--examples/const.marp (renamed from examples/const.ash)0
-rw-r--r--examples/fib.marp (renamed from examples/fib.ash)0
-rw-r--r--examples/hello_world.marp (renamed from examples/hello_world.ash)2
-rw-r--r--examples/seq10.marp (renamed from examples/seq10.ash)0
-rw-r--r--examples/words.marp (renamed from examples/words.ash)0
-rw-r--r--go.mod2
-rw-r--r--lib/std.marp (renamed from lib/std.ash)0
-rw-r--r--src/main.go9
11 files changed, 17 insertions, 15 deletions
diff --git a/.gitignore b/.gitignore
index b88931b..10f8dfa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
-ash
+marp
GNUmakefile
diff --git a/Makefile b/Makefile
index ce70bdb..070c19c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,16 +1,17 @@
PREFIX ?= /usr/local
-ash: src/main.go
- go build -o ash ./src
+marp: src/main.go
+ go build -o marp ./src
-install: ash
+install: marp
mkdir -p ${DESTDIR}${PREFIX}/bin
- cp -f ash ${DESTDIR}${PREFIX}/bin
+ cp -f marp ${DESTDIR}${PREFIX}/bin
+ cp -f lib/std.marp ${DESTDIR}${PREFIX}/bin
uninstall:
- rm -f ${DESTDIR}${PREFIX}/bin/ash
+ rm -f ${DESTDIR}${PREFIX}/bin/marp
clean:
- rm -f ash
+ rm -f marp
.PHONY: test clean
diff --git a/README.md b/README.md
index aadbfdc..77ee302 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# ash
+# marp
A Simple stack based programming language inspired by [forth](https://www.forth.com/forth) and posix shell syntax.
## Building
@@ -15,4 +15,4 @@ make install
* ld
## OS
-ash only supports linux.
+marp only supports linux.
diff --git a/examples/const.ash b/examples/const.marp
index 421f7f5..421f7f5 100644
--- a/examples/const.ash
+++ b/examples/const.marp
diff --git a/examples/fib.ash b/examples/fib.marp
index c29476d..c29476d 100644
--- a/examples/fib.ash
+++ b/examples/fib.marp
diff --git a/examples/hello_world.ash b/examples/hello_world.marp
index a1c1d48..bdc5fb6 100644
--- a/examples/hello_world.ash
+++ b/examples/hello_world.marp
@@ -1,5 +1,5 @@
# Prints out "Hello, World!"
-include "../lib/std.ash"
+include "../lib/std.marp"
"Hello, World!" write
diff --git a/examples/seq10.ash b/examples/seq10.marp
index e73743e..e73743e 100644
--- a/examples/seq10.ash
+++ b/examples/seq10.marp
diff --git a/examples/words.ash b/examples/words.marp
index c0e1461..c0e1461 100644
--- a/examples/words.ash
+++ b/examples/words.marp
diff --git a/go.mod b/go.mod
index 2484211..81fa7f1 100644
--- a/go.mod
+++ b/go.mod
@@ -1,3 +1,3 @@
-module ash
+module marp
go 1.23.3
diff --git a/lib/std.ash b/lib/std.marp
index d44cccb..d44cccb 100644
--- a/lib/std.ash
+++ b/lib/std.marp
diff --git a/src/main.go b/src/main.go
index 1765971..ed0f1dd 100644
--- a/src/main.go
+++ b/src/main.go
@@ -575,7 +575,8 @@ func main() {
argv := os.Args;
argc := len(argv);
progname = argv[0]
- suffix := ".ash"
+ suffix := ".marp"
+ sufLen := len(suffix)
if argc != 2 {
fmt.Fprintf(os.Stderr, "%s: error: expected one input file.\n", progname)
@@ -583,12 +584,12 @@ func main() {
}
srcFile := argv[argc - 1]
- if !strings.HasSuffix(srcFile, suffix) || len(srcFile) < 5 {
- fmt.Fprintf(os.Stderr, "%s: error: invalid file format '%s'.\n", progname, srcFile)
+ if !strings.HasSuffix(srcFile, suffix) || len(srcFile) <= sufLen {
+ fmt.Fprintf(os.Stderr, "%s: error: invalid file name '%s'.\n", progname, srcFile)
os.Exit(1)
}
- binFile := srcFile[:len(srcFile) - 4]
+ binFile := srcFile[:len(srcFile) - sufLen]
assemFile := binFile + ".s"
objFile := binFile + ".o"
_, err := os.Stat(srcFile)