initial
This commit is contained in:
commit
35288b2ca7
4 changed files with 72 additions and 0 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
*.i
|
||||||
|
*.c
|
||||||
|
*.xml
|
||||||
|
ableC.jar
|
33
Makefile
Normal file
33
Makefile
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
ABLEC_BASE ?= ~/Projects/melt-umn/ableC
|
||||||
|
EXTS_BASE ?= ~/Projects/melt-umn/extensions
|
||||||
|
|
||||||
|
ABLEC_JAR = ableC.jar
|
||||||
|
ARTIFACT = artifact
|
||||||
|
|
||||||
|
GRAMMAR_DIRS = $(ABLEC_BASE)/grammars $(wildcard $(EXTS_BASE)/*/grammars)
|
||||||
|
GRAMMAR_SOURCES = $(shell find $(GRAMMAR_DIRS) -name *.sv -print0 | xargs -0)
|
||||||
|
|
||||||
|
XC_INCLUDE_DIRS = $(wildcard $(EXTS_BASE)/*/include)
|
||||||
|
override XCFLAGS += $(addprefix -I,$(XC_INCLUDE_DIRS))
|
||||||
|
|
||||||
|
override SVFLAGS += $(addprefix -I ,$(GRAMMAR_DIRS))
|
||||||
|
|
||||||
|
all: multiclip
|
||||||
|
|
||||||
|
$(ABLEC_JAR): $(GRAMMAR_SOURCES)
|
||||||
|
touch $(wildcard $(ARTIFACT)/*.sv)
|
||||||
|
silver-ableC -o $@ $(SVFLAGS) $(ARTIFACT)
|
||||||
|
|
||||||
|
multiclip: main.c
|
||||||
|
gcc -o $@ -lgc $<
|
||||||
|
|
||||||
|
main.c: main.xc $(ABLEC_JAR)
|
||||||
|
java -jar $(ABLEC_JAR) $< -o $@ $(XCFLAGS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f multiclip
|
||||||
|
rm -f *.gen_cpp
|
||||||
|
rm -f *.c
|
||||||
|
rm -f *.xml
|
||||||
|
|
||||||
|
.PHONY: all clean
|
23
artifact/Artifact.sv
Normal file
23
artifact/Artifact.sv
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
grammar artifact;
|
||||||
|
|
||||||
|
{- This Silver specification does litte more than list the desired
|
||||||
|
extensions, albeit in a somewhat stylized way.
|
||||||
|
|
||||||
|
Files like this can easily be generated automatically from a simple
|
||||||
|
list of the desired extensions.
|
||||||
|
-}
|
||||||
|
|
||||||
|
import edu:umn:cs:melt:ableC:concretesyntax as cst;
|
||||||
|
import edu:umn:cs:melt:ableC:drivers:compile;
|
||||||
|
|
||||||
|
|
||||||
|
parser extendedParser :: cst:Root {
|
||||||
|
edu:umn:cs:melt:ableC:concretesyntax;
|
||||||
|
edu:umn:cs:melt:exts:ableC:string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function main
|
||||||
|
IOVal<Integer> ::= args::[String] io_in::IO
|
||||||
|
{
|
||||||
|
return driver(args, io_in, extendedParser);
|
||||||
|
}
|
12
main.xc
Normal file
12
main.xc
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#include <string.xh>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(int argc, char** argv) {
|
||||||
|
string a;
|
||||||
|
|
||||||
|
a = "abc";
|
||||||
|
printf("a: %s\n", a.text);
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: set ft=c :
|
Loading…
Reference in a new issue