aboutsummaryrefslogtreecommitdiffstats
path: root/src/repl.cpp
AgeCommit message (Collapse)AuthorFilesLines
2011-05-14Fix global set/get (top level variable definitions in the REPL).David Robillard1-52/+67
git-svn-id: http://svn.drobilla.net/resp/trunk@425 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2011-05-14Tidy.David Robillard1-5/+3
git-svn-id: http://svn.drobilla.net/resp/trunk@424 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2011-05-14Create 'main' in IR and compile it like any other function.David Robillard1-18/+31
git-svn-id: http://svn.drobilla.net/resp/trunk@423 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2011-05-14Make currentFn private to the backend.David Robillard1-2/+2
git-svn-id: http://svn.drobilla.net/resp/trunk@421 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2011-05-14Add flatten stage to generate flat s-expression IR for the (now simpler) ↵David Robillard1-11/+18
compilation stage. git-svn-id: http://svn.drobilla.net/resp/trunk@417 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2011-01-13Fix error location reporting.David Robillard1-1/+1
git-svn-id: http://svn.drobilla.net/resp/trunk@406 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2011-01-09Partially resurrect CPS translation pass.David Robillard1-36/+34
git-svn-id: http://svn.drobilla.net/resp/trunk@405 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-31Report parsing errors.David Robillard1-0/+1
git-svn-id: http://svn.drobilla.net/resp/resp@394 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-31Saner type unification.David Robillard1-13/+3
git-svn-id: http://svn.drobilla.net/resp/resp@391 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-31Don't execute code if -S is given.David Robillard1-1/+2
git-svn-id: http://svn.drobilla.net/resp/resp@387 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-29Literal lists (i.e. list quoting).David Robillard1-15/+14
Compile type expressions. Only compile a top-level function if program has code to run (i.e. isn't just definitions). Cast tuples to Object when necessary to avoid LLVM IR type mismatches (for cons stores and return values). Fix memory leaks. git-svn-id: http://svn.drobilla.net/resp/resp@369 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-27Make ATuple a normal LISPey cons cell (it always was anyway).David Robillard1-2/+2
git-svn-id: http://svn.drobilla.net/resp/resp@360 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-27Kill AType.David Robillard1-7/+8
git-svn-id: http://svn.drobilla.net/resp/resp@359 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-26Update headers.David Robillard1-1/+1
git-svn-id: http://svn.drobilla.net/resp/resp@352 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-25Simplify let to fn, rather than deal with it through to compilation.David Robillard1-0/+2
The previous implementation of let was a premature optimization intended to make let cheap/free, but screws up closure creation and variable indexing because a new scope is created by something other than fn. Only compile top level expressions to globals (with associated store/retrieve overhead) in a REPL when it is necessary. Add `do' form (ala scheme `begin') to backend (used by `match' simplify). git-svn-id: http://svn.drobilla.net/resp/resp@348 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-10Move simplification from lift stage to a new (post-typing) simplify stage.David Robillard1-2/+15
git-svn-id: http://svn.drobilla.net/resp/resp@344 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-09Add option -a to annotate printed code (for -T and -L).David Robillard1-2/+3
git-svn-id: http://svn.drobilla.net/resp/resp@340 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-09Strip trailing whitespace.David Robillard1-4/+4
git-svn-id: http://svn.drobilla.net/resp/resp@336 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-09Fix cpplint warnings.David Robillard1-1/+4
git-svn-id: http://svn.drobilla.net/resp/resp@329 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-09read_expression => PEnv::parse.David Robillard1-1/+1
git-svn-id: http://svn.drobilla.net/resp/resp@325 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-09Const-correct parser.David Robillard1-3/+3
git-svn-id: http://svn.drobilla.net/resp/resp@323 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-09Clean up engine code.David Robillard1-5/+5
git-svn-id: http://svn.drobilla.net/resp/resp@320 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-08Clean up function compilation stuff.David Robillard1-2/+2
Add some utilities to for using named types. git-svn-id: http://svn.drobilla.net/resp/resp@313 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-07Rename 'parse' to the now more accurate 'expand'.David Robillard1-1/+1
git-svn-id: http://svn.drobilla.net/resp/resp@307 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-07Saner recursive descent lexer/parser.David Robillard1-2/+2
git-svn-id: http://svn.drobilla.net/resp/resp@306 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-04More const-correctness (remove all use of const_cast).David Robillard1-3/+3
git-svn-id: http://svn.drobilla.net/resp/resp@297 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-04Make resp_lift const-correct.David Robillard1-9/+12
git-svn-id: http://svn.drobilla.net/resp/resp@294 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-03Remove use of RTTI for AST.David Robillard1-3/+3
git-svn-id: http://svn.drobilla.net/resp/resp@290 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-03Remove AST::constrain.David Robillard1-1/+1
git-svn-id: http://svn.drobilla.net/resp/resp@287 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-03Merge ACall and ATuple.David Robillard1-1/+1
git-svn-id: http://svn.drobilla.net/resp/resp@285 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-02Remove ACall subclasses.David Robillard1-3/+3
git-svn-id: http://svn.drobilla.net/resp/resp@282 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-02Work towards removing different classes for each type of expression.David Robillard1-5/+5
git-svn-id: http://svn.drobilla.net/resp/resp@278 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-02Represent code as list structure (i.e. traditional LISP lists built from ↵David Robillard1-44/+19
pairs), rather than tuple structure. Remove unused/crufty depoly stage. Remove cps from AST interface (but keep cps.cpp code around for later). Improved command line interface for compilation stages (options -T -L -S). git-svn-id: http://svn.drobilla.net/resp/resp@277 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-12-01Add -T option to type-check and pretty-print with type annotations.David Robillard1-8/+13
Rename -p to -P (all 'stage' options, i.e. -P -T -S are uppercase for consistency). Clean up main program. Decent pretty printing. git-svn-id: http://svn.drobilla.net/resp/resp@275 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-09-30Preliminary work on algebraic data types and run-time typing.David Robillard1-0/+3
git-svn-id: http://svn.drobilla.net/resp/resp@270 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-08-22Simplify Engine function compilation interface.David Robillard1-4/+6
Removes duplicated code in various backends and reduces Engine code knowledge of AFn specifics (which belongs in compile.cpp). git-svn-id: http://svn.drobilla.net/resp/resp@268 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-08-22Simplify Engine::startFunction.David Robillard1-2/+2
git-svn-id: http://svn.drobilla.net/resp/resp@267 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-08-19Generalise `cons': a call to any symbol beginning with an uppercase characterDavid Robillard1-1/+1
(i.e. a type symbol), e.g. (Thing 2), is a call to a type constructor which creates a Tup containing the arguments, with the symbol as the first element in the type expression, e.g. (Thing 2) has type (Thing Int) and compiles to a tuple containing a single Int. The type constructor `Tup' can be used as a `cons' replacement to construct generic tuples. git-svn-id: http://svn.drobilla.net/resp/resp@264 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-08-19Coherent AString and Lexeme implementation.David Robillard1-10/+13
A Lexeme is any "token" read from input, a lexeme has not yet beeen parsed and could parse to anything, e.g. a string, an expression, a number, etc. Lexemes are not (yet?) exposed to the language or ever compiled. A String is a string literal, which can contain any character directly except " and \. There are two special escapes: \" and \\, any other character following a \ is a syntax error. Fix garbage collection of REPL objects, leading to type errors from type variable re-use because a type variable for a given AST's /address/ exists, but that address has actually been deleted and reused by new (i.e. make top level REPL expressions and types be GC roots). git-svn-id: http://svn.drobilla.net/resp/resp@261 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-04-13Better error reporting when unification fails (report both locations, and ↵David Robillard1-7/+25
preserve locations during substitution). git-svn-id: http://svn.drobilla.net/resp/resp@256 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-04-13Restructure as a source translation based compiler.David Robillard1-33/+76
Implement support for closures (via lambda lifting phase). git-svn-id: http://svn.drobilla.net/resp/resp@254 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2010-04-08Tuplr -> Resp (RESource Processing).David Robillard1-5/+5
git-svn-id: http://svn.drobilla.net/resp/resp@252 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2009-10-16Fix globals.David Robillard1-17/+4
Don't add always empty top level environment frames (screws up Env::topLevel). git-svn-id: http://svn.drobilla.net/resp/tuplr@242 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2009-10-16Compile top level definitions to globalas.David Robillard1-5/+11
git-svn-id: http://svn.drobilla.net/resp/tuplr@239 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2009-10-15Fix crash caused by making symbols in type expressions types themselves.David Robillard1-1/+1
git-svn-id: http://svn.drobilla.net/resp/tuplr@234 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2009-10-15Replace more use of at(0) with head().David Robillard1-1/+1
git-svn-id: http://svn.drobilla.net/resp/tuplr@228 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2009-10-15Tidy.David Robillard1-27/+27
git-svn-id: http://svn.drobilla.net/resp/tuplr@223 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2009-10-14Remove unnecessary cenv.compile wrapper.David Robillard1-2/+2
Remove special treatment of symbols for compilation. Make CEnv::vals a <ASymbol*, CValue> map rather than <AST*, CValue> (only used for symbols). git-svn-id: http://svn.drobilla.net/resp/tuplr@214 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2009-10-13Cleanup, shrink.David Robillard1-4/+4
git-svn-id: http://svn.drobilla.net/resp/tuplr@209 ad02d1e2-f140-0410-9f75-f8b11f17cedd
2009-10-13Factor out common code in eval and repl.David Robillard1-77/+71
git-svn-id: http://svn.drobilla.net/resp/tuplr@207 ad02d1e2-f140-0410-9f75-f8b11f17cedd