<< 18-10-2024 >>

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