00:43:41 | * | tokyovigilante_ joined #nim |
00:44:21 | * | tokyovigilante quit (Ping timeout: 246 seconds) |
00:44:21 | * | tokyovigilante_ is now known as tokyovigilante |
01:02:18 | FromDiscord | <Savant> sent a long message, see https://pasty.ee/khiuBurT |
01:02:32 | FromDiscord | <Savant> sent a long message, see https://pasty.ee/kalrlMBZ |
01:02:33 | FromDiscord | <Savant> sent a long message, see https://pasty.ee/tEbrupzP |
01:02:33 | FromDiscord | <Savant> sent a long message, see https://pasty.ee/IApBRkjb |
01:07:53 | FromDiscord | <Elegantbeef> > has its own proprietary syntax as well ? |
01:10:01 | FromDiscord | <Savant> ? |
01:10:14 | FromDiscord | <Elegantbeef> What do you mean it has a proprietary syntax |
01:10:22 | FromDiscord | <Savant> sorry |
01:10:51 | FromDiscord | <Savant> i'd like to use the same "syntax" in compile time as i would at runtime |
01:10:51 | FromDiscord | <Savant> is that silly? |
01:10:53 | FromDiscord | <Savant> things like NimNode |
01:10:54 | FromDiscord | <Elegantbeef> Yes |
01:10:56 | FromDiscord | <Savant> parseStmt |
01:10:57 | FromDiscord | <Savant> etc |
01:11:02 | FromDiscord | <Savant> how's that |
01:11:05 | FromDiscord | <Savant> seems like it would be pretty sweet to me |
01:11:50 | FromDiscord | <Elegantbeef> Nim is a statically compiled language, which means the runtime would have to have a VM embedded into it to be able to parse and interpret the code |
01:12:45 | FromDiscord | <Savant> forgive my ignorance but that seems like the reasoning for why it does not already exist |
01:12:51 | FromDiscord | <Savant> naturally |
01:13:13 | FromDiscord | <Elegantbeef> Right, which is why it's silly |
01:13:17 | FromDiscord | <Savant> hm |
01:13:58 | FromDiscord | <Elegantbeef> Having a language that is statically compiled, but also can do things at runtime is incompatible imo |
01:14:51 | FromDiscord | <Elegantbeef> If you can do `var a = someMacro()` and `someMacro` is evaluated at runtime you now have `a` which is not static |
01:16:09 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=VfHhhJko |
01:20:31 | FromDiscord | <Elegantbeef> Actually I misinterpreted what you meant |
01:20:40 | FromDiscord | <Elegantbeef> you can use the nimscript api and use the same syntax just fine |
01:20:46 | FromDiscord | <Savant> bruh |
01:20:47 | FromDiscord | <Savant> really |
01:20:58 | FromDiscord | <Elegantbeef> Well yea nimscript is a language |
01:21:01 | FromDiscord | <Savant> yea i don't want execution / vm stuff |
01:21:37 | FromDiscord | <Savant> i just want my parsing logic to be the same in a compile time and runtime |
01:21:40 | FromDiscord | <Elegantbeef> So then write code that works at CT and runtime |
01:22:57 | FromDiscord | <Elegantbeef> Unlike other languages with CTE, Nim's CT doesn't require any annotations to use a procedure written |
01:27:01 | FromDiscord | <Savant> `system/nimscript` provides the same ast exports as `macros`? |
01:27:01 | FromDiscord | <Savant> well that's simply what i'd like |
01:27:09 | FromDiscord | <Elegantbeef> No |
01:27:10 | FromDiscord | <Savant> without the hubba bubba about VM junk |
01:27:12 | FromDiscord | <Elegantbeef> Well that's not how this works, you have to embed the VM |
01:27:15 | FromDiscord | <Savant> hm |
01:27:19 | FromDiscord | <Savant> i gotcha |
01:27:21 | FromDiscord | <Savant> but if we remove execution |
01:27:24 | FromDiscord | <Savant> doesn't it sorta work like dat |
01:27:26 | FromDiscord | <Elegantbeef> Stop using `parseStmt` for 'parsing' |
01:27:40 | FromDiscord | <Elegantbeef> You can hook up the nim parser and use that alone if you want |
01:28:06 | FromDiscord | <Elegantbeef> I have no example of that, but atlas I believe does it |
01:29:08 | FromDiscord | <Savant> very new to nim coming from js |
01:29:13 | FromDiscord | <Savant> this↵https://raw.githubusercontent.com/elcritch/cdecl/refs/heads/main/src/cdecl/compiler/macros2.nim |
01:29:14 | FromDiscord | <Savant> i'll look into this |
01:29:15 | FromDiscord | <Savant> really seems exactly what i want |
01:29:17 | FromDiscord | <Savant> thanks |
01:29:23 | FromDiscord | <Savant> with even like `parseStmt` overwrittetn |
01:29:24 | FromDiscord | <Elegantbeef> Why are you using parsestmt anyway? |
01:29:43 | FromDiscord | <Savant> but... i get issues i think related to new versions of nim/libs |
01:31:06 | FromDiscord | <Savant> to load some code into a nimnode stmt |
01:31:07 | FromDiscord | <Elegantbeef> So you're using it to piggy back on the Nim parser instead of writing your own? |
01:31:32 | FromDiscord | <Savant> i guess if thats how it works |
01:32:18 | FromDiscord | <Elegantbeef> Well what do you do with the node after? |
01:32:35 | FromDiscord | <Savant> currently im just doing some basic stuff like looping its children / validating the code thereafter - extracting some information for whatever purposes i may have |
01:33:20 | FromDiscord | <Savant> later it'll include transformation |
01:33:25 | FromDiscord | <Elegantbeef> Is this for a file format, compilation, or something else? |
01:33:32 | FromDiscord | <Savant> file format |
01:33:38 | FromDiscord | <Savant> trying to do js `{}` |
01:33:39 | FromDiscord | <Savant> mixed with `:` |
01:34:09 | FromDiscord | <Elegantbeef> So yes this is a poor usage of the parser |
01:34:14 | FromDiscord | <Savant> haha |
01:34:15 | FromDiscord | <Elegantbeef> Writing a parser from scratch to match a spec will make your life so much easier |
01:34:17 | FromDiscord | <Elegantbeef> But it's a nice shortcut to working code |
01:34:20 | FromDiscord | <Elegantbeef> Parsers are not hard to write |
01:35:51 | FromDiscord | <Elegantbeef> Also by `js` do you mean json or javascript |
01:35:57 | FromDiscord | <Elegantbeef> Cause one is compilation the other is a fileformat in my definition |
01:36:05 | FromDiscord | <Savant> sorry i meant like i want `{}` identation mixed in with the python `:` |
01:36:07 | FromDiscord | <Savant> as seen in "js" |
01:36:20 | * | SchweinDeBurg quit (Quit: WeeChat 4.5.0-dev) |
01:38:51 | FromDiscord | <Savant> i made it poorly happen with some regex like stuff -\>↵created new file "compiler" which "transpiles" at runtime then calls normal nim command with args passed through |
01:38:58 | FromDiscord | <Savant> i want to have- like a header or something, where i could denote something |
01:38:59 | FromDiscord | <Savant> this all works really groovy for how shitty i am |
01:39:02 | FromDiscord | <Savant> but the problem now became |
01:39:06 | FromDiscord | <Savant> and i want to extract that bit of info at runtime |
01:39:27 | FromDiscord | <Savant> but i want to use the same funcs |
01:39:32 | FromDiscord | <Savant> bc later my utility will grow large |
01:40:28 | FromDiscord | <Elegantbeef> Well there's your problem, regex is hardly a solution to this problem 😄 |
01:40:30 | FromDiscord | <Savant> be kinda messy having two systems even tho the solution is bridging two systems |
01:40:38 | FromDiscord | <Savant> YEA haha i understand that part of it |
01:40:42 | FromDiscord | <Savant> BUT it works for me now |
01:40:46 | FromDiscord | <Savant> what could you tell me abt this? |
01:40:56 | FromDiscord | <Savant> isn't this sorta like regex with organization |
01:41:04 | FromDiscord | <Elegantbeef> No |
01:42:06 | FromDiscord | <Elegantbeef> I mean design a requirement for the language, then write a parser that extracts it to an AST then process it how you want |
01:42:21 | FromDiscord | <Savant> do you have any ref on that process of "parsing to AST" |
01:42:29 | FromDiscord | <Savant> thats what i meant sorry |
01:42:56 | FromDiscord | <Elegantbeef> crafting interpreters |
01:43:09 | FromDiscord | <Savant> awesome thanks |
01:45:23 | FromDiscord | <Savant> will look into this |
01:47:14 | FromDiscord | <Savant> if im not mistaken this is that |
01:47:17 | FromDiscord | <Savant> https://raw.githubusercontent.com/elcritch/cdecl/refs/heads/main/src/cdecl/compiler/macros2.nim |
01:47:25 | FromDiscord | <Elegantbeef> Correct |
01:47:30 | FromDiscord | <Elegantbeef> But that's still a bad idea to rely on |
01:47:37 | FromDiscord | <Savant> yeah yeah yeah |
01:56:52 | * | lucasta joined #nim |
02:00:32 | FromDiscord | <Savant> but then also i couldnt use the same utility for compile time |
02:01:31 | FromDiscord | <Savant> cheeky cheeky ok |
02:01:34 | FromDiscord | <Elegantbeef> Correct, time to write a parser |
02:01:35 | FromDiscord | <Savant> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1296654115081945108): but then also i couldnt use the same utility for compile time? |
02:08:46 | * | rockcavera quit (Remote host closed the connection) |
02:15:00 | * | lucasta quit (Quit: Leaving) |
02:42:05 | * | pmp-p quit (Ping timeout: 252 seconds) |
02:45:21 | * | pmp-p joined #nim |