summaryrefslogtreecommitdiff
path: root/scope.c
AgeCommit message (Collapse)AuthorLines
2020-01-25Committed version of codebaseTom Harley-0/+6
2020-01-08I should commit moreTom Harley-1/+5
2019-12-23checkpointTom Harley-0/+2
2019-10-30Enable -WeverythingTom Harley-0/+3
Clang has a -Weverything option, that enables all compile-time warnings and elevates them all to errors. This option is now passed to the compiler, and all warnings/errors the code produced have been addressed. Using -Weverything locks the project into using clang as its compiler: this should not be a problem since clang is probably being used to compile the LLVM output of the project anyway. If support for other compilers is required, it should be simple enough to replace -Weverything with an equivalent collection of portable flags. Explicit Makefile rules for compiling the C files produced by flex/bison are now included in the project since these C files absolutely do not pass -Weverything checks.
2019-10-28Add struct type definitionsTom Harley-2/+4
Struct-like types can now be created using the `type` builtin. This creates a constructor function as well as a function for accessing each of the struct's properties. LLVM's type checking makes using these structs a little awkward: they currently cannot be returned by any functions (except the constructor). The aim is to box everything, so that functions can return values they don't know much about.
2019-10-09Implement function definitionsTom Harley-0/+62
Functions can now be defined using the "def" construct. A "main" function has to be defined for LLVM to compile the program. Recursive function definitions are not supported, since all values are eagerly evaluated, causing infinite recursion of the non-base case. Recursive definitions can be supported either by including an if primitive that does not evaluate both sides, or by implementing support for lazy evalution. I'm interested in exploring the latter, but will probably implement the former for now. Similar to the if primitive above, the def primitive is currently an implementation which could potentially be altered into a function that manipulates meta-variables at compile time. This would require compile-time evaluation of functions, which would be really cool, but is also superfluous to the current goal. I might return to this idea after I'm happy with the base implementation of the language.