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
Bruce Hill
222d4d0727
More correct and more working.
2018-04-13 14:54:47 -07:00
Bruce Hill
b05a46c78c
Incremental progress.
2018-04-12 20:39:22 -07:00
Bruce Hill
1de29826a8
Incremental progress towards working.
2018-04-12 18:01:59 -07:00
Bruce Hill
17a2bded6a
Incremental progress.
2018-04-11 21:07:18 -07:00
Bruce Hill
b9827b1745
Work in progress...
2018-04-11 20:05:18 -07:00
Bruce Hill
ab8ccf4e27
Off by one error.
2018-04-09 19:45:43 -07:00
Bruce Hill
d42d20c50a
Re-added callstack callsite info. It's a bit hacky, but better than
...
nothing.
2018-04-09 18:58:27 -07:00
Bruce Hill
86925c5b3a
Patched debug.getinfo to return reasonable info for nomsu functions.
2018-04-08 18:24:11 -07:00
Bruce Hill
618bd47765
Typo caused metadata to go missing.
2018-04-08 18:11:55 -07:00
Bruce Hill
4e51768ebd
Improved codegen code.
2018-04-08 16:06:39 -07:00
Bruce Hill
fd621a1062
Cleaned up LHS of "." operator to avoid adding unnecessary parens so
...
Lua's parser doesn't get confused by (x).y = 1.
2018-04-08 15:41:55 -07:00
Bruce Hill
a49e97f0e3
Retrofitted "%'s %" to parse as dot syntax.
2018-04-06 16:53:59 -07:00
Bruce Hill
227b944bad
Initial working version.
2018-04-06 16:45:57 -07:00
Bruce Hill
972de38421
Minor cleanup.
2018-03-06 16:50:25 -08:00
Bruce Hill
4bc1f59725
Removed cached() since it wasn't actually helping perf.
2018-03-06 15:29:57 -08:00
Bruce Hill
9564492cf1
More support for optional metadata and better Tuple support.
2018-03-05 18:46:25 -08:00
Bruce Hill
4c693d7474
Updated for optional metadata support.
2018-03-05 18:44:34 -08:00
Bruce Hill
885c42bcfe
Updated to fit immutable lib update.
2018-02-27 14:31:28 -08:00
Bruce Hill
a9c4b78074
Initial branch of switching to using immutable types.
2018-02-13 15:18:00 -08:00
Bruce Hill
da65c91cb6
Cleanup of replaced vars, now uses tree_map()
2018-02-12 14:48:11 -08:00
Bruce Hill
02af19153e
Moved over to have tree metadata stored outside the tree. This paves the
...
way for programmatically generating trees more easily.
2018-02-08 16:23:23 -08:00
Bruce Hill
3661754ed9
Reverted to ACTIONS instead of ACTION and added 'show lua %' macro.
2018-02-06 22:07:11 -08:00
Bruce Hill
e8d5d2a240
Added check for circular imports.
2018-02-05 15:35:06 -08:00
Bruce Hill
f58dc0fcb7
Reverted "use %" to expr-like behavior with return values preserved.
2018-02-05 15:10:02 -08:00
Bruce Hill
505fec2a61
Restructured the nomsu files to group all the essentials into core/ and
...
all the optionals into lib/. lib/core.nom and tests/all.nom are no
longer needed now.
2018-02-02 15:49:42 -08:00
Bruce Hill
513c721198
Updated 'use %' to support directories, and cleaned up action_metadata a
...
tiny bit.
2018-02-02 14:01:06 -08:00
Bruce Hill
2dbf2d8810
Cleanup of REPL and detection of command-line running.
2018-01-30 16:40:23 -08:00
Bruce Hill
d7abcba34d
Fix for bad indentation.
2018-01-30 15:10:29 -08:00
Bruce Hill
855fe23439
Tweaked code to not rely on moonscript.
2018-01-27 16:40:29 -08:00
Bruce Hill
90c56d3135
Added a ton of tests for virtually all the functionality. Helped me find
...
and fix a lot of latent problems.
2018-01-26 20:20:38 -08:00
Bruce Hill
d5aa4e5298
Minor fix for value_to_nomsu
2018-01-26 15:19:05 -08:00
Bruce Hill
95f3f55ff2
Cleaned up unnecessary buffer use.
2018-01-26 15:03:15 -08:00
Bruce Hill
214b3f9186
Removed nomsu:write() and nomsu:writeln() and replaced with just plain
...
ol' print()
2018-01-26 15:02:32 -08:00
Bruce Hill
fb22ba11ac
Fixed improperly handling locals of a block.
2018-01-25 18:07:51 -08:00
Bruce Hill
c79bea4401
Overhaul of compiling API (eliminated some of the expr/statements
...
helpers and forced the use of {expr=..., locals=...}-type syntax. This
helped fix up all of the cases like loops where locals were being
mishandled and led to some cleaner code.
2018-01-25 17:36:05 -08:00
Bruce Hill
f769351556
Updated and improve syntax for some stuff. Also added string indexing
...
like in python, including slices.
2018-01-24 13:13:26 -08:00
Bruce Hill
d173e9ae88
Fixed id for nil/NaN and cleaned up collection metatable stuff.
2018-01-24 12:38:09 -08:00
Bruce Hill
6d11354b3f
Added implicit local declarations and new syntax of %var <- %value.
2018-01-23 19:22:45 -08:00
Bruce Hill
ac8089dd58
Fixed typo.
2018-01-23 15:25:31 -08:00
Bruce Hill
ca07d84b4c
Added scratch folder to .gitignore
2018-01-19 17:28:47 -08:00
Bruce Hill
d888b1134a
Added more info to error message.
2018-01-19 15:12:00 -08:00
Bruce Hill
6021f04490
Fix for lua parsing of long strings/table literals.
2018-01-18 16:44:32 -08:00
Bruce Hill
f91d06d9fa
Initial commit of object oriented classes.
2018-01-18 01:49:27 -08:00
Bruce Hill
12cc294c7a
Fixed some minor bugs that made generated nomsu uglier.
2018-01-17 16:45:29 -08:00
Bruce Hill
8bbebb8735
Completely fixed/reworked tree_to_nomsu, and it's okay right now.
2018-01-17 16:37:27 -08:00
Bruce Hill
d82c4f85d8
Added support for translating comments instead of dropping them.
2018-01-15 15:50:32 -08:00
Bruce Hill
5a526675db
Better usage of ACTION_METADATA and deprecating nomsu.defs.
2018-01-12 19:28:19 -08:00
Bruce Hill
90c72074db
Renamed replaced_vars() to be more descriptive.
2018-01-12 16:45:49 -08:00
Bruce Hill
4b6d35aa9f
Rebuild.
2018-01-12 16:33:42 -08:00
Bruce Hill
6b09187899
Switched to use load() with environment table instead of passing in
...
nomsu to everything. This has some nice code cleanliness benefits.
2018-01-12 16:33:11 -08:00
Bruce Hill
06bf76f818
Truncated debug output for readability.
2018-01-11 18:48:43 -08:00
Bruce Hill
ba87104202
Fixed require->use, updated TODO.
2018-01-11 14:07:14 -08:00
Bruce Hill
756c1f718e
Renamed "require %" to "use %"
2018-01-11 03:35:35 -08:00
Bruce Hill
9d8c701441
Added "%'s id" to use UUIDs and changed "% = %" to "set % = %" and some
...
other misc.
2018-01-11 03:32:12 -08:00
Bruce Hill
c575ad1041
Rebuilt.
2018-01-11 02:08:41 -08:00
Bruce Hill
8c1da9a6c3
Purged references to "macro" and replaced with "compile action" or
...
"compile-time action".
2018-01-11 02:07:37 -08:00
Bruce Hill
82cc997ddf
Renamed rule % = % to action % %
2018-01-11 01:19:03 -08:00
Bruce Hill
6f4b67632a
Renamed String -> Text
2018-01-11 01:09:26 -08:00
Bruce Hill
c0333ca315
Overhaul of error reporting and removing nomsu:call(stub, line_no, ...) in favor of nomsu.defs[stub].fn(...)
2018-01-11 01:04:17 -08:00
Bruce Hill
53a9d4eae8
Pretty much mostly working.
2018-01-10 20:45:03 -08:00
Bruce Hill
09b64e0341
Performance optimizations and correctness fix for [=[...]=]-style
...
strings. Also, require % now properly inserts lua code.
2018-01-10 16:22:45 -08:00
Bruce Hill
ea05cc155e
Switched back to using precompiled lua files instead of lua> "..",
...
because it's noticeably faster.
2018-01-10 13:52:41 -08:00
Bruce Hill
787c7c5a6c
Propagating filename
2018-01-09 16:30:29 -08:00
Bruce Hill
421abe1a6f
Cleaned up metaprogramming to go "compile to" -> "rule =" -> "parse as".
...
This speeds things up a bit, and is more intuitive.
2018-01-09 14:59:06 -08:00
Bruce Hill
f97ab858ed
Modernized the codebase a bit to include "immediately:" for immediately
...
running code before further parsing takes place. That means that in the
default case, whole files can be run at once, which makes all but the
weirdest edge cases make a lot more sense and operate smoothly.
2018-01-08 18:53:57 -08:00
Bruce Hill
568a44ef19
Reworking some stuff so that functions only allow expressions to be
...
return values with either an explicit "return" statement or if they're
the only line in the function, and the line is an expression.
2018-01-07 18:45:27 -08:00
Bruce Hill
c92e5fbc81
Some overhaul of binary operators so that arbitrary math patterns work
...
fine.
2018-01-07 18:03:37 -08:00
Bruce Hill
87b93f4aba
Added nomsu:assert()
2018-01-05 15:23:18 -08:00
Bruce Hill
de668ce174
Low hanging optimization fruit.
2018-01-05 14:56:35 -08:00
Bruce Hill
8cc1262504
Updated examples and made operator characters not stick to each other.
...
Useful for <%x>=6 properly registering as <%x> = 6.
2018-01-03 19:26:41 -08:00
Bruce Hill
b2ddc1d768
Added support for \000 and \x00 style byte literals.
2018-01-03 17:23:46 -08:00
Bruce Hill
cfee75b21b
Reworked {} a bit and added dicts to the core language. Did some more
...
testing on string interpolations too.
2018-01-03 00:52:01 -08:00
Bruce Hill
4789892824
Got everything mostly working.
2017-12-30 14:31:07 -08:00
Bruce Hill
611a8c87f3
renamed utils2 -> utils
2017-12-18 16:26:26 -08:00
Bruce Hill
eaea9c0599
Recompiled.
2017-12-18 16:25:56 -08:00
Bruce Hill
3c303018bb
Tweaks.
2017-12-15 15:30:05 -08:00
Bruce Hill
28f5c31299
Switched compiler to do lua> instead of lua files.
2017-12-14 16:41:22 -08:00
Bruce Hill
49adc12952
Minor fix.
2017-12-14 14:26:24 -08:00
Bruce Hill
ce398c255a
Rebuild.
2017-12-14 14:08:07 -08:00
Bruce Hill
536a3ba649
Got it working.
2017-12-13 16:29:15 -08:00
Bruce Hill
0c1c406ce0
More updates with more functional macros and source code storage.
2017-12-11 17:53:23 -08:00
Bruce Hill
0f0dcaac37
Recompiled.
2017-12-09 16:00:09 -08:00
Bruce Hill
96441251c4
Pretty much everything is working??
2017-12-09 15:34:52 -08:00
Bruce Hill
28b6bc1883
Simplified parser by removing prev_edge.
2017-12-08 15:39:05 -08:00
Bruce Hill
8da2b1d64c
Added unicode support and cleaned up the parser a bit.
2017-12-08 15:37:36 -08:00
Bruce Hill
b3b8c4d731
Some stuff changed to allow escaped args and some other ports from the
...
two_defs branch.
2017-12-04 17:35:47 -08:00
Bruce Hill
8c0816995a
Added empty string check.
2017-11-01 20:11:44 -07:00
Bruce Hill
f1a2c936de
Fixed some codegen stuff, optimized "say" for the common case of string
...
literals.
2017-11-01 16:49:11 -07:00
Bruce Hill
b0072e6dcf
Added local var persistence for REPL.
2017-10-31 18:35:40 -07:00
Bruce Hill
6ba79a8ff1
Added support for serializing rules.
2017-10-31 16:19:08 -07:00
Bruce Hill
c1ec00d5fc
Changed it so variables can't contain wordbreakers anymore.
2017-10-30 14:08:23 -07:00
Bruce Hill
28a6446c66
Added tree_to_nomsu() and improved codegen by compiling \foo to
...
nomsu:parse("foo") and removing some newlines.
2017-10-22 18:40:49 -07:00
Bruce Hill
3d81837261
Made it so nomsu only runs REPL with -i
2017-10-20 15:17:57 -07:00
Bruce Hill
c6819cf1e9
More callstack fixin
2017-10-20 15:10:04 -07:00
Bruce Hill
b909dce5d1
Fix for callstack.
2017-10-20 15:07:57 -07:00
Bruce Hill
09cb00e106
Recompile.
2017-10-19 18:16:48 -07:00
Bruce Hill
e42f14dbd1
Recompile.
2017-10-19 17:01:08 -07:00
Bruce Hill
e43f60a124
Rebuilt.
2017-10-13 19:44:32 -07:00
Bruce Hill
bccfe9d8e1
Changed tokenizing to treat symbols as their own things.
2017-10-13 19:41:58 -07:00
Bruce Hill
56f014a488
Improved code generation by changing vars["x"] to vars.x for allowed lua
...
var names.
2017-10-13 18:14:18 -07:00
Bruce Hill
a176c7dfb5
Rebuilt.
2017-10-13 18:09:46 -07:00
Bruce Hill
d13bcde2b9
Renamed repr_if_not_string to "stringify" and added nomsu:stringify for
...
convenience.
2017-10-13 16:16:07 -07:00
Bruce Hill
7435b61380
Changed generated code to be less verbose for function and macro defs
...
(using "foo %" syntax instead of {type="FunctionCall", ...} literals).
2017-10-13 16:10:47 -07:00
Bruce Hill
06d05ebeee
Tweaked macros to insert runtime checks, rather than compile-time.
2017-10-13 14:15:02 -07:00
Bruce Hill
c189be29bc
Added better output control for stderr.
2017-10-12 14:39:49 -07:00