env["CPPPATH"] += Dir['modules/libcds/source/**/'] + [
'modules/libopts/source',
'source/libparse/',
+ 'source/sclpl/',
]
end
-#include <libparse.h>
-#include "codegen.h"
-#include "pprint.h"
+#include <sclpl.h>
#if 0
static void lift_funcs(vec_t* fnlst, AST* tree) {
+++ /dev/null
-/**
- @file codegen.h
- @brief TODO: Describe this file
- $Revision$
- $HeadURL$
- */
-#ifndef CODEGEN_H
-#define CODEGEN_H
-
-#include <stdio.h>
-#include "vec.h"
-
-void codegen_csource(FILE* file, vec_t* program);
-
-#endif /* CODEGEN_H */
$Revision$
$HeadURL$
*/
-#include "log.h"
-#include <stdio.h>
+#include <sclpl.h>
void log_error(const char msg[], ...) {
va_list args;
+++ /dev/null
-/**
- @file log.h
- @brief TODO: Describe this file
- $Revision$
- $HeadURL$
- */
-#ifndef LOG_H
-#define LOG_H
-
-#include <stdarg.h>
-
-void log_error(const char msg[], ...);
-
-#endif /* LOG_H */
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include "opts.h"
-#include "str.h"
-#include "list.h"
-#include "pprint.h"
-#include "codegen.h"
-#include "sys.h"
-#include "log.h"
-#include "ops.h"
-#include <libparse.h>
-
+#include <sclpl.h>
/* Command Line Options
*****************************************************************************/
exit(1);
}
-/* Options Helpers
- *****************************************************************************/
-bool file_exists(const char* name) {
- bool ret = false;
- FILE* file = fopen(name,"r");
- if (NULL != file) {
- fclose(file);
- ret = true;
- }
- return ret;
-}
-
-list_t* input_files(void) {
- list_t* infiles = list_new();
- const char** fvec = opts_arguments();
- const char** files = fvec;
- while (NULL != files[0]) {
- if (!file_exists(files[0])) {
- mem_release(infiles);
- log_error("no such file or directory: %s", files[0]);
- exit(1);
- }
- list_push_front(infiles, str_new(files[0]));
- files++;
- }
- free(fvec);
- return infiles;
-}
-
/* Driver Modes
*****************************************************************************/
static int emit_tokens(void) {
- list_t* files = input_files();
- size_t nfiles = list_size(files);
- if (0 == nfiles) {
- (void)ops_token_file(NULL);
- } else if (1 == nfiles) {
- str_t* fname = list_front(files)->contents;
- mem_release( ops_token_file(fname) );
- } else {
- log_error("too many files provided for target mode 'tokens'");
- }
- mem_release(files);
+ (void)ops_token_file(NULL);
return 0;
}
static int emit_tree(void) {
int ret = 0;
+#if 0
list_t* files = input_files();
size_t nfiles = list_size(files);
if (0 == nfiles) {
log_error("too many files provided for target mode 'ast'");
}
mem_release(files);
-
+#endif
return ret;
}
static int emit_csource(void) {
int ret = 0;
+#if 0
list_t* files = input_files();
size_t nfiles = list_size(files);
if (0 == nfiles) {
log_error("too many files provided for target mode 'csource'");
}
mem_release(files);
+#endif
return ret;
}
static int exec_repl(void) {
+#if 0
Parser* p_parser = parser_new(":> ", stdin);
while(!parser_eof(p_parser)) {
AST* p_tree = toplevel(p_parser);
}
}
mem_release(p_parser);
+#endif
return 0;
}
static int emit_object(void) {
+#if 0
list_t* files = input_files();
size_t nfiles = list_size(files);
if (0 == nfiles) {
log_error("too many files provided for target mode 'object'");
}
mem_release(files);
+#endif
return 0;
}
$Revision$
$HeadURL$
*/
-#include "opts.h"
-#include "str.h"
-#include "sys.h"
-#include "pprint.h"
-#include "codegen.h"
-#include <libparse.h>
+#include <sclpl.h>
+#if 0
vec_t* ops_parse_file(str_t* in) {
//bool failed = false;
//FILE* input = (NULL == in) ? stdin : fopen(str_cstr(in), "r");
(void)program;
return deps;
}
+#endif
-str_t* ops_token_file(str_t* in) {
- str_t* ofname = NULL;
+char* ops_token_file(str_t* in) {
FILE* input = (NULL == in) ? stdin : fopen(str_cstr(in), "r");
FILE* output;
if (NULL == in) {
}
mem_release(ctx);
- return ofname;
+ return NULL;
}
+#if 0
str_t* ops_syntax_file(str_t* in) {
str_t* ofname = NULL;
FILE* output;
mem_release(command);
return ofname;
}
-
+#endif
#ifndef OPS_H
#define OPS_H
-#include "str.h"
-#include "vec.h"
-
-vec_t* ops_parse_file(str_t* in);
-vec_t* ops_deps_file(vec_t* program);
-str_t* ops_token_file(str_t* in);
-str_t* ops_syntax_file(str_t* in);
-str_t* ops_translate_file(str_t* in);
-str_t* ops_compile_file(str_t* in);
#endif /* OPS_H */
$Revision$
$HeadURL$
*/
-#include "pprint.h"
+#include <sclpl.h>
+#if 0
static void print_indent(FILE* file, int depth) {
for(int i = 0; i < (2 * depth); i++)
fprintf(file, "%c", ' ');
}
+#endif
static const char* token_type_to_string(TokType type) {
switch(type) {
+++ /dev/null
-/**
- @file pprint.h
- @brief TODO: Describe this file
- $Revision$
- $HeadURL$
- */
-#ifndef PPRINT_H
-#define PPRINT_H
-
-#include <libparse.h>
-
-void pprint_token_type(FILE* file, Tok* token);
-
-void pprint_token_value(FILE* file, Tok* token);
-
-void pprint_token(FILE* file, Tok* token, bool print_loc);
-
-void pprint_tree(FILE* file, AST* tree, int depth);
-
-#endif /* PPRINT_H */
--- /dev/null
+/**
+ @file sclpl.h
+*/
+#ifndef SCLPL_H
+#define SCLPL_H
+
+#include <opts.h>
+#include <libparse.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include "str.h"
+//#include "vec.h"
+#include "list.h"
+
+typedef enum {
+ TOKFILE,
+ ASTFILE,
+ CSOURCE,
+ OBJECT,
+ PROGRAM,
+ STATICLIB,
+ SHAREDLIB
+} file_type_t;
+
+/* Filesystem Routines */
+str_t* sys_bin_dir(void);
+str_t* sys_inc_dir(void);
+str_t* sys_extension(file_type_t ftype);
+str_t* sys_filename(file_type_t ftype, str_t* infile);
+
+/* Pretty Printing Data Structures */
+void pprint_token_type(FILE* file, Tok* token);
+void pprint_token_value(FILE* file, Tok* token);
+void pprint_token(FILE* file, Tok* token, bool print_loc);
+//void pprint_tree(FILE* file, AST* tree, int depth);
+
+/* Compiler Driver Operations */
+//vec_t* ops_parse_file(str_t* in);
+//vec_t* ops_deps_file(vec_t* program);
+str_t* ops_token_file(str_t* in);
+//str_t* ops_syntax_file(str_t* in);
+//str_t* ops_translate_file(str_t* in);
+//str_t* ops_compile_file(str_t* in);
+
+/* Error Logging */
+void log_error(const char msg[], ...);
+
+/* Code Generation */
+void codegen_csource(FILE* file, vec_t* program);
+
+#endif /* SCLPL_H */
$Revision$
$HeadURL$
*/
-#include <stdlib.h>
-#include "sys.h"
-#include "opts.h"
-#include "log.h"
+#include <sclpl.h>
str_t* sys_bin_dir(void) {
str_t* bindir = NULL;
+++ /dev/null
-/**
- @file sys.h
- @brief TODO: Describe this file
- $Revision$
- $HeadURL$
- */
-#ifndef SYS_H
-#define SYS_H
-
-#include "str.h"
-
-str_t* sys_bin_dir(void);
-str_t* sys_inc_dir(void);
-
-typedef enum {
- TOKFILE,
- ASTFILE,
- CSOURCE,
- OBJECT,
- PROGRAM,
- STATICLIB,
- SHAREDLIB
-} file_type_t;
-
-str_t* sys_extension(file_type_t ftype);
-str_t* sys_filename(file_type_t ftype, str_t* infile);
-
-#endif /* SYS_H */