hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 0a91e248b228a07bb36a7b14840ead5f64bcd45c
parent b75132a5ba95f1206a4a9abae8a31ef31358ac4d
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Wed, 24 Mar 2021 01:30:03 -0400

cmd/harec: initial commit

Diffstat:
MMakefile | 9+++++++--
Acmd/harec/main.ha | 17+++++++++++++++++
2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile @@ -5,7 +5,7 @@ TESTCACHE=$(HARECACHE)/+test TESTHAREFLAGS=$(HAREFLAGS) -T +test STDLIB=. -.bin/hare: +all: .SUFFIXES: .ha .ssa .s .o .scd .1 .ssa.s: @@ -60,12 +60,17 @@ docs/hare.1: docs/hare.scd docs: docs/hare.1 +.bin/harec: .bin/hare + @mkdir -p .bin + @printf 'HARE\t$@\n' + @env HAREPATH=. ./.bin/hare build -o .bin/harec ./cmd/harec + clean: @rm -rf .cache .bin check: .bin/hare-tests @./.bin/hare-tests -all: .bin/hare +all: .bin/hare .bin/harec .PHONY: all clean check diff --git a/cmd/harec/main.ha b/cmd/harec/main.ha @@ -0,0 +1,17 @@ +use fmt; +use hare::ast; +use hare::lex; +use hare::parse; +use hare::unparse; +use os; + +export fn main() void = { + let lexer = lex::init(os::stdin, "<stdin>"); + let su = match (parse::subunit(&lexer)) { + e: parse::error => + fmt::fatal("Syntax error: {}", parse::errstr(e)), + u: ast::subunit => u, + }; + defer ast::subunit_free(su); + unparse::subunit(os::stdout, su); +};