« first day (1251 days earlier)      last day (442 days later) » 
00:00 - 20:0020:00 - 00:00

00:00
or even better compiling directly to it and then compiling to LLVM from there
but since it doesn't work yet I'm going straight to LLVM for now
@lyxal how?
just port the function
  def eval(s: String)(using ctx: Context): VAny =
    if VNum.NumRegex.matches(s) then VNum(s)
    else if s.matches(raw"""("(?:[^"\\]|\\.)*["])""") then
      s.substring(1, s.length - 1)
    else if Lexer.isList(s) then
      Lexer.lexLiterate(s) match
        case Right(tokens) =>
          val tempContext = Context(globals = Globals(settings = ctx.settings))
          Interpreter.execute(Lexer.sbcsify(tokens))(using tempContext)
          tempContext.peek
        case Left(err) => throw RuntimeException(s"Couldn't parse list: $err")
the one that calls the interpreter that LLVM won't have? d:
the one that can be changed to call a separate list evaluation function
calling the interpreter is just a convenience thing
I'm quite confused
why? The only instance of calling the interpreter is to evaluate lists
and that's just to piggyback off the lexer/parser pipeline
parse the list manually, and restrict it to just lists, numbers and strings
besides, the eval function will need to be changed a little because it doesn't correctly handle lists like [1,2,3] in sbcs mode
probably doesn't need to call the interpreter anyway
ohh right yeah it does handle [1,2,3] correctly
because it uses the literate lexer
ofc
00:07
look, if you want to implement all that in LLIR more power to you
but for now I'm going to try to write up the core functionality
and again if anyone wants to help I would very much appreciate it q:
def eval(thing):
    if thing matches a number regex: cast to int
    else if thing matches a string regex: remove string markers and return
    else if thing matches a list regex: listify(thing)
    else just return thing
def listify(thing):
    remove opening "["
    items = []
    for char in thing:
        if char == "[":
            collect until matching "]"
            add listify(^) to items
        else:
           collect until comma
           add eval(^) to items
a little bit like that
I don't see why that would be impossible :p
okay, I think I've misunderstood what eval does
you're probably thinking of exec
which has the line Interpreter.execute(code)
which would be not fun to do :p
ah
see, that's not going to be in Principio
but I see no reason why eval couldn't be
@Ginger same reason there's no exec as scala element in v3
00:17
righto
if anyone writes any LLIR for any elements put it here and ping me plz
oh, one other thing: LYCSAL will be using the Java bindings of the C++ LLVM APIs, and therefore will not be inherently cross-platform
00:49
what is LYCSAL o_O
Laconic vYxal Compiler System tArgeting Llvm
a Vyxal 3 to LLVM compiler that I'm considering working on
that's cool
@Ginger ...why not?
Doesn't the JVM run everywhere?
C++ doesn't run in the JVM???
Wait what
Doesn't C++ have compilers for every major architecture out there?
01:01
what I'm trying to say is that it won't be a one-JAR-fits-all situation
Which platforms wouldn't this work on?
As long as it works on all platforms, even if it needs separate JARs for each platform, that counts as cross-platform
I was afraid for a second there that you weren't going to support Windows or something
 
1 hour later…
02:28
in The Nineteenth Byte, 12 hours ago, by Rydwolf Programs
I'm really not sure how VB's still good tho
Actually how did the bot survive?
 
10 hours later…
12:09
@lyxal you really wanna know?
yes
well first I sold my soul to Jeff Atwood
/srs I have absolutely no clue :p
!!/status
@Ginger I am doing frick-all.
👃
13:02
!!/status
@Pacmanboss256 I am doing nothing important.
!!/status
@lyxal I am doing a very complicated maze. With no arms.
but where is "Find someone else's IP address"
13:06
the LLVM docs make my head hurt
LLVM as in low level virtual machine?
well ackshually it doesn't stand for anything
but yes, that LLVM
I'm doing research into writing a Vyxal-to-LLVM compiler
LLIR is like some unholy hybrid of C and machine code
oh thats awful
13:08
> @G = addrspace(5) constant float 1.0, section "foo", align 4
@Pacmanboss256 on the IPs tab
no really I mean there's actually an IPs tab thing on SE
mod powers moment
me on my way to make it a v3 element
13:10
please do not do that
I don't want to have to write an IP grabber in LLIR
it'd just be a web scraper
that's worse
"Golf an IP grabber!"
> LLVM function definitions consist of the “define” keyword, an optional linkage type, an optional runtime preemption specifier, an optional visibility style, an optional DLL storage class, an optional calling convention, an optional unnamed_addr attribute, ...
Hacking is problematic so you need to do it quickly. Golf me an IP grabber in the fewest bytes so I can recreate it when I inevitably get my machine taken away
13:12
it goes on like that for a whole paragraph
so its just a python function with the args listed in order
nope! it's way more complicated
and that's only definitions, I haven't even mentioned declarations
oh joy, I have to figure out memory allocation and GC too
GC shouldn't be a problem, right?
if it's not on the stack, destroy it
13:18
oh, I may have failed to mention that I don't actually know Vyxal
so uh
do you even code golf? :p
my vyxal code came to me in a dream
I used to be a golfer like you, until I took a chatroom to the knee
what types does Vyxal have?
13:20
number, string, list, function
right
I am not super excited about figuring out how to do that last one :b
is there a list of falsy values in vyxal
@Ginger take a break from that and come see the trolling I'm doing in snowpaw's den :P
@Pacmanboss256 empty string, empty list, 0
[0] isnt falsy :(
that's default python behaviour
13:22
fair
> Note that LLVM itself does not contain a garbage collector, this functionality is restricted to generating machine code which can interoperate with a collector provided externally.
whar ?
how does that work
you have to build your own garbage collector
apparently I'd have to link an external GC into the executable?
which is possible
but like lyxal said I probably don't need a GC
Just use Boehm by default and give users the option of no GC
@Ginger so long as you don't allow variables, you should be fine
13:27
do I actually need a GC tho
@lyxal how important are variables?
not very
but the register could be a problem
how so?
It's basically a variable
13:28
^
Allows cyclic refs
But even if you don't have cycles you need either GC or ARC
what if you just have a stack?
@user ick
@lyxal wait what
Just use Boehm, it's fairly easy to use and won't be a huge blow to performance
13:29
are you speaking from experience? d:
@lyxal Oh wait my bad yeah
remember, I have to get the GC to work with LLVM, which I'm sure will be a pain in the ass
@Ginger No
Just hearsay
But I saw an example once and it just involved a couole calls to Boehm stuff iirc
Possibly using their allocator instead of malloc
@lyxal so like not using the heap?
no like I mean what if you only ever have things on the stack
13:32
I think lyxal mean the Vtxal stack but yes
like the stack that the entire language operates on
Mar 12 at 22:53, by emanresu A
@user I don't think we actually need a GC, since we're not doing anything with multiple references or mutability. When something is popped, it can be freed once used.
it'd make sense for the Vyxal stack to map 1-1 to the OS stack
Mar 12 at 23:26, by lyxal
@user not really. The moment something isn't in a variable or on the stack, it's never needed again
Mar 12 at 23:53, by user
@lyxal Yeah, emanresu talked about how there wouldn't be recursive references, so refcounting would work
13:33
Good point
Ginger would still have to add some frees but yeah that'd work
Mar 13 at 1:03, by Seggan
@user the problem is that they are recursive
Mar 13 at 1:03, by Seggan
if you map one to another, the new one depends on the old one
Mar 13 at 1:03, by Seggan
so you do need a gc
apparently
Oh
Just use Boehm then
or I could not have lazy lists
i don't really know much about collecting garbage, I'm just looking at the transcript from the last time a garbage collector was discussed :p
like Cyxal was doing
13:35
I guess you could do that
^
takes away some of the power of the language though
and would make it somewhat more verbose for some tasks
Yeah :(
I'll add them later™, for now I just want something runnable
and Principio is more for s p e e d than golf
Could you prod seggan and bbrk to see if they're okay with turning cgr into a llvm thingy with a gc?
@Ginger isn't that like the point of Jyxal, Myxal, and the Scala Native binaries?
13:37
tbh I'm not sure how useful it'd actually be in practice, but having a static compiler would sure look good on the ads q:
Faster than all of them
@lyxal yes, but do any of them actually work?
Scala Native does yeah
Myxal and Jyxal do
66% of them i think
ah 100% of them
13:37
But it's likely slower than Jyxal
so what's the point of me working on this then?
Having fun and learning about llvm
we already have two compilers and a native interpreter, so what would LYCSAL actually be worth?
epicness factor
One big part of vyxal is just having fun and learning stuff right
If you want to do it and have the time to do so go for it
13:39
I'm not sure I know enough about Vyxal (and compilers in general) to actually have fun doing this
Lol ok then
Could you help us with implementing v3?
doubtful :p
I promise we can turn you to the Scala side
nah, Kotlin forever
13:39
:(
if I do decide to work on this I'll at least make an effort to write it in Scala tho
Do it
we tried asking nicely
now for the violence :p
Ginger has committed treason
@Ginger nice
13:40
yesterday, by math scat
and how do yall keep track of elements that haven't yet been implemented in v3?
@Ginger last chance to turn to Scala :p
@mathscat Is there a checklist or smth :P
@mathscat uhh I guess just look at info.txt and compare to Elements.scala?
@mathscat we just go down the info.txt list in order :p
Info.txt has all planned elements
13:41
@lyxal no
I think E downdot is where we're up to
Elements.scala has the elements in no particular order
you're getting the best available deal here
@Ginger don't say I didn't warn you :p
13:41
Lmao he actually did it
Scala :)
Scala
Let the reign of terror begin
:)
All dissenters will be kicked
scala I guess? (go is better tho)
13:42
Oh crap I'm late for class
@user and or suspended :p
@user no, you're user
@mathscat Careful there
that was uncalled for
1 min ago, by lyxal
@Ginger don't say I didn't warn you :p
@lyxal Ah thank you for reminding me, I keep forgetting
@Ginger Ok we won't do it again
13:43
I'm not changing my mind, lyxal
I don't think lyxal meant to change your mind
and if you kick me again I will be writing it in Kotlin
i figured
It was just funny
i just wanted to commit to the bit :p
13:44
eh, I can respect that
It was 1 minute
+ RO abuse is funny when done tastefully :p
Please don't abuse ROs
4
don't you have a class to get to :p
anyway: at least initially, Principio will not support variables, the register, or lazylists
now back to reading the LLVM reference
13:45
ironically not supporting lazy evaluation could lead to a speed reduction
because applying functions to big lists of things would need to apply to every item
learned that one the hard way in AoC 2020
I reiterate my earlier statement: if you want to write LLIR for lazylists go ahead
1. does Scala have extension functions, 2. how bad is the visitor pattern
and the visitor pattern isn't too bad
ooh, Scala has indented code blocks?
very nice
how does it do null handling?
you shouldn't need null
because you have Some and None
I'm interopping with Java code (which interops with C++ code)
so I very well may
how well does Scala do that btw?
13:51
well it does have a null type
well, not a type
but you can assign null to objects
> given
huh?
119
Q: Wrapping null-returning method in Java with Option in Scala?

José LealSuppose I have a method session.get(str: String): String but you don't know whether it will return you a string or a null, because it comes from Java. Is there an easier way to treat this in Scala instead of session.get("foo") == null ? Maybe some magic apply like ToOption(session.get("foo")) a...

@Ginger implicits!
oh you'll love those
basically, it means you can have a parameter passed between functions and classes and you never have to worry about remembering to pass it
it's automatically done for you
it also means you can set up implicit conversion rules like bool to int and you don't need to do explicit type casting
spicy! sounds like that'll work well with the LLVM context singleton
oh it sure will
v3 uses implicit for passing ctx to everything
it's really nice to just write ctx.whatever and not have to think "oh did I pass context to that?"
@Ginger wrap everything in Option
it'll automatically turn null into None
so, my current plan is to use the V3 interpreter to generate the AST and then convert that into LLIR
@lyxal cool
13:57
@Ginger yeah that might be a problem with modifiers too :p
what're those
things that take things and do things with the thing it takes
that's purposefully vague so let me write you a better explanation real quick :p
👍
Say you want to get the length of items in a list
you want to use L because that's the thing that gets lengths of things
now you might say "no worries, I'll just use a map lambda"
ƛL;
but that's long
verbose
and gonna make you lose to Jelly
blegh
blegh indeed
14:01
if you had something that could go in front of the L to make it map without needing a lambda, you could do it in two bytes
enter modifiers
a modifier takes an element like L and wraps it in a lambda and does stuff with that lambda
so in the length of items example, you'd want to use the vectorise modifier (v)
so you'd write vL
hmm
and the v would take the L (not like that you zoomer) and map it to the list
that's gonna be funky to compile
(and yes @ exists in version 2 but that's a thing that is a thing)
@Ginger once you figure out function types you'll be fine
buddy I'm not even sure how to represent functions
14:03
because modifiers become "<push function> <element that has a function overload>"
I'm barely even sure how LLVM handles functions
@Ginger that's an important thing to figure out
well yes
because otherwise you lose access to a lot of useful things
Ohh
Oh just realised
You're gonna have to implement the vectorisation function too
Not the modifier
The thing that automatically makes some things apply to all items in a list
Takes a function and vectorises it based on arity
And then there's the things that sometimes have one argument and other times have two arguments based on what type is on the top of the stack
You'll also need to figure out how to do type overloading and how to have mixed types in lists and other things
Also also I take it you won't have support for exact numbers
Kinda a shame but probably understandable
And I suppose you definitely won't be having algebra support :p
...
well
seems I have my work cut out for me
14:14
Only [proceed] if it's something you want to work on
There's no pressure from any of us to do it
I"m going to try to make a program that can turn basic elements into LLIR
if that works it's a success and I can expand upon it
and by "basic" I mean "what's 9 + 10"
21
@lyxal right
@mathscat wrong
damb
hmm I'm kinda confused now (again)
The elements in info.txt are already implemented, correct?
14:17
No
Only some of them are
Info.txt is the plan document
Anyhow I gots to go now
funky fact: if LYCSAL works, it will be possible to compile Vyxal to WebAssembly
Because it is late o clock
12:19am to be precis
Orecisoon
Precidie4
Precise
r/ihadastroke
14:20
Imma head dojt
Ohr
Out
dammiy noinja;d
o/
\o
If info.txt isn't sorted in any way, then is there a better way than ctrl-f to find elements that haven't been implemented yet?
cuz it seems like the last 5 elements from info.txt are in elements.txt
14:43
@lyxal in case you're still here: sbt or mill?
we shall go with sbt
sbt was at least easier to set up and use on wsl
 
2 hours later…
16:57
@Ginger Decently
It's the other way around that's more problematic
@Ginger Yeah sbt has a lot more docs, mill if you're adventurous
@Ginger Sorta like macros
Builtin macros (I think Jelly calls them quicks?)
@Ginger It doesn't really have ?. or ?: like Kotlin since most Scala code uses Options. Try making helpers to call Java null-returning methods in Option maybe?
alright how tf does SBT work
like, how do I add dependencies
You add a libraryDependencies ++= Seq(...) in your .settings() call
Can I see your build.sbt file?
it's the generic hello world one
val scala3Version = "3.3.1"

lazy val root = project
  .in(file("."))
  .settings(
    name := "lycsal",
    version := "0.1.0-SNAPSHOT",

    scalaVersion := scala3Version,

    libraryDependencies += "org.scalameta" %% "munit" % "0.7.29" % Test
  )
Yeah replace libraryDependencies += "org.scalameta" %% "munit" % "0.7.29" % Test with:
libraryDependencies ++= Seq(
  "org.scalameta" %% "munit" % "0.7.29" % Test,
  "org.foo" %% "bar" % "0.0.0"
)
> A method can take multiple parameter lists
whoa what?!
17:02
You might want to look at Vyxal's build.sbt for inspiration
@Ginger Just currying
Like foo(bar)(baz)
this reminds me of Ruby
It's easier to do def foo(bar: Int)(baz: Int) than def foo(bar: Int) = (baz: Int) => ...
@user how would I depend on Vyxal?
17:26
I have decided to directly use the 3beta3 JAR
 
1 hour later…
18:54
> def compile(ast: AST)(using vyCtx: Context, llCtx: LLVMContextRef, module: LLVMModuleRef, builder: LLVMBuilderRef)
cha cha real smooth
19:16
mfw Elements.scala is almost 2.5k lines
what do the properties of the Element case class mean?
19:40
Remember the elements.py file in Vyxal 2? It's like that. It has every single element implementation
@Ginger We should probably add a doc comment there
symbol is the symbol from the codepage for the Element (e.g. + or :)
name is a short description of the element, e.g. "Bit Length | Matrix Inverse"
keywords is a list of keywords that you can use to refer to the element in literate mode, e.g. add and plus for +
arity is how many arguments it takes. It's an Option because some elements operate directly on the stack
vectorises is whether or not it...vectorises. I'm not sure how to explain this one but I assume you know already
vectorising is like doing a deep flatmap
overloads is a list of strings describing the overloads of the element, e.g. a: num, b: num -> a + b
impl is the actual implementation of the element. It's a function that will (presumably) pop stuff of the stack, do stuff, and pop stuff onto the stack
@lyxal pinging you to verify (also TODO need to add a doc comment explaining what Element is and what it holds)
@user well actually no I don't :b
@user so an element with no arity modifies stack values w/o popping?
@user not really d:
00:00 - 20:0020:00 - 00:00

« first day (1251 days earlier)      last day (442 days later) »