Commit Graph

303 Commits

Author SHA1 Message Date
Bruce Hill
cb1c3106f8 Made command line args into a proper Nomsu list. 2018-07-09 17:00:57 -07:00
Bruce Hill
11e9e36636 Simplified the command line interface. 2018-07-09 16:59:20 -07:00
Bruce Hill
0923b0192c Improvements to nomsu codegen (comments are now retained) and some
improvements to handling of stdin and fixes for error reporting.
2018-06-28 14:13:01 -07:00
Bruce Hill
80c8ceb0d4 Added manpage and fixed a bug that screwed up nomsu loading. 2018-06-24 18:20:28 -07:00
Bruce Hill
ad342b63b7 Simplifications/streamlining the Make process, and cleaning up some of
how command line interaction and `use %` work.
2018-06-24 16:11:40 -07:00
Bruce Hill
65addb9aa6 Cleaning up makefile and REPL colors. 2018-06-23 18:26:27 -07:00
Bruce Hill
9f08215dfb Moved console colors from core/ into lib/ 2018-06-23 18:04:23 -07:00
Bruce Hill
863983202c Fixed up nomsupath behavior and refactored file stuff into its own file. 2018-06-23 17:22:43 -07:00
Bruce Hill
dbf3de3d8e Added versioning system. 2018-06-23 00:57:39 -07:00
Bruce Hill
126678f737 Adding fancy makefile that compiles all the moonscript files and
precompiles all the nomsu files and can build a nice executable file and
install it wherever you like.
2018-06-22 02:41:08 -07:00
Bruce Hill
86a3219e7f Cleanup of some metaprogramming stuff, as well as adding support for
"package.nomsupath" to search for files in different locations, and
prioritizing use of "luafilesystem" over system calls.
2018-06-21 19:13:47 -07:00
Bruce Hill
c1cec2ac84 Tidying up error handling and REPL. 2018-06-19 15:24:39 -07:00
Bruce Hill
7deed5af41 Fixing up some error reporting 2018-06-19 02:00:59 -07:00
Bruce Hill
59c79bdf57 Split up CLI and NomsuCompiler 2018-06-19 01:27:41 -07:00
Bruce Hill
1c8c84f8d2 Moved error logic into its own file. 2018-06-19 01:12:54 -07:00
Bruce Hill
d7d86e0268 Lots of cleanup. 2018-06-19 00:44:22 -07:00
Bruce Hill
f83cc3ad8a More streamlining and cleanup. 2018-06-18 18:11:09 -07:00
Bruce Hill
16d127abb5 Initial working version. 2018-06-18 15:44:35 -07:00
Bruce Hill
fc71b0331b Fixed some nomsu codegen bugs 2018-06-15 03:30:32 -07:00
Bruce Hill
9d6932a872 Cleaned up/improved the command line interface, and fixed the
REPL/autoformatting.
2018-06-15 03:11:56 -07:00
Bruce Hill
f790caf0ab Removed debug shim. 2018-06-15 00:20:32 -07:00
Bruce Hill
b12744d831 Some cleanup and fixes. Simplifying a lot of code, and extending the
flexibility of scoping. Redesigned Object system too.
2018-06-14 23:25:34 -07:00
Bruce Hill
82cfd3e54b More streamlining and cleanup. Especially for core/metaprogramming.nom 2018-06-14 21:59:43 -07:00
Bruce Hill
282565a309 Fixed tree_to_nomsu to produce "blah\%x" instead of "blah\(%x)" 2018-06-13 14:54:08 -07:00
Bruce Hill
45e0a831fe Much improved code formatting for tree_to_nomsu 2018-06-12 23:47:54 -07:00
Bruce Hill
968b5da150 Fixed some bugs. 2018-06-12 20:15:56 -07:00
Bruce Hill
63a19db0dc Working version. 2018-06-12 20:06:37 -07:00
Bruce Hill
b0997a7dbf Minor optimizations to indent/dedent/nodent. 2018-06-12 18:16:44 -07:00
Bruce Hill
3c510e4ee5 Lots of optimizations and simplifications, especially towards getting
better performance on luajit.
2018-06-12 18:04:41 -07:00
Bruce Hill
b5fb8933af Removed dependency on 'immutable' library. This lets LuaJIT do more
aggressive optimizations and generally helps performance. Some safety is
lost, but I think the performance gains, reduced complexity, and reduced
dependencies are worth it.
2018-06-12 15:14:07 -07:00
Bruce Hill
0c9973ff03 Tidying up exceptions and error reporting. Also simplified the grammar a
tiny bit.
2018-06-12 13:56:35 -07:00
Bruce Hill
810ae220bc Added list/dict metatables to make comparison and string representations
simpler. Also deleted Counters.
2018-06-06 13:25:34 -07:00
Bruce Hill
2d88c68d71 Fixed piping in file. 2018-06-05 16:44:43 -07:00
Bruce Hill
5dfdcb39a6 Fixed indentation detection for indented text with leading whitespace. 2018-06-05 16:38:18 -07:00
Bruce Hill
08e590ac57 Much better reporting for compile-time errors (now includes source and
line number again)
2018-06-04 22:54:08 -07:00
Bruce Hill
83183122f1 Optimizations and cleanup. Build script now fails on first error and
uses the precompiled versions it has just compiled.
2018-06-04 20:44:58 -07:00
Bruce Hill
563e415e07 Switched from Node(Tuple(values...), source) to Node(source, values...),
thanks to support from immutable-tables for mixed tables.
2018-06-04 17:57:07 -07:00
Bruce Hill
e7bdc35aa8 Cleanups to try/catch logic and object logic. 2018-06-04 17:23:13 -07:00
Bruce Hill
b53516c47c Simplified and correctified lib/object (though the codegen still need
streamlining), added a .stub member to Action trees, and switched
Source's repr to be @filename[start:stop] instead of
"filename[start:stop]"
2018-05-30 17:21:19 -07:00
Bruce Hill
5637676bc4 Dead code cleanup 2018-05-30 14:29:15 -07:00
Bruce Hill
624fcdcc7e Moved as_lua_id() onto 'string' 2018-05-30 13:46:54 -07:00
Bruce Hill
0afcb416bc Microoptimization 2018-05-30 13:41:21 -07:00
Bruce Hill
f9229c5e91 Better parse error reporting. 2018-05-30 13:07:15 -07:00
Bruce Hill
e5d9879a79 Cleaned up patterns a little. 2018-05-30 12:07:08 -07:00
Bruce Hill
a01e7d27bd Removed ldt shim 2018-05-29 19:23:34 -07:00
Bruce Hill
21e3a7b375 More improvements to error reporting. 2018-05-29 19:10:11 -07:00
Bruce Hill
8806d7639e Cleaned and fixed up colored console text output for error messages. 2018-05-29 18:11:04 -07:00
Bruce Hill
e697689ddd Fixed up the edge cases and simplified the code a bit. 2018-05-29 17:10:54 -07:00
Bruce Hill
3573dfe995 Almost-working reimplementation of source code mapping. 2018-05-29 16:15:10 -07:00
Bruce Hill
e17822d1e5 Cleaned up some asserts for performance. 2018-05-29 11:14:07 -07:00
Bruce Hill
b6be516e3f Fix for luajit, though I'm not sure why it worked for lua either. 2018-05-28 23:24:43 -07:00
Bruce Hill
2e15c0fd50 Some tweaks/cleanup on the nomsu code as well as adding variable
mangling to 'parse % as %' to make almost hygienic macros.
2018-05-27 18:29:23 -07:00
Bruce Hill
6ce32bdd25 Cleaned up lpeg matching stuff to use lpeg.Carg(1) instead of
lpeg.userdata, and switched indent/dedent/nodent to use a number to
track indentation instead of a stack.
2018-05-26 19:25:17 -07:00
Bruce Hill
0c7c06beab Moving back to capturing tables in LPEG and everything is a Source, not
string.
2018-05-26 15:59:03 -07:00
Bruce Hill
8cb2788e0d Re-added sources. 2018-05-26 15:04:38 -07:00
Bruce Hill
0b4a81191a Minor tidying. 2018-05-26 13:09:25 -07:00
Bruce Hill
64294f5cd6 Removed the Word tree type and replaced it with raw strings, since
they're only used as part of Actions
2018-05-24 21:17:15 -07:00
Bruce Hill
d9b795ee45 Adding some src map building code. 2018-05-24 20:27:26 -07:00
Bruce Hill
446892d11e Consolidating code obj code and expunging all [[..]]-style lua strings. 2018-05-24 16:13:46 -07:00
Bruce Hill
0c07968e07 Added error checking for bad paths. 2018-05-24 15:51:16 -07:00
Bruce Hill
5758626bf7 Cleaned up string quotes 2018-05-24 15:36:10 -07:00
Bruce Hill
2e345e271f Misc changes, fixed up Object lib and tests. 2018-05-24 14:57:35 -07:00
Bruce Hill
ad94ed3653 Moved all the tree->lua and tree->nomsu code back into single functions
in nomsu.moon, and cleaned up how Vars are treated, since they are not
atomic.
2018-05-16 19:08:59 -07:00
Bruce Hill
6f6c4377b2 Initial working version. 2018-05-16 18:13:02 -07:00
Bruce Hill
af9dc07025 Converted DictEntry to be an actual tree, instead of a pseudo-tree, made 'parse % as %'
generate lua code with already-substituted tree literals instead of reparsing and
substituting at parse time, and made some general optimizations.
2018-05-16 15:45:59 -07:00
Bruce Hill
3ffeaf1f5d Removed "for all"-style iteration and changed "for % from 1 to 10"-style
to "for % in 1 to 10" for consistency.
2018-05-15 20:33:07 -07:00
Bruce Hill
01aa199f7a Adding support for coroutines, and cleaning up comment syntax. 2018-05-15 16:36:38 -07:00
Bruce Hill
28cd9ae0b7 More API cleanup, and fixed a bug with optimized lua files generating
spurious circular import errors.
2018-05-15 15:22:03 -07:00
Bruce Hill
ae979c3718 Minor cleanups changes. 2018-05-15 14:53:42 -07:00
Bruce Hill
3be20840ca Removing dead code. 2018-05-14 15:39:16 -07:00
Bruce Hill
52a3631ed6 Merging use_file and run_file 2018-05-14 15:37:25 -07:00
Bruce Hill
7410e42bc0 Minor optimizations. 2018-05-14 14:45:45 -07:00
Bruce Hill
95ee15982b Switched to use inline nomsu generation for Nomsu tree lua
compilation and removed some dead code around Nomsu.debug
2018-05-11 13:54:24 -07:00
Bruce Hill
4126589afe Cleanup: removed "File" type trees (now just Block), overhauled
how_do_i.nom, added "result of %" macro, which allowed comprehensions to
be way more concisely defined. Moved len() operator into the nomsu
environment.
2018-05-10 22:47:18 -07:00
Bruce Hill
4e7b652014 Switched luajit to use custom built luajit lpeg, allowed find to
traverse symbolic links.
2018-05-09 20:35:11 -07:00
Bruce Hill
1a755ddee8 Added tentative support for luajit (depends on pure-lua LPEG
implementation).
2018-05-09 13:35:04 -07:00
Bruce Hill
a5bbce315d Minor tweaks/cleanups. 2018-05-03 22:34:00 -07:00
Bruce Hill
2abaf67b66 Fix for compile lib putting the files in the wrong place. 2018-05-03 21:55:58 -07:00
Bruce Hill
e64a91b8ba Better error reporting and codegen. 2018-05-03 16:31:02 -07:00
Bruce Hill
05528c50ec Further improvements on the CLI. 2018-04-28 19:16:54 -07:00
Bruce Hill
3a049c15df Improvements to command line file handling. 2018-04-28 18:07:22 -07:00
Bruce Hill
df9a82a971 Overhaul of command-line API. It's a bit cleaner now. 2018-04-28 17:08:44 -07:00
Bruce Hill
d13a945b5f Removed LFS dependency in favor of just using find 2018-04-28 15:25:31 -07:00
Bruce Hill
23022dc88c Re-added (..), which is necessary for long expressions as first arg to
an action.
2018-04-28 15:21:28 -07:00
Bruce Hill
b54829de36 Better text interpolation/handling of "\". Also added syntax support for
(statement; statement)
2018-04-27 16:45:35 -07:00
Bruce Hill
7f99c70d56 Fixed renaming lua_obj->code_obj 2018-04-26 14:00:15 -07:00
Bruce Hill
50a092e4b5 Got nomsu codegen working again. 2018-04-25 16:04:55 -07:00
Bruce Hill
cb28f52b41 Updated block-style text interpolation to have less redundancy. 2018-04-25 15:37:47 -07:00
Bruce Hill
bb31a98a56 Recompiling. 2018-04-24 20:17:24 -07:00
Bruce Hill
dec5ee8262 Lots of optimizations. 2018-04-20 16:23:59 -07:00
Bruce Hill
14bda2fb2d Cleanups and optimizations. 2018-04-20 14:33:57 -07:00
Bruce Hill
931ae40f40 Fixed compiling to .lua files 2018-04-19 19:43:32 -07:00
Bruce Hill
da33269c30 All tests passing (except object) 2018-04-19 17:23:54 -07:00
Bruce Hill
dcb380f1f6 More cleanup, slowly working through operators/control_flow 2018-04-18 17:41:57 -07:00
Bruce Hill
ec17442090 Cleaning up. 2018-04-18 15:46:01 -07:00
Bruce Hill
16f3a189fd More working, shifting towards having Lua and Nomsu objects instead of
just strings.
2018-04-18 15:28:59 -07:00
Bruce Hill
b589c23741 Disabled comment transpilation for now. 2018-04-17 14:47:42 -07:00
Bruce Hill
26d0de8299 Partially working, at least for metaprogramming.nom 2018-04-17 14:36:55 -07:00
Bruce Hill
54fc7fc440 Moving tree_to_lua into each of the Nomsu tree types, which are now in
their own file.
2018-04-17 14:19:07 -07:00
Bruce Hill
25e06d1fce Getting closer. 2018-04-13 15:29:20 -07:00