This has been sitting in my repls for months, but with repls new addition of Nix, I can finally start working with it again.
This is a prelude to the browser engine I am creating. I don't mean just starting up python and running chromium with it. I have an HTML parser, a CSS parser, and this all done from scratch. I've been waiting for repl to add an apt alternative forever so that I could use an actual gui library and it's finally been added!
This has most of the basic features of JS, but I'm sure it has some quirks. I'm also sure the errors are really bad and uninformative.
But it does work. It supports JSON, and the JSON parsing and stringifying code was all made in js, instead of cheating and using C++.
This is a prelude to the browser engine
Can't wait to see that! So you have all the parsers, you just have to translate that into GUI elements, and then you'd be done?
Also is it on GitHub?
@DynamicSquid I might put it on github once it's working at the very least.
Theres a lot of stuff in HTML and css that define where things go, like flexbox, margins and all that. Theres also display: block, position: relative vs fixed vs absolute vs etc and plus many years worth of js apis
Will the CSS engine be embeddable? I was looking for a specification-compliant CSS parser embeddable into a C++ project a few months ago, but it didn't seem like Firefox's or Chromium's stuff was intended to be usable without the browser or a renderer.
@CSharpIsGud Ofc it's not going to be compliant yet. Just a fair warning: the standards can be complicated and hard to read, imho. You'll have to take from HTML, W3C, TC262, and a bunch of other groups if you're going to make a whole browser.
But I could probably spot incorrect results from the headers, and report issues ¯\_(ツ)_/¯
true, that is why dev version is more stable, but either is ok with me. Also no, edge does not have tiling tabs, but 100 % edge has more features than firefox. Vivaldi has more features than edge, but edge has a cleaner look, and implements the features better. Like you can minimize the vertical tabs bar in edge, but in vivaldi it is stuck, and you can only resize it @DungeonMaster00
I think I might want to make a browser engine too! Just wondering, did you use official JS standards or just things you already knew about the language? If the official standards, could you by any chance point me to where to find them? Also, just wondering, what GUI library are you planning on using?
Hey, I am thinking about learning C# on top of JS, HTML, CSS, C++, and Python. I want to do this because someone (I think it was fuzzy) said that C# is easier than C++ meaning that starting off with unity and C# for game dev will be easier for me. What is your opinion on this, do you think I should learn C# and start off with Unity, or should I go straight for C++ and Unreal? @CSharpIsGud
I am just downloading the add on that allows me to develop WebGL in Unity, nothing else. It takes up too much space.
Thanks for your input. I am almost done learning JS and CSS (JS is just a course that teaches you the basics, CSS course creates a website) so when I finish them, I will start C++ (I already finished the beginner course, but now I am doing the essentials or whatever) again and start C#. I will also be learning Nodejs but that is later.
I don't know why I am telling you all this, but eh who cares.
BTW if you know unity, maybe after I finish learning C# you can help me code in Unity and we can create a project together(WebGL so we can share it on replit or just a normal one for fun). @CSharpIsGud
Good job! Want to make it open source and/or spec compliant, or it that not something you'd care too much for?
Also, first thing I attempted to do was print a function, it failed with a seemingly unrelated message, decimal printing fails too :P
Call operator also doesn't check whether the callee is a functor or not:
And Array::constructor is totally incorrect spec wise :)
@fuzzyastrocat I haven't implemented many errors yet so a lot of times it just segfaults instead. While you are right he shouldn't of used false there, it still doesn't function correctly in my interpreter right now.
This should be 1, but ran with mine it's 2.
I assume this is just because I run the increment statement even though the condition is false when it shouldn't and that should be an easy fix
@xxpertHacker @StringentDev no and I haven't bothered to even deallocate anything yet so basically every single thing is a memory leak.
But that's not the cause of the segmentation fault.
It segfaults because I haven't implemented many errors yet, that code isn't valid in a true interpreter either and will give you
current_closure is not a function on the 5th loop. Mine doesn't have that error implemented yet so it segfaults instead. (man I really need to do that)
Nothing less of brilliant. The sheer skill it requires to make an interpreter from scratch if awe-inspiring. Quick question, when interpreting control flow, do you group the lines to be interpreted together in the parsing stage or the actual interpretation/simplifying the ast stage?
I don't mean just starting up python and running chromium with it
Ah yes, finally someone else who actually does things the real way! Nice work here, looking forward to seeing the browser working!
though I'm really triggered by implementations being put in an .hpp file xD