--- /dev/null
+*
+!/.gitignore
--- /dev/null
+
+defaultTasks 'installTools'
+
+/*--------------------------------------------------------------------------------
+
+ Configuration variables
+
+*/
+
+// project structure
+def repoHome = rootDir
+def toolDir = "${repoHome}/tool"
+def upstreamDir = "${toolDir}/upstream"
+def executorDir = "${toolDir}/executor"
+def erebusDir = file("${rootDir}/Erebus")
+
+// tool versions
+def antlrVersion = '4.11.1'
+def jdkVersion = '22.0.1'
+def jdkBuild = '8'
+
+// The urls for upstream files
+def antlrUrl = "https://www.antlr.org/download/antlr-${antlrVersion}-complete.jar"
+def jdkUrl = "https://github.com/adoptium/temurin22-binaries/releases/download/jdk-${jdkVersion}%2B${jdkBuild}/OpenJDK22U-jdk_x64_linux_hotspot_${jdkVersion}_${jdkBuild}.tar.gz"
+
+task installAntlr {
+ doLast {
+ def antlrJar = file("${upstreamDir}/antlr-${antlrVersion}-complete.jar")
+ def antlrExecutorJar = file("${executorDir}/antlr-${antlrVersion}-complete.jar")
+
+ mkdir(upstreamDir)
+ mkdir(executorDir)
+
+ if (!antlrJar.exists()) {
+ println "Downloading ANTLR..."
+ new URL(antlrUrl).withInputStream { i -> antlrJar.withOutputStream { it << i } }
+ }
+
+ if (!antlrExecutorJar.exists()) {
+ copy {
+ from antlrJar
+ into executorDir
+ }
+ println "ANTLR installed in executor."
+ } else {
+ println "ANTLR already installed."
+ }
+ }
+}
+
+task installJava {
+ doLast {
+ def jdkTar = file("${upstreamDir}/jdk-${jdkVersion}.tar.gz")
+ def jdkDir = file("${toolDir}/jdk-${jdkVersion}+${jdkBuild}")
+
+ mkdir(upstreamDir)
+ mkdir(toolDir)
+
+ if (!jdkTar.exists()) {
+ println "Downloading JDK..."
+ new URL(jdkUrl).withInputStream { i -> jdkTar.withOutputStream { it << i } }
+ }
+
+ if (!jdkDir.exists()) {
+ println "Extracting JDK..."
+ copy {
+ from tarTree(resources.gzip(jdkTar))
+ into toolDir
+ }
+ println "JDK installed."
+ } else {
+ println "JDK already installed."
+ }
+
+ // Set JAVA_HOME and test Java installation
+ def javaHome = file("${jdkDir}")
+ if (!javaHome.exists()) {
+ throw new GradleException("JDK extraction failed.")
+ }
+
+ // variables saved for use in subproject build scripts
+ project.ext.javaHome = jdkDir
+
+ println "Java installation complete."
+ }
+}
+
+// Add a task to install both tools
+task installTools {
+ dependsOn installAntlr, installJava
+}
+
+// Ensure all subprojects depend on the tool installation
+subprojects {
+ afterEvaluate { project ->
+ project.tasks.each { task ->
+ task.dependsOn ':installTools'
+ }
+ }
+}
+
+task cleanTool {
+ description = 'Cleans the installed tools (but not upstream files)'
+ doLast {
+ // Define the directories or files to clean
+ def toolDirs = [
+ file("${rootDir}/tool/bin"),
+ file("${rootDir}/tool/executor"),
+ file("${rootDir}/tool/jdk-22.0.1+8")
+ ]
+
+ // Delete the tool directories
+ toolDirs.each { dir ->
+ if (dir.exists()) {
+ println "Deleting ${dir}..."
+ delete dir
+ }
+ }
+
+ println " ./tool cleaned."
+ }
+}
+
+task cleanErebus {
+ description = "Cleans the project level temporary directory 'Erebus'"
+
+ doLast {
+ if (erebusDir.exists()) {
+ erebusDir.eachFile { file ->
+ if (file.name != '.gitignore') {
+ if (file.isDirectory()) {
+ file.deleteDir()
+ } else {
+ file.delete()
+ }
+ }
+ }
+ println "Erebus directory cleaned, except for .gitignore."
+ } else {
+ println "Erebus directory does not exist."
+ }
+ }
+}
+
+
+++ /dev/null
-
-/jvm/
-/javac/ANTLR/
-/temporary/
-
--- /dev/null
+
+*
+!/.gitignore
+
--- /dev/null
+task setup {
+ doLast {
+ def dirs = [
+ "$(ANTLR_IN_PRIMARY_DIR)",
+ "$(JAVA_COMP_IN_DIR)",
+ "$(JAVA_COMP_IN_PRIMARY_DIR)",
+ "$(JAVA_COMP_IN_ANTLR_DIR)",
+ "$(JAVA_COMP_IN_SYN_DIR)",
+ "$(JVM_IN_DIR)",
+ "$(EXECUTOR_IN_DIR)",
+ "test",
+ "deprecated",
+ "experiment",
+ "ologist",
+ "temporary"
+ ]
+ dirs.each { dir ->
+ if (!file(dir).exists()) {
+ mkdir dir
+ }
+ }
+ }
+}
+
+def compileJava(source, target) {
+ tasks.create(name: "compile${source}", type: Exec) {
+ commandLine '$(JAVA_COMP)', '-d', '$(JAVA_COMP_OUT_DIR)', '-sourcepath', '$(JAVA_COMP_IN_DL)', source
+ doLast {
+ println "Compiled ${source} to ${target}"
+ }
+ }
+}
+
+def createJar(source, target) {
+ tasks.create(name: "jar${source}", type: Exec) {
+ commandLine '$(JAVA_ARCHIVE)', 'cf', target, '-C', '$(JAVA_COMP_OUT_DIR)', source
+ doLast {
+ println "Created ${target}"
+ }
+ }
+}
+
+def createWrapper(source, target) {
+ tasks.create(name: "wrapper${source}", type: Exec) {
+ doLast {
+ def script = new File(target)
+ script.text = "#!/usr/bin/env bash\n$(JAVA_INTERP) -cp ${CLASSPATH}:${JVM_IN_DP}:${JVM_IN_DP}/${source}.jar ${source} \$@"
+ script.setExecutable(true)
+ println "Created program ${target}"
+ }
+ }
+}
+
+task ANTLR_OUT_FL {
+ dependsOn setup
+ doLast {
+ println "Building ANTLR_OUT_FL..."
+ // Add specific build steps for ANTLR_OUT_FL here
+ }
+}
+
+task all {
+ dependsOn ANTLR_OUT_FL
+ doLast {
+ println "Building all targets..."
+ }
+}
+
+task clean {
+ doLast {
+ println "Use the command `clean <option>` instead of make."
+ }
+}
+
+task version {
+ doLast {
+ println "ANTLR_JAR is '${notdir(ANTLR_JAR)}'"
+ exec {
+ commandLine '$(JAVA_COMP)', '--version'
+ }
+ exec {
+ commandLine '$(JAVA_ARCHIVE)', '--version'
+ }
+ exec {
+ commandLine 'make', '-v'
+ }
+ println "makefile 0.4"
+ }
+}
+
+task nothing {
+ doLast {
+ // useful for distinguishing between make syntax errors and build errors
+ }
+}
+
+tasks.withType(Exec) {
+ doFirst {
+ println "Executing $name"
+ }
+}
+
+// Example usage
+compileJava('$(JAVA_COMP_IN_PRIMARY_DIR)/Example.java', '$(JAVA_COMP_OUT_DIR)/Example.class')
+createJar('Example.class', '$(JAVA_COMP_OUT_DIR)/Example.jar')
+createWrapper('Example', '$(EXECUTOR_IN_DIR)/Example')
--- /dev/null
+task setup {
+ doLast {
+ def dirs = ["$(ANTLR_IN_PRIMARY_DIR)", "$(JAVA_COMP_IN_PRIMARY_DIR)", "$(JVM_IN_DIR)", "$(EXECUTOR_IN_DIR)", "test", "deprecated", "experiment", "ologist", "temporary"]
+ dirs.each { dir ->
+ mkdir dir
+ }
+ }
+}
+
+task tool(type: Exec) {
+ dependsOn setup
+ commandLine '$(BIN_MAKE)', '-f', '$(EXECUTOR_IN_DIR)/makefile-tool.mk', '-$(MAKEFLAGS)', 'all'
+}
+
+task project(type: Exec) {
+ dependsOn tool
+ commandLine '$(BIN_MAKE)', '-f', '$(EXECUTOR_IN_DIR)/makefile-project.mk', '-$(MAKEFLAGS)', 'all'
+}
+
+task clean {
+ doLast {
+ println "Use the command `clean <option>` instead of make."
+ }
+}
+
+task version {
+ doLast {
+ println "ANTLR_JAR is '${notdir(ANTLR_JAR)}'"
+ exec {
+ commandLine '$(JAVA_COMP)', '--version'
+ }
+ exec {
+ commandLine '$(JAVA_ARCHIVE)', '--version'
+ }
+ exec {
+ commandLine 'make', '-v'
+ }
+ println "makefile 0.4"
+ }
+}
+
+task all {
+ dependsOn project
+}
+
+task nothing {
+ doLast {
+ // useful for distinguishing between make syntax errors and build errors
+ }
+}
+
+tasks.withType(Exec) {
+ doFirst {
+ println "Executing $name"
+ }
+}
+
+
+----------------------
+// Function to compile .java files to .class files
+def compileJava(source, target) {
+ tasks.create(name: "compile${source}", type: Exec) {
+ commandLine '$(JAVA_COMP)', '-d', '$(JAVA_COMP_OUT_DIR)', '-sourcepath', '$(JAVA_COMP_IN_DL)', source
+ doLast {
+ println "Compiled ${source} to ${target}"
+ }
+ }
+}
+
+// Function to create .jar files from .class files
+def createJar(source, target) {
+ tasks.create(name: "jar${source}", type: Exec) {
+ commandLine '$(JAVA_ARCHIVE)', 'cf', target, '-C', '$(JAVA_COMP_OUT_DIR)', source
+ doLast {
+ println "Created ${target}"
+ }
+ }
+}
+
+// Function to create wrapper scripts from .jar files
+def createWrapper(source, target) {
+ tasks.create(name: "wrapper${source}", type: Exec) {
+ doLast {
+ def script = new File(target)
+ script.text = "#!/usr/bin/env bash\n$(JAVA_INTERP) -cp ${CLASSPATH}:${JVM_IN_DP}:${JVM_IN_DP}/${source}.jar ${source} \$@"
+ script.setExecutable(true)
+ println "Created program ${target}"
+ }
+ }
+}
+
--- /dev/null
+#!/usr/bin/env bash
+
+if [[ -z "${DEVELOPER_HOME}" || -z "${EXECUTOR_IN_DIR}" ]]; then
+ echo "required variables not set. As seen by:"
+ echo " DEVELOPER_HOME: $DEVELOPER_HOME"
+ echo " EXECUTOR_IN_DIR: $EXECUTOR_IN_DIR"
+ exit 1
+fi
+
+cd "$DEVELOPER_HOME"
+
+# in case there have been edits to the environment
+source "${EXECUTOR_IN_DIR}"/env_build
+
+${BIN_MAKE} --no-print-directory -f "${EXECUTOR_IN_DIR}"/makefile-top.mk $@
--- /dev/null
+#--------------------------------------------------------------------------------
+# Project build
+#
+# GNU makefile
+
+# turn off implicit rules, because they can do unexpected things.
+.SUFFIXES:
+MAKEFLAGS += -r
+
+# `make` considers that PHONY targets do not correspond to files (other
+# targets do and the files have their dates checked). This declaration renders
+# innocuous the "feature" where `make` always tries to make its own
+# makefiles. There is no command line switch to turn this "feature" off.
+.PHONY: $(MAKEFILE_LIST)
+
+# 'make' has a "feature" where it deletes what it determines to be intermediate
+# files. There is no command line switch to turn this "feature" off. Combine
+# this "feature" with implicit rules and have loads of fun.
+.PRECIOUS: $(MAKEFILE_LIST)
+
+#$(info makefile: $(MAKEFILE_LIST))
+#$(info project_MAKECMDGOALS: $(MAKECMDGOALS))
+
+# for recursive make without leaving this makefile
+REMAKE = $(MAKE) -$(MAKEFLAGS) -f $(MAKEFILE_LIST)
+
+#================================================================================
+# Custom make targets
+#
+
+all: $(EXECUTOR_IN_FPL)
+
+
+#-----------------------------------------------
+# These do not require antlr generated java files
+
+RuleNameListRegx: $(EXECUTOR_IN_DIR)/RuleNameListRegx
+RuleNameList: $(EXECUTOR_IN_DIR)/RuleNameList
+
+Synthesize_SyntaxAnnotate_PrintVisitorMethod:\
+ $(JAVA_COMP_IN_PRIMARY_DIR)/StringUtils.java\
+ $(EXECUTOR_IN_DIR)/Synthesize_SyntaxAnnotate_PrintVisitorMethod
+Synthesize_SyntaxAnnotate_PrintVisitor:\
+ $(JAVA_COMP_IN_PRIMARY_DIR)/StringUtils.java\
+ $(JAVA_COMP_IN_PRIMARY_DIR)/Synthesize_SyntaxAnnotate_PrintVisitorMethod.java\
+ $(EXECUTOR_IN_DIR)/Synthesize_SyntaxAnnotate_PrintVisitor
+
+Synthesize_SyntaxAnnotate:\
+ $(JAVA_COMP_IN_PRIMARY_DIR)/StringUtils.java\
+ $(EXECUTOR_IN_DIR)/Synthesize_SyntaxAnnotate
+
+#-----------------------------------------------
+# Arithmetic
+
+ANTLR_OUT_Arithmetic_FPL:= $(shell ANTLR_OUT_FL Arithmetic -path $(ANTLR_OUT_DIR))
+#$(info ANTLR_OUT_Arithmetic_FPL: $(ANTLR_OUT_Arithmetic_FPL))
+Arithmetic_Echo:\
+ $(ANTLR_OUT_Arithmetic_FPL)\
+ $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_Echo_PrintVisitor.java
+ @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \
+ echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \
+ exit 1; \
+ fi
+ $(REMAKE) $(EXECUTOR_IN_DIR)/Arithmetic_Echo
+
+Arithmetic_Echo__Test:\
+ $(ANTLR_OUT_Arithmetic_FPL)\
+ $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_Echo_PrintVisitor.java
+ @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \
+ echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \
+ exit 1; \
+ fi
+ $(REMAKE) $(EXECUTOR_IN_DIR)/Arithmetic_Echo__Test
+
+Arithmetic_SyntaxAnnotate:\
+ $(ANTLR_OUT_Arithmetic_FPL)\
+ $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_SyntaxAnnotate_PrintVisitor.java
+ @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \
+ echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \
+ exit 1; \
+ fi
+ $(REMAKE) $(EXECUTOR_IN_DIR)/Arithmetic_SyntaxAnnotate
+
+Arithmetic_SyntaxAnnotate__Test:\
+ $(ANTLR_OUT_Arithmetic_FPL)\
+ $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_SyntaxAnnotate_PrintVisitor.java
+ @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \
+ echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \
+ exit 1; \
+ fi
+ $(REMAKE) $(EXECUTOR_IN_DIR)/Arithmetic_SyntaxAnnotate__Test
+
+Arithmetic_Swap:\
+ $(ANTLR_OUT_Arithmetic_FPL)\
+ $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_SwapVisitor.java\
+ $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_Echo_PrintVisitor.java
+ @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \
+ echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \
+ exit 1; \
+ fi
+ $(REMAKE) $(EXECUTOR_IN_DIR)/Arithmetic_Swap
+
+#-----------------------------------------------
+# Arithmetic2
+#
+
+ANTLR_OUT_Arithmetic2_FPL:= $(shell ANTLR_OUT_FL Arithmetic2 -path $(ANTLR_OUT_DIR))
+Arithmetic2_SyntaxAnnotate:\
+ $(ANTLR_OUT_Arithmetic2_FPL)\
+ $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic2_SyntaxAnnotate_PrintVisitor.java
+ @if [ -z "$(ANTLR_OUT_Arithmetic2_FPL)" ]; then \
+ echo "variable ANTLR_OUT_Arithmetic2_FPL empty."; \
+ exit 1; \
+ fi
+ $(REMAKE) $(EXECUTOR_IN_DIR)/Arithmetic2_SyntaxAnnotate
+
+Arithmetic2_SyntaxAnnotate__Test:\
+ $(ANTLR_OUT_Arithmetic2_FPL)\
+ $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic2_SyntaxAnnotate_PrintVisitor.java
+ @if [ -z "$(ANTLR_OUT_Arithmetic2_FPL)" ]; then \
+ echo "variable ANTLR_OUT_Arithmetic2_FPL empty."; \
+ exit 1; \
+ fi
+ $(REMAKE) $(EXECUTOR_IN_DIR)/Arithmetic2_SyntaxAnnotate__Test
+
+#-----------------------------------------------
+# Parsing/Analyzing ANTLR grammars
+#
+
+ANTLR_OUT_ANTLRv4_FPL:= $(shell ANTLR_OUT_FL ANTLRv4 -path $(ANTLR_OUT_DIR))
+ANTLRv4_SyntaxAnnotate:\
+ $(ANTLR_OUT_ANTLRv4_FPL)\
+ $(JAVA_COMP_IN_PRIMARY_DIR)/ANTLRv4_SyntaxAnnotate_PrintVisitor.java
+ @if [ -z "$(ANTLR_OUT_ANTLRv4_FPL)" ]; then \
+ echo "variable ANTLR_OUT_ANTLRv4_FPL empty."; \
+ exit 1; \
+ fi
+ $(REMAKE) $(EXECUTOR_IN_DIR)/ANTLRv4_SyntaxAnnotate
+
+
+#-----------------------------------------------
+# GQL_20240412
+
+ANTLR_OUT_GQL_20240412_FPL := $(shell ANTLR_OUT_FL GQL_20240412 -path $(ANTLR_OUT_DIR))
+GQL_20240412_SyntaxAnnotate:\
+ $(ANTLR_OUT_GQL_20240412_FPL)\
+ $(JAVA_COMP_IN_PRIMARY_DIR)/GQL_20240412_SyntaxAnnotate_PrintVisitor.java
+ @if [ -z "$(ANTLR_OUT_GQL_20240412_FPL)" ]; then \
+ echo "variable ANTLR_OUT_GQL_20240412_FPL empty."; \
+ exit 1; \
+ fi
+ $(REMAKE) $(EXECUTOR_IN_DIR)/GQL_20240412_SyntaxAnnotate
+
+GQL_20240412_SyntaxAnnotate__Test: \
+ $(ANTLR_OUT_GQL_20240412_FPL) \
+ $(JAVA_COMP_IN_PRIMARY_DIR)/GQL_20240412_SyntaxAnnotate_PrintVisitor.java
+ @if [ -z "$(ANTLR_OUT_GQL_20240412_FPL)" ]; then \
+ echo "variable ANTLR_OUT_GQL_20240412_FPL empty."; \
+ exit 1; \
+ fi
+ $(REMAKE) $(EXECUTOR_IN_DIR)/GQL_20240412_SyntaxAnnotate__Test
+
+
+TerminalToCategory:
+ $(REMAKE) $(EXECUTOR_IN_DIR)/TerminalToCategory
+
+GrammarSplitter:
+ $(REMAKE) $(EXECUTOR_IN_DIR)/GrammarSplitter
+
+#-----------------------------------------------
+# Compile all the .java files.
+
+java: $(JAVA_COMP_OUT_FPL)
+
+
+#================================================================================
+# generic targets, aka recipes
+#
+
+# this section is not parallel make friendly
+# $(ANTLR_OUT_DIR)/%Lexer.java: $(ANTLR_IN_PRIMARY_DIR)/%.g4
+# $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $<
+# $(ANTLR_OUT_DIR)/%Parser.java: $(ANTLR_IN_PRIMARY_DIR)/%.g4
+# $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $<
+# $(ANTLR_OUT_DIR)/%BaseListener.java: $(ANTLR_IN_PRIMARY_DIR)/%.g4
+# $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $<
+# $(ANTLR_OUT_DIR)/%Listener.java: $(ANTLR_IN_PRIMARY_DIR)/%.g4
+# $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $<
+# $(ANTLR_OUT_DIR)/%BaseVisitor.java: $(ANTLR_IN_PRIMARY_DIR)/%.g4
+# $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $<
+# $(ANTLR_OUT_DIR)/%Visitor.java: $(ANTLR_IN_PRIMARY_DIR)/%.g4
+# $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $<
+
+#--------------------
+# for a single `<name>.g4` grammar file
+
+$(ANTLR_OUT_DIR)/%Lexer.java \
+$(ANTLR_OUT_DIR)/%Parser.java \
+$(ANTLR_OUT_DIR)/%BaseListener.java \
+$(ANTLR_OUT_DIR)/%Listener.java \
+$(ANTLR_OUT_DIR)/%BaseVisitor.java \
+$(ANTLR_OUT_DIR)/%Visitor.java: $(ANTLR_IN_PRIMARY_DIR)/%.g4
+ @echo "copiling grammar from:" $<
+ $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $<
+
+#--------------------
+# For separate `<mame>Lexer.g4` and `<name>Parser.g4` files.
+# `make` prefers shorter pattern matches, so this should work.
+#
+
+$(ANTLR_OUT_DIR)/LexerAdaptor.java: $(ANTLR_IN_PRIMARY_DIR)/LexerAdaptor.java
+ cp $(ANTLR_IN_PRIMARY_DIR)/LexerAdaptor.java $(ANTLR_OUT_DIR)
+
+$(ANTLR_OUT_DIR)/%Lexer.java: $(ANTLR_IN_PRIMARY_DIR)/%Lexer.g4 $(ANTLR_OUT_DIR)/LexerAdaptor.java
+ @echo "making lexer grammar from:" $<
+ $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $<
+
+# Rule for all generated files from Parser.g4
+$(ANTLR_OUT_DIR)/%Parser.java \
+$(ANTLR_OUT_DIR)/%BaseListener.java \
+$(ANTLR_OUT_DIR)/%Listener.java \
+$(ANTLR_OUT_DIR)/%BaseVisitor.java \
+$(ANTLR_OUT_DIR)/%Visitor.java: $(ANTLR_IN_PRIMARY_DIR)/%Parser.g4
+ @echo "making other grammar files from:" $<
+ $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -lib $(ANTLR_OUT_DIR) -o $(ANTLR_OUT_DIR_PARENT) $<
+
+#---------------------
+
+# make .class file from .java file
+$(JAVA_COMP_OUT_DIR)/%.class: $(JAVA_COMP_IN_PRIMARY_DIR)/%.java
+ @echo "Compiling $<..."
+ $(JAVA_COMP) -d $(JAVA_COMP_OUT_DIR) -sourcepath $(JAVA_COMP_IN_DL) $<
+ @echo "Created $@"
+
+# Without this, `make` sees .jar files as intermediate and deletes them.
+.PRECIOUS: $(JAVA_COMP_OUT_DIR)/%.jar
+
+# make .jar from .class file
+$(JAVA_COMP_OUT_DIR)/%.jar: $(JAVA_COMP_OUT_DIR)/%.class
+ @echo "Building $*..."
+ $(JAVA_ARCHIVE) cf $@ -C $(JAVA_COMP_OUT_DIR) $*.class
+ @echo "Created $@"
+
+#make the wrapper script from the .jar file
+$(EXECUTOR_IN_DIR)/%: $(JVM_IN_DIR)/%.jar
+ @echo "Creating program for $*..."
+ @echo "#!/usr/bin/env bash" > $(EXECUTOR_IN_DIR)/$*
+ @echo "$(JAVA_INTERP) -cp ${CLASSPATH}:${JVM_IN_DP}:$(JVM_IN_DP)/$*.jar $*" \$$\@ >> $(EXECUTOR_IN_DIR)/$*
+ chmod +x $(EXECUTOR_IN_DIR)/$*
+ @echo "Created program $(EXECUTOR_IN_DIR)/$*"
--- /dev/null
+#================================================================================
+# Build the tools that are needed for building the project.
+#
+# GNU makefile
+
+# turn off implicit rules, because they can do unexpected things.
+.SUFFIXES:
+MAKEFLAGS += -r
+
+# `make` considers that PHONY targets do not correspond to files (other
+# targets do and the files have their dates checked). This declaration renders
+# innocuous the "feature" where `make` always tries to make its own
+# makefiles. There is no command line switch to turn this "feature" off.
+.PHONY: $(MAKEFILE_LIST)
+
+# 'make' has a "feature" where it deletes what it determines to be intermediate
+# files. There is no command line switch to turn this "feature" off. Combine
+# this "feature" with implicit rules and have loads of fun.
+.PRECIOUS: $(MAKEFILE_LIST)
+
+#$(info makefile: $(MAKEFILE_LIST))
+#$(info project_MAKECMDGOALS: $(MAKECMDGOALS))
+
+# for recursive make without leaving this makefile
+REMAKE = $(MAKE) -$(MAKEFLAGS) -f $(MAKEFILE_LIST)
+
+#================================================================================
+# Custom make targets
+#
+.PHONY: all ANTLR_OUT_FL
+
+all: ANTLR_OUT_FL
+
+ANTLR_OUT_FL: $(EXECUTOR_IN_DIR)/ANTLR_OUT_FL
+
+#================================================================================
+# generic targets, aka recipes
+#
+
+# Without this, `make` sees .jar files as intermediate and deletes them.
+.PRECIOUS: $(JAVA_COMP_OUT_DIR)/%.jar
+
+# make .class file from .java file
+$(JAVA_COMP_OUT_DIR)/%.class: $(JAVA_COMP_IN_PRIMARY_DIR)/%.java
+ @echo "Compiling $<..."
+ $(JAVA_COMP) -d $(JAVA_COMP_OUT_DIR) -sourcepath $(JAVA_COMP_IN_DL) $<
+ @echo "Created $@"
+
+# make .jar from .class file
+$(JAVA_COMP_OUT_DIR)/%.jar: $(JAVA_COMP_OUT_DIR)/%.class
+ @echo "Building $*..."
+ $(JAVA_ARCHIVE) cf $@ -C $(JAVA_COMP_OUT_DIR) $*.class
+ @echo "Created $@"
+
+#make the wrapper script from the .jar file
+$(EXECUTOR_IN_DIR)/%: $(JVM_IN_DIR)/%.jar
+ @echo "Creating program for $*..."
+ @echo "#!/usr/bin/env bash" > $(EXECUTOR_IN_DIR)/$*
+ @echo "$(JAVA_INTERP) -cp ${CLASSPATH}:${JVM_IN_DP}:$(JVM_IN_DP)/$*.jar $*" \$$\@ >> $(EXECUTOR_IN_DIR)/$*
+ chmod +x $(EXECUTOR_IN_DIR)/$*
+ @echo "Created program $(EXECUTOR_IN_DIR)/$*"
--- /dev/null
+#================================================================================
+# top level makefile calls makefile-tool and makefile-project
+#
+# GNU makefile
+
+# turn off implicit rules, because they can do unexpected things.
+.SUFFIXES:
+MAKEFLAGS += -r
+
+# `make` considers that PHONY targets do not correspond to files (other
+# targets do and the files have their dates checked). This declaration renders
+# innocuous the "feature" where `make` always tries to make its own
+# makefiles. There is no command line switch to turn this "feature" off.
+.PHONY: $(MAKEFILE_LIST)
+
+# 'make' has a "feature" where it deletes what it determines to be intermediate
+# files. There is no command line switch to turn this "feature" off. Combine
+# this "feature" with implicit rules and have loads of fun.
+.PRECIOUS: $(MAKEFILE_LIST)
+
+#$(info makefile: $(MAKEFILE_LIST))
+#$(info project_MAKECMDGOALS: $(MAKECMDGOALS))
+
+# for recursive make without leaving this makefile
+REMAKE = $(MAKE) -$(MAKEFLAGS) -f $(MAKEFILE_LIST)
+
+#================================================================================
+# Custom make targets
+#
+.PHONY: all nothing version clean setup
+
+all: project-all
+
+# useful for distinguishing between make syntax errors and build errors
+nothing:
+ @:
+
+version:
+ $(info ANTLR_JAR is '$(notdir $(ANTLR_JAR))')
+ @ $(JAVA_COMP) --version
+ @ $(JAVA_ARCHIVE) --version
+ @ make -v | head -n 1
+ @ echo "makefile 0.4"
+
+# `clean` is program independent of `make`
+clean:
+ @echo "Use the command `clean <option>` instead of make.`"
+
+setup:
+ mkdir -p $(ANTLR_IN_PRIMARY_DIR) $(JAVA_COMP_IN_PRIMARY_DIR) $(JVM_IN_DIR) $(EXECUTOR_IN_DIR) test deprecated experiment ologist temporary
+
+# Ensure tools are built before building the project programs
+tool-%: setup
+ $(BIN_MAKE) -f $(EXECUTOR_IN_DIR)/makefile-tool.mk -$(MAKEFLAGS) $*
+
+project-%: tool-all
+ $(BIN_MAKE) -f $(EXECUTOR_IN_DIR)/makefile-project.mk -$(MAKEFLAGS) $*
+
+# delegate other targets to the project
+%: project-%
+ @:
+
--- /dev/null
+task setup {
+ doLast {
+ def dirs = [
+ "$(ANTLR_IN_PRIMARY_DIR)"
+ ,"$(JAVA_COMP_IN_DIR)"
+ ,"$(JAVA_COMP_IN_PRIMARY_DIR)"
+ ,"$(JAVA_COMP_IN_ANTLR_DIR)"
+ ,"$(JAVA_COMP_IN_SYN_DIR)"
+ ,"$(JVM_IN_DIR)"
+ ,"$(EXECUTOR_IN_DIR)"
+ ,"test"
+ ,"deprecated"
+ ,"experiment"
+ ,"ologist"
+ ,"temporary"
+ ]
+ dirs.each { dir ->
+ if (!file(dir).exists()) {
+ mkdir dir
+ }
+ }
+ }
+}
+
+task tool(type: Exec) {
+ dependsOn setup
+ commandLine '$(BIN_MAKE)', '-f', '$(EXECUTOR_IN_DIR)/makefile-tool.mk', '-$(MAKEFLAGS)', 'all'
+}
+
+task project(type: Exec) {
+ dependsOn tool
+ commandLine '$(BIN_MAKE)', '-f', '$(EXECUTOR_IN_DIR)/makefile-project.mk', '-$(MAKEFLAGS)', 'all'
+}
+
+task clean {
+ doLast {
+ println "Use the command `clean <option>` instead of make."
+ }
+}
+
+task version {
+ doLast {
+ println "ANTLR_JAR is '${notdir(ANTLR_JAR)}'"
+ exec {
+ commandLine '$(JAVA_COMP)', '--version'
+ }
+ exec {
+ commandLine '$(JAVA_ARCHIVE)', '--version'
+ }
+ exec {
+ commandLine 'make', '-v'
+ }
+ println "makefile 0.4"
+ }
+}
+
+task all {
+ dependsOn project
+}
+
+task nothing {
+ doLast {
+ // useful for distinguishing between make syntax errors and build errors
+ }
+}
+
+tasks.withType(Exec) {
+ doFirst {
+ println "Executing $name"
+ }
+}
+++ /dev/null
-task setup {
- doLast {
- def dirs = [
- "$(ANTLR_IN_PRIMARY_DIR)",
- "$(JAVA_COMP_IN_DIR)",
- "$(JAVA_COMP_IN_PRIMARY_DIR)",
- "$(JAVA_COMP_IN_ANTLR_DIR)",
- "$(JAVA_COMP_IN_SYN_DIR)",
- "$(JVM_IN_DIR)",
- "$(EXECUTOR_IN_DIR)",
- "test",
- "deprecated",
- "experiment",
- "ologist",
- "temporary"
- ]
- dirs.each { dir ->
- if (!file(dir).exists()) {
- mkdir dir
- }
- }
- }
-}
-
-def compileJava(source, target) {
- tasks.create(name: "compile${source}", type: Exec) {
- commandLine '$(JAVA_COMP)', '-d', '$(JAVA_COMP_OUT_DIR)', '-sourcepath', '$(JAVA_COMP_IN_DL)', source
- doLast {
- println "Compiled ${source} to ${target}"
- }
- }
-}
-
-def createJar(source, target) {
- tasks.create(name: "jar${source}", type: Exec) {
- commandLine '$(JAVA_ARCHIVE)', 'cf', target, '-C', '$(JAVA_COMP_OUT_DIR)', source
- doLast {
- println "Created ${target}"
- }
- }
-}
-
-def createWrapper(source, target) {
- tasks.create(name: "wrapper${source}", type: Exec) {
- doLast {
- def script = new File(target)
- script.text = "#!/usr/bin/env bash\n$(JAVA_INTERP) -cp ${CLASSPATH}:${JVM_IN_DP}:${JVM_IN_DP}/${source}.jar ${source} \$@"
- script.setExecutable(true)
- println "Created program ${target}"
- }
- }
-}
-
-task ANTLR_OUT_FL {
- dependsOn setup
- doLast {
- println "Building ANTLR_OUT_FL..."
- // Add specific build steps for ANTLR_OUT_FL here
- }
-}
-
-task all {
- dependsOn ANTLR_OUT_FL
- doLast {
- println "Building all targets..."
- }
-}
-
-task clean {
- doLast {
- println "Use the command `clean <option>` instead of make."
- }
-}
-
-task version {
- doLast {
- println "ANTLR_JAR is '${notdir(ANTLR_JAR)}'"
- exec {
- commandLine '$(JAVA_COMP)', '--version'
- }
- exec {
- commandLine '$(JAVA_ARCHIVE)', '--version'
- }
- exec {
- commandLine 'make', '-v'
- }
- println "makefile 0.4"
- }
-}
-
-task nothing {
- doLast {
- // useful for distinguishing between make syntax errors and build errors
- }
-}
-
-tasks.withType(Exec) {
- doFirst {
- println "Executing $name"
- }
-}
-
-// Example usage
-compileJava('$(JAVA_COMP_IN_PRIMARY_DIR)/Example.java', '$(JAVA_COMP_OUT_DIR)/Example.class')
-createJar('Example.class', '$(JAVA_COMP_OUT_DIR)/Example.jar')
-createWrapper('Example', '$(EXECUTOR_IN_DIR)/Example')
+++ /dev/null
-task setup {
- doLast {
- def dirs = ["$(ANTLR_IN_PRIMARY_DIR)", "$(JAVA_COMP_IN_PRIMARY_DIR)", "$(JVM_IN_DIR)", "$(EXECUTOR_IN_DIR)", "test", "deprecated", "experiment", "ologist", "temporary"]
- dirs.each { dir ->
- mkdir dir
- }
- }
-}
-
-task tool(type: Exec) {
- dependsOn setup
- commandLine '$(BIN_MAKE)', '-f', '$(EXECUTOR_IN_DIR)/makefile-tool.mk', '-$(MAKEFLAGS)', 'all'
-}
-
-task project(type: Exec) {
- dependsOn tool
- commandLine '$(BIN_MAKE)', '-f', '$(EXECUTOR_IN_DIR)/makefile-project.mk', '-$(MAKEFLAGS)', 'all'
-}
-
-task clean {
- doLast {
- println "Use the command `clean <option>` instead of make."
- }
-}
-
-task version {
- doLast {
- println "ANTLR_JAR is '${notdir(ANTLR_JAR)}'"
- exec {
- commandLine '$(JAVA_COMP)', '--version'
- }
- exec {
- commandLine '$(JAVA_ARCHIVE)', '--version'
- }
- exec {
- commandLine 'make', '-v'
- }
- println "makefile 0.4"
- }
-}
-
-task all {
- dependsOn project
-}
-
-task nothing {
- doLast {
- // useful for distinguishing between make syntax errors and build errors
- }
-}
-
-tasks.withType(Exec) {
- doFirst {
- println "Executing $name"
- }
-}
-
-
-----------------------
-// Function to compile .java files to .class files
-def compileJava(source, target) {
- tasks.create(name: "compile${source}", type: Exec) {
- commandLine '$(JAVA_COMP)', '-d', '$(JAVA_COMP_OUT_DIR)', '-sourcepath', '$(JAVA_COMP_IN_DL)', source
- doLast {
- println "Compiled ${source} to ${target}"
- }
- }
-}
-
-// Function to create .jar files from .class files
-def createJar(source, target) {
- tasks.create(name: "jar${source}", type: Exec) {
- commandLine '$(JAVA_ARCHIVE)', 'cf', target, '-C', '$(JAVA_COMP_OUT_DIR)', source
- doLast {
- println "Created ${target}"
- }
- }
-}
-
-// Function to create wrapper scripts from .jar files
-def createWrapper(source, target) {
- tasks.create(name: "wrapper${source}", type: Exec) {
- doLast {
- def script = new File(target)
- script.text = "#!/usr/bin/env bash\n$(JAVA_INTERP) -cp ${CLASSPATH}:${JVM_IN_DP}:${JVM_IN_DP}/${source}.jar ${source} \$@"
- script.setExecutable(true)
- println "Created program ${target}"
- }
- }
-}
-
+++ /dev/null
-#!/usr/bin/env bash
-
-if [[ -z "${DEVELOPER_HOME}" || -z "${EXECUTOR_IN_DIR}" ]]; then
- echo "required variables not set. As seen by:"
- echo " DEVELOPER_HOME: $DEVELOPER_HOME"
- echo " EXECUTOR_IN_DIR: $EXECUTOR_IN_DIR"
- exit 1
-fi
-
-cd "$DEVELOPER_HOME"
-
-# in case there have been edits to the environment
-source "${EXECUTOR_IN_DIR}"/env_build
-
-${BIN_MAKE} --no-print-directory -f "${EXECUTOR_IN_DIR}"/makefile-top.mk $@
+++ /dev/null
-#--------------------------------------------------------------------------------
-# Project build
-#
-# GNU makefile
-
-# turn off implicit rules, because they can do unexpected things.
-.SUFFIXES:
-MAKEFLAGS += -r
-
-# `make` considers that PHONY targets do not correspond to files (other
-# targets do and the files have their dates checked). This declaration renders
-# innocuous the "feature" where `make` always tries to make its own
-# makefiles. There is no command line switch to turn this "feature" off.
-.PHONY: $(MAKEFILE_LIST)
-
-# 'make' has a "feature" where it deletes what it determines to be intermediate
-# files. There is no command line switch to turn this "feature" off. Combine
-# this "feature" with implicit rules and have loads of fun.
-.PRECIOUS: $(MAKEFILE_LIST)
-
-#$(info makefile: $(MAKEFILE_LIST))
-#$(info project_MAKECMDGOALS: $(MAKECMDGOALS))
-
-# for recursive make without leaving this makefile
-REMAKE = $(MAKE) -$(MAKEFLAGS) -f $(MAKEFILE_LIST)
-
-#================================================================================
-# Custom make targets
-#
-
-all: $(EXECUTOR_IN_FPL)
-
-
-#-----------------------------------------------
-# These do not require antlr generated java files
-
-RuleNameListRegx: $(EXECUTOR_IN_DIR)/RuleNameListRegx
-RuleNameList: $(EXECUTOR_IN_DIR)/RuleNameList
-
-Synthesize_SyntaxAnnotate_PrintVisitorMethod:\
- $(JAVA_COMP_IN_PRIMARY_DIR)/StringUtils.java\
- $(EXECUTOR_IN_DIR)/Synthesize_SyntaxAnnotate_PrintVisitorMethod
-Synthesize_SyntaxAnnotate_PrintVisitor:\
- $(JAVA_COMP_IN_PRIMARY_DIR)/StringUtils.java\
- $(JAVA_COMP_IN_PRIMARY_DIR)/Synthesize_SyntaxAnnotate_PrintVisitorMethod.java\
- $(EXECUTOR_IN_DIR)/Synthesize_SyntaxAnnotate_PrintVisitor
-
-Synthesize_SyntaxAnnotate:\
- $(JAVA_COMP_IN_PRIMARY_DIR)/StringUtils.java\
- $(EXECUTOR_IN_DIR)/Synthesize_SyntaxAnnotate
-
-#-----------------------------------------------
-# Arithmetic
-
-ANTLR_OUT_Arithmetic_FPL:= $(shell ANTLR_OUT_FL Arithmetic -path $(ANTLR_OUT_DIR))
-#$(info ANTLR_OUT_Arithmetic_FPL: $(ANTLR_OUT_Arithmetic_FPL))
-Arithmetic_Echo:\
- $(ANTLR_OUT_Arithmetic_FPL)\
- $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_Echo_PrintVisitor.java
- @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \
- echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \
- exit 1; \
- fi
- $(REMAKE) $(EXECUTOR_IN_DIR)/Arithmetic_Echo
-
-Arithmetic_Echo__Test:\
- $(ANTLR_OUT_Arithmetic_FPL)\
- $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_Echo_PrintVisitor.java
- @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \
- echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \
- exit 1; \
- fi
- $(REMAKE) $(EXECUTOR_IN_DIR)/Arithmetic_Echo__Test
-
-Arithmetic_SyntaxAnnotate:\
- $(ANTLR_OUT_Arithmetic_FPL)\
- $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_SyntaxAnnotate_PrintVisitor.java
- @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \
- echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \
- exit 1; \
- fi
- $(REMAKE) $(EXECUTOR_IN_DIR)/Arithmetic_SyntaxAnnotate
-
-Arithmetic_SyntaxAnnotate__Test:\
- $(ANTLR_OUT_Arithmetic_FPL)\
- $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_SyntaxAnnotate_PrintVisitor.java
- @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \
- echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \
- exit 1; \
- fi
- $(REMAKE) $(EXECUTOR_IN_DIR)/Arithmetic_SyntaxAnnotate__Test
-
-Arithmetic_Swap:\
- $(ANTLR_OUT_Arithmetic_FPL)\
- $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_SwapVisitor.java\
- $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic_Echo_PrintVisitor.java
- @if [ -z "$(ANTLR_OUT_Arithmetic_FPL)" ]; then \
- echo "variable ANTLR_OUT_Arithmetic_FPL empty."; \
- exit 1; \
- fi
- $(REMAKE) $(EXECUTOR_IN_DIR)/Arithmetic_Swap
-
-#-----------------------------------------------
-# Arithmetic2
-#
-
-ANTLR_OUT_Arithmetic2_FPL:= $(shell ANTLR_OUT_FL Arithmetic2 -path $(ANTLR_OUT_DIR))
-Arithmetic2_SyntaxAnnotate:\
- $(ANTLR_OUT_Arithmetic2_FPL)\
- $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic2_SyntaxAnnotate_PrintVisitor.java
- @if [ -z "$(ANTLR_OUT_Arithmetic2_FPL)" ]; then \
- echo "variable ANTLR_OUT_Arithmetic2_FPL empty."; \
- exit 1; \
- fi
- $(REMAKE) $(EXECUTOR_IN_DIR)/Arithmetic2_SyntaxAnnotate
-
-Arithmetic2_SyntaxAnnotate__Test:\
- $(ANTLR_OUT_Arithmetic2_FPL)\
- $(JAVA_COMP_IN_PRIMARY_DIR)/Arithmetic2_SyntaxAnnotate_PrintVisitor.java
- @if [ -z "$(ANTLR_OUT_Arithmetic2_FPL)" ]; then \
- echo "variable ANTLR_OUT_Arithmetic2_FPL empty."; \
- exit 1; \
- fi
- $(REMAKE) $(EXECUTOR_IN_DIR)/Arithmetic2_SyntaxAnnotate__Test
-
-#-----------------------------------------------
-# Parsing/Analyzing ANTLR grammars
-#
-
-ANTLR_OUT_ANTLRv4_FPL:= $(shell ANTLR_OUT_FL ANTLRv4 -path $(ANTLR_OUT_DIR))
-ANTLRv4_SyntaxAnnotate:\
- $(ANTLR_OUT_ANTLRv4_FPL)\
- $(JAVA_COMP_IN_PRIMARY_DIR)/ANTLRv4_SyntaxAnnotate_PrintVisitor.java
- @if [ -z "$(ANTLR_OUT_ANTLRv4_FPL)" ]; then \
- echo "variable ANTLR_OUT_ANTLRv4_FPL empty."; \
- exit 1; \
- fi
- $(REMAKE) $(EXECUTOR_IN_DIR)/ANTLRv4_SyntaxAnnotate
-
-
-#-----------------------------------------------
-# GQL_20240412
-
-ANTLR_OUT_GQL_20240412_FPL := $(shell ANTLR_OUT_FL GQL_20240412 -path $(ANTLR_OUT_DIR))
-GQL_20240412_SyntaxAnnotate:\
- $(ANTLR_OUT_GQL_20240412_FPL)\
- $(JAVA_COMP_IN_PRIMARY_DIR)/GQL_20240412_SyntaxAnnotate_PrintVisitor.java
- @if [ -z "$(ANTLR_OUT_GQL_20240412_FPL)" ]; then \
- echo "variable ANTLR_OUT_GQL_20240412_FPL empty."; \
- exit 1; \
- fi
- $(REMAKE) $(EXECUTOR_IN_DIR)/GQL_20240412_SyntaxAnnotate
-
-GQL_20240412_SyntaxAnnotate__Test: \
- $(ANTLR_OUT_GQL_20240412_FPL) \
- $(JAVA_COMP_IN_PRIMARY_DIR)/GQL_20240412_SyntaxAnnotate_PrintVisitor.java
- @if [ -z "$(ANTLR_OUT_GQL_20240412_FPL)" ]; then \
- echo "variable ANTLR_OUT_GQL_20240412_FPL empty."; \
- exit 1; \
- fi
- $(REMAKE) $(EXECUTOR_IN_DIR)/GQL_20240412_SyntaxAnnotate__Test
-
-
-TerminalToCategory:
- $(REMAKE) $(EXECUTOR_IN_DIR)/TerminalToCategory
-
-GrammarSplitter:
- $(REMAKE) $(EXECUTOR_IN_DIR)/GrammarSplitter
-
-#-----------------------------------------------
-# Compile all the .java files.
-
-java: $(JAVA_COMP_OUT_FPL)
-
-
-#================================================================================
-# generic targets, aka recipes
-#
-
-# this section is not parallel make friendly
-# $(ANTLR_OUT_DIR)/%Lexer.java: $(ANTLR_IN_PRIMARY_DIR)/%.g4
-# $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $<
-# $(ANTLR_OUT_DIR)/%Parser.java: $(ANTLR_IN_PRIMARY_DIR)/%.g4
-# $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $<
-# $(ANTLR_OUT_DIR)/%BaseListener.java: $(ANTLR_IN_PRIMARY_DIR)/%.g4
-# $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $<
-# $(ANTLR_OUT_DIR)/%Listener.java: $(ANTLR_IN_PRIMARY_DIR)/%.g4
-# $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $<
-# $(ANTLR_OUT_DIR)/%BaseVisitor.java: $(ANTLR_IN_PRIMARY_DIR)/%.g4
-# $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $<
-# $(ANTLR_OUT_DIR)/%Visitor.java: $(ANTLR_IN_PRIMARY_DIR)/%.g4
-# $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $<
-
-#--------------------
-# for a single `<name>.g4` grammar file
-
-$(ANTLR_OUT_DIR)/%Lexer.java \
-$(ANTLR_OUT_DIR)/%Parser.java \
-$(ANTLR_OUT_DIR)/%BaseListener.java \
-$(ANTLR_OUT_DIR)/%Listener.java \
-$(ANTLR_OUT_DIR)/%BaseVisitor.java \
-$(ANTLR_OUT_DIR)/%Visitor.java: $(ANTLR_IN_PRIMARY_DIR)/%.g4
- @echo "copiling grammar from:" $<
- $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $<
-
-#--------------------
-# For separate `<mame>Lexer.g4` and `<name>Parser.g4` files.
-# `make` prefers shorter pattern matches, so this should work.
-#
-
-$(ANTLR_OUT_DIR)/LexerAdaptor.java: $(ANTLR_IN_PRIMARY_DIR)/LexerAdaptor.java
- cp $(ANTLR_IN_PRIMARY_DIR)/LexerAdaptor.java $(ANTLR_OUT_DIR)
-
-$(ANTLR_OUT_DIR)/%Lexer.java: $(ANTLR_IN_PRIMARY_DIR)/%Lexer.g4 $(ANTLR_OUT_DIR)/LexerAdaptor.java
- @echo "making lexer grammar from:" $<
- $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -o $(ANTLR_OUT_DIR_PARENT) $<
-
-# Rule for all generated files from Parser.g4
-$(ANTLR_OUT_DIR)/%Parser.java \
-$(ANTLR_OUT_DIR)/%BaseListener.java \
-$(ANTLR_OUT_DIR)/%Listener.java \
-$(ANTLR_OUT_DIR)/%BaseVisitor.java \
-$(ANTLR_OUT_DIR)/%Visitor.java: $(ANTLR_IN_PRIMARY_DIR)/%Parser.g4
- @echo "making other grammar files from:" $<
- $(JAVA_INTERP) -jar $(ANTLR_JAR) -Dlanguage=Java -visitor -lib $(ANTLR_OUT_DIR) -o $(ANTLR_OUT_DIR_PARENT) $<
-
-#---------------------
-
-# make .class file from .java file
-$(JAVA_COMP_OUT_DIR)/%.class: $(JAVA_COMP_IN_PRIMARY_DIR)/%.java
- @echo "Compiling $<..."
- $(JAVA_COMP) -d $(JAVA_COMP_OUT_DIR) -sourcepath $(JAVA_COMP_IN_DL) $<
- @echo "Created $@"
-
-# Without this, `make` sees .jar files as intermediate and deletes them.
-.PRECIOUS: $(JAVA_COMP_OUT_DIR)/%.jar
-
-# make .jar from .class file
-$(JAVA_COMP_OUT_DIR)/%.jar: $(JAVA_COMP_OUT_DIR)/%.class
- @echo "Building $*..."
- $(JAVA_ARCHIVE) cf $@ -C $(JAVA_COMP_OUT_DIR) $*.class
- @echo "Created $@"
-
-#make the wrapper script from the .jar file
-$(EXECUTOR_IN_DIR)/%: $(JVM_IN_DIR)/%.jar
- @echo "Creating program for $*..."
- @echo "#!/usr/bin/env bash" > $(EXECUTOR_IN_DIR)/$*
- @echo "$(JAVA_INTERP) -cp ${CLASSPATH}:${JVM_IN_DP}:$(JVM_IN_DP)/$*.jar $*" \$$\@ >> $(EXECUTOR_IN_DIR)/$*
- chmod +x $(EXECUTOR_IN_DIR)/$*
- @echo "Created program $(EXECUTOR_IN_DIR)/$*"
+++ /dev/null
-#================================================================================
-# Build the tools that are needed for building the project.
-#
-# GNU makefile
-
-# turn off implicit rules, because they can do unexpected things.
-.SUFFIXES:
-MAKEFLAGS += -r
-
-# `make` considers that PHONY targets do not correspond to files (other
-# targets do and the files have their dates checked). This declaration renders
-# innocuous the "feature" where `make` always tries to make its own
-# makefiles. There is no command line switch to turn this "feature" off.
-.PHONY: $(MAKEFILE_LIST)
-
-# 'make' has a "feature" where it deletes what it determines to be intermediate
-# files. There is no command line switch to turn this "feature" off. Combine
-# this "feature" with implicit rules and have loads of fun.
-.PRECIOUS: $(MAKEFILE_LIST)
-
-#$(info makefile: $(MAKEFILE_LIST))
-#$(info project_MAKECMDGOALS: $(MAKECMDGOALS))
-
-# for recursive make without leaving this makefile
-REMAKE = $(MAKE) -$(MAKEFLAGS) -f $(MAKEFILE_LIST)
-
-#================================================================================
-# Custom make targets
-#
-.PHONY: all ANTLR_OUT_FL
-
-all: ANTLR_OUT_FL
-
-ANTLR_OUT_FL: $(EXECUTOR_IN_DIR)/ANTLR_OUT_FL
-
-#================================================================================
-# generic targets, aka recipes
-#
-
-# Without this, `make` sees .jar files as intermediate and deletes them.
-.PRECIOUS: $(JAVA_COMP_OUT_DIR)/%.jar
-
-# make .class file from .java file
-$(JAVA_COMP_OUT_DIR)/%.class: $(JAVA_COMP_IN_PRIMARY_DIR)/%.java
- @echo "Compiling $<..."
- $(JAVA_COMP) -d $(JAVA_COMP_OUT_DIR) -sourcepath $(JAVA_COMP_IN_DL) $<
- @echo "Created $@"
-
-# make .jar from .class file
-$(JAVA_COMP_OUT_DIR)/%.jar: $(JAVA_COMP_OUT_DIR)/%.class
- @echo "Building $*..."
- $(JAVA_ARCHIVE) cf $@ -C $(JAVA_COMP_OUT_DIR) $*.class
- @echo "Created $@"
-
-#make the wrapper script from the .jar file
-$(EXECUTOR_IN_DIR)/%: $(JVM_IN_DIR)/%.jar
- @echo "Creating program for $*..."
- @echo "#!/usr/bin/env bash" > $(EXECUTOR_IN_DIR)/$*
- @echo "$(JAVA_INTERP) -cp ${CLASSPATH}:${JVM_IN_DP}:$(JVM_IN_DP)/$*.jar $*" \$$\@ >> $(EXECUTOR_IN_DIR)/$*
- chmod +x $(EXECUTOR_IN_DIR)/$*
- @echo "Created program $(EXECUTOR_IN_DIR)/$*"
+++ /dev/null
-#================================================================================
-# top level makefile calls makefile-tool and makefile-project
-#
-# GNU makefile
-
-# turn off implicit rules, because they can do unexpected things.
-.SUFFIXES:
-MAKEFLAGS += -r
-
-# `make` considers that PHONY targets do not correspond to files (other
-# targets do and the files have their dates checked). This declaration renders
-# innocuous the "feature" where `make` always tries to make its own
-# makefiles. There is no command line switch to turn this "feature" off.
-.PHONY: $(MAKEFILE_LIST)
-
-# 'make' has a "feature" where it deletes what it determines to be intermediate
-# files. There is no command line switch to turn this "feature" off. Combine
-# this "feature" with implicit rules and have loads of fun.
-.PRECIOUS: $(MAKEFILE_LIST)
-
-#$(info makefile: $(MAKEFILE_LIST))
-#$(info project_MAKECMDGOALS: $(MAKECMDGOALS))
-
-# for recursive make without leaving this makefile
-REMAKE = $(MAKE) -$(MAKEFLAGS) -f $(MAKEFILE_LIST)
-
-#================================================================================
-# Custom make targets
-#
-.PHONY: all nothing version clean setup
-
-all: project-all
-
-# useful for distinguishing between make syntax errors and build errors
-nothing:
- @:
-
-version:
- $(info ANTLR_JAR is '$(notdir $(ANTLR_JAR))')
- @ $(JAVA_COMP) --version
- @ $(JAVA_ARCHIVE) --version
- @ make -v | head -n 1
- @ echo "makefile 0.4"
-
-# `clean` is program independent of `make`
-clean:
- @echo "Use the command `clean <option>` instead of make.`"
-
-setup:
- mkdir -p $(ANTLR_IN_PRIMARY_DIR) $(JAVA_COMP_IN_PRIMARY_DIR) $(JVM_IN_DIR) $(EXECUTOR_IN_DIR) test deprecated experiment ologist temporary
-
-# Ensure tools are built before building the project programs
-tool-%: setup
- $(BIN_MAKE) -f $(EXECUTOR_IN_DIR)/makefile-tool.mk -$(MAKEFLAGS) $*
-
-project-%: tool-all
- $(BIN_MAKE) -f $(EXECUTOR_IN_DIR)/makefile-project.mk -$(MAKEFLAGS) $*
-
-# delegate other targets to the project
-%: project-%
- @:
-
+++ /dev/null
-task setup {
- doLast {
- def dirs = [
- "$(ANTLR_IN_PRIMARY_DIR)"
- ,"$(JAVA_COMP_IN_DIR)"
- ,"$(JAVA_COMP_IN_PRIMARY_DIR)"
- ,"$(JAVA_COMP_IN_ANTLR_DIR)"
- ,"$(JAVA_COMP_IN_SYN_DIR)"
- ,"$(JVM_IN_DIR)"
- ,"$(EXECUTOR_IN_DIR)"
- ,"test"
- ,"deprecated"
- ,"experiment"
- ,"ologist"
- ,"temporary"
- ]
- dirs.each { dir ->
- if (!file(dir).exists()) {
- mkdir dir
- }
- }
- }
-}
-
-task tool(type: Exec) {
- dependsOn setup
- commandLine '$(BIN_MAKE)', '-f', '$(EXECUTOR_IN_DIR)/makefile-tool.mk', '-$(MAKEFLAGS)', 'all'
-}
-
-task project(type: Exec) {
- dependsOn tool
- commandLine '$(BIN_MAKE)', '-f', '$(EXECUTOR_IN_DIR)/makefile-project.mk', '-$(MAKEFLAGS)', 'all'
-}
-
-task clean {
- doLast {
- println "Use the command `clean <option>` instead of make."
- }
-}
-
-task version {
- doLast {
- println "ANTLR_JAR is '${notdir(ANTLR_JAR)}'"
- exec {
- commandLine '$(JAVA_COMP)', '--version'
- }
- exec {
- commandLine '$(JAVA_ARCHIVE)', '--version'
- }
- exec {
- commandLine 'make', '-v'
- }
- println "makefile 0.4"
- }
-}
-
-task all {
- dependsOn project
-}
-
-task nothing {
- doLast {
- // useful for distinguishing between make syntax errors and build errors
- }
-}
-
-tasks.withType(Exec) {
- doFirst {
- println "Executing $name"
- }
-}
# in case there have been edits to the environment
source "${EXECUTOR_IN_DIR}"/env_build
-"${GRADLE_HOME}"/bin/gradle -b "${EXECUTOR_IN_DIR}"/build.gradle "$@"
+"${GRADLE_HOME}"/bin/gradle --project-dir ${REPO_HOME} "$@"
--- /dev/null
+
+*
+!/.gitignore
+
--- /dev/null
+
+*
+!/.gitignore
+
+++ /dev/null
-
-
-antlr-mode.el -> .emacs.d
-(autoload 'antlr-mode "antlr-mode" "Major mode for editing ANTLR grammars." t)
-(add-to-list 'auto-mode-alist '("\\.g4\\'" . antlr-mode))
-
-un M-x package-install gradle-mode.
-(require 'gradle-mode)
-(gradle-mode 1)
-
-C-c C-g b to run gradle build
-C-c C-g t to run gradle test
-C-c C-g s to run a single test
-C-c C-g d to run a Gradle command with the daemon
-
-Run M-x package-install RET groovy-mode RET.
-(require 'groovy-mode)
-(add-to-list 'auto-mode-alist '("\\.gradle\\'" . groovy-mode))
-
-(electric-indent-mode 1)
-Run M-x package-install RET auto-indent-mode RET.
-
-(require 'auto-indent-mode)
-(auto-indent-global-mode)
-
-
-(defun my-groovy-mode-hook ()
- (setq groovy-indent-offset 2)) ;; Set indentation level to 2 spaces
-
-(add-hook 'groovy-mode-hook 'my-groovy-mode-hook)
\ No newline at end of file
C-c C-g s to run a single test
C-c C-g d to run a Gradle command with the daemon
-Run M-x package-install RET groovy-mode RET.
+(package-install groovy-mode)
(require 'groovy-mode)
(add-to-list 'auto-mode-alist '("\\.gradle\\'" . groovy-mode))
-(electric-indent-mode 1)
-Run M-x package-install RET auto-indent-mode RET.
+;; buffer must be reloaded for it to work
+(package-install 'auto-indent-mode)
(require 'auto-indent-mode)
-(auto-indent-global-mode)
+
+(add-hook 'groovy-mode-hook 'auto-indent-mode)
+(add-hook 'groovy-mode-hook
+ (lambda ()
+ (setq tab-width 2)
+ (setq groovy-indent-offset 2)
+ (auto-indent-mode t))) ;; Enable auto-indent-mode
+
+(electric-indent-mode 1)
+(auto-indent-global-mode nil)
+
fi
export DEVELOPER_HOME="$REPO_HOME/developer"
-
-export JAVA_HOME="$REPO_HOME/tool/jdk-22.0.1+8"
export GRADLE_HOME="$REPO_HOME/tool/gradle-8.10-rc-1"
-export ANTLR_JAR="$REPO_HOME/tool/executor/antlr-4.11.1-complete.jar"
export PATH=\
"$DEVELOPER_HOME"/executor\
:"$REPO_HOME"/tool/executor\
-:"$JAVA_HOME"/bin\
:"$GRADLE_HOME"/bin\
:"$PATH"
-export GRADLE_OPTS="--settings-file $REPO_HOME/settings.gradle"
-
-
cd "$DEVELOPER_HOME"
# This is helpful so that cut and paste from the makefile to the shell can be used for testing.
--- /dev/null
+
+gradle
+
+1. This is risky software.
+
+ It searches for its files, thus traverses the directory tree.
+
+ It access the internet for data.
+
+ The installer downloads binaries from the site. It is not distributed as a repo
+ with Fedora, Debian, or .. anything else.
+
+ It has access to everyone's projects. Big honeypot.
+
+
+2. Java
+
+ Gradle is a Java program so it needs the JVM to run.
+
+ Gradle is being used to install most of the tools.
+
+ It does not install Gradle of course. There is a bash script for that.
+
+ We assume that Gradle is using a version of Java on the system. But it will
+ still install a specific version of Java required by the project build.
+ `gradle.parameters` sets the version number for the build Java. The build
+ Java will be installed under the 'tools' directory.
+
+
+
categories were created manually. I wonder if categories are necessary, but
they can't hurt, and as they are done I will keep them.
+2024-09-11
+
+ I have tried, have a working example of, a synthesis approach, where one
+ program synthesizes another program that does the syntax annotation.
+
+ Also worked on reducing the GQL grammar by abstracting it. For example
+ creating one token that stands for all terminal symbols. Though not sure what
+ the advantage is of working with the abstracted grammar instead of the
+ original, as we will have to make a distinction among the various rules that
+ collapsed together before generating the output.
+
+ Now trying to apply rewrite rules to transform tree T0 to tree T1.
+
+ Make does not chain pattern rules, which is causing problems. Everyone in
+ Javaland apparently is using Maven or Gradle, so switching over to Gradle.
+
+<!-- LocalWords: Javaland Gradle
+ -->
+// settings.gradle
rootProject.name = 'GQL_to_Cypher'
+++ /dev/null
-*
-!/.gitignore