*~
.DS_Store
*.swp
+*.spot
+*.spit
+*.annot
# auto generate file
scm/src/instruction.ml
PREFIX:=/usr/local
+static. =
+ OCAMLFLAGS = -g -annot
+
+Shell. +=
+ ounit-postproc(argv) =
+ (grep -i "FAIL\|ERROR" && exit 1) || exit 0
+ ocaml-clean(argv) =
+ rm -f *.cm[iox] *.o *.omc *.opt *.run *~ $(argv) *.cmxa *.a
+
+
.PHONY: clean all
.SUBDIRS: scm xml driver base
PROGRAM = habc habc-xml habc-scm
clean:
- rm -f *~ *.omc *.abc $(PROGRAM)
+ ocaml-clean *.abc $(PROGRAM)
install: $(PROGRAM) share
mkdir -p $(PREFIX)/bin
#
DefineCommandVars()
-Shell. +=
- ounit-postproc(argv) =
- (grep -i "FAIL\|ERROR" && exit 1) || exit 0
-
-
#
# Include the OMakefile in this directory.
#
-.PHONY: all install clean
+.PHONY: clean
################################################
# Configuration. You may want to modify any of these configuration
OCAMLPACKS[] =
extlib
-#
+
if $(not $(OCAMLFIND_EXISTS))
eprintln('This project requires ocamlfind, but is was not found.')
eprintln('You need to install ocamlfind and run "omake --configure".')
OCAML_OTHER_LIBS += unix
.DEFAULT: $(OCamlProgram $(PROGRAM), $(FILES))
+
+clean:
+ ocaml-clean $(PROGRAM)
+++ /dev/null
-########################################################################
-# Permission is hereby granted, free of charge, to any person
-# obtaining a copy of this file, to deal in the File without
-# restriction, including without limitation the rights to use,
-# copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the File, and to permit persons to whom the
-# File is furnished to do so, subject to the following condition:
-#
-# THE FILE 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 FILE OR
-# THE USE OR OTHER DEALINGS IN THE FILE.
-
-########################################################################
-# The standard OMakeroot file.
-# You will not normally need to modify this file.
-# By default, your changes should be placed in the
-# OMakefile in this directory.
-#
-# If you decide to modify this file, note that it uses exactly
-# the same syntax as the OMakefile.
-#
-
-#
-# Include the standard installed configuration files.
-# Any of these can be deleted if you are not using them,
-# but you probably want to keep the Common file.
-#
-open build/C
-open build/OCaml
-open build/LaTeX
-
-#
-# The command-line variables are defined *after* the
-# standard configuration has been loaded.
-#
-DefineCommandVars()
-
-#
-# Include the OMakefile in this directory.
-#
-.SUBDIRS: .
-.PHONY: clean integrate
+.PHONY: clean integrate
.SUBDIRS: test src util
-
clean:
- rm -f *~ *.omc
+ ocaml-clean
habc-scm: src/habc-scm
cp src/habc-scm .
#
# Various options
#
-OCAMLFLAGS += -g
+#OCAMLFLAGS +=
OCAMLPPFLAGS += -pp 'camlp4o'
OCAMLDEPFLAGS += $(OCAMLPPFLAGS)
pSet
tuple
varResolve
+ interCode
OCAMLINCLUDES += ../../base/
OCAML_LIBS += ../../base/base
../util/instruction -t < ../util/instruction.txt > $@
clean:
- rm -f $(PROGRAM) *.cm[iox] *.o *.omc *.opt *.run *~ match_body.ml opcode.ml instruction.ml
+ ocaml-clean $(PROGRAM) match_body.ml opcode.ml instruction.ml
--- /dev/null
+(** intermediate code *)
+type inter_code = {
+ variables: Ast.qname list;
+ methods: Ast.qname list;
+ program: Ast.program
+}
+
+let of_program program = {
+ variables = [];
+ methods = [];
+ program = program
+}
+
#directory "../src";;
#use "../src/.ocamlinit";;
+#require "Dynlink";;
#require "oUnit";;
#load "util.cmo";;
#load "astUtil.cmo";;
# Various options
#
-OCAMLFLAGS +=
OCAMLPPFLAGS +=
OCAMLDEPFLAGS += $(OCAMLPPFLAGS)
test_abc
test_tuple
test_varResolve
+ test_interCode
OCAMLINCLUDES += ../../base/
OCAML_LIBS += ../../base/base
./$(PROGRAM).run | ounit-postproc
clean:
- rm -f $(PROGRAM) *.cm[iox] *.o *.omc *.opt *.run *~ runner.h
+ ocaml-clean $(PROGRAM)
--- /dev/null
+open Base
+open Util
+open OUnit
+open AstUtil
+open InterCode
+
+let v_ok variables program =
+ let inter_code =
+ of_program program in
+ ok variables inter_code.variables
+
+
+let _ =
+ ("interCode.ml" >::: [
+ "'public define' should export its name" >::
+ (fun () ->
+ v_ok [global "x"] [define (`Public (global "x")) (int 42)];
+ v_ok [] [define (`Internal (global "x")) (int 42)]);
+ ]) +> run_test_tt
.DEFAULT: src/habc-xml
clean:
- rm -f habc-xml habc-xml.opt habc-xml.run *.omc .omakedb .omakedb.lock
+ ocaml-clean habc-xml
#
USE_OCAMLFIND = true
OCAMLPACKS[] =
- xml-light
extlib
+ xml-light
+
if $(not $(OCAMLFIND_EXISTS))
eprintln('This project requires ocamlfind, but is was not found.')
exit 1
-OCAMLINCLUDES += ../../base/
-
-
# Compile native or byte code?
#
# The default values are defined as follows:
.DEFAULT: $(PROGRAM)
clean:
- rm -f *.cm[iox] *~ *.o *.omc $(PROGRAM) *.opt *.run *.cma *.cmxa *.a
+ ocaml-clean $(PROGRAM)
# PHONY TARGET
#
clean:
- rm -f *.cm[iox] *~ *.o *.omc $(PROGRAM) *.opt *.run
+ ocaml-clean $(PROGRAM)