This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Dave-ee Jones's profile picture

The Progress of Shark (and co.)

Started by Dave-ee Jones, 05 October 2017 - 11:46 PM
Dave-ee Jones #1
Posted 06 October 2017 - 01:46 AM
Hoi!

I'm working on a programming language for a browser I'm making. It's…interesting…made more of parsing than anything else, really. Very hard, but almost..captivating.

The language will seem quite familiar with a bit of a twist for better argument handling (well, for Lua anyway).
Here's a quick example:

<color['blue','lightBlue']>
  <print['3','3']>
	OI, RED!
	<color['red','orange']>
	   WHAT?
	</color>
	Oh, nothing.
  </print>
</color>
Guess what's it's based off :P/>
The arguments for 'color' is pretty self explanatory, but the 'print' command's arguments are the starting X and Y position of the text. Also, the text has a CONTINUING X position, but obviously not Y otherwise it would overwrite the old text in that same spot (if you were to have multiple lines).

It's pretty cool, could be really powerful for UI creation (having <button>, <checkbox> etc.). Things like <center> or <column> may be a bit harder, though, but it's definitely worth a shot.

It's currently working quite well. My parsing program (called 'Shark' at the moment) runs that snippet of code up there, outputting this:
OI, RED! (pretend there's a light blue background on this text)
WHAT? (pretend there's an orange background on this text)
Oh, nothing. (pretend there's a light blue background on this text)
Notice how you can have tags inside <print>'s and <write>'s.

The main reason I'm creating this 'Shark Language' (.sls files - standing for Shark Language Sheet) is for a browser I'm working on (similar to Thunderbird/Firewolf but obviously not as great). It'll be used for websites/pages.

Anyway, just felt like sharing what I'm working on and how it's going, because it's my first time creating a language parsing program and it's pretty exciting. :D/>
Edited on 27 October 2017 - 03:46 AM
KingofGamesYami #2
Posted 06 October 2017 - 03:24 AM
Is there a reason you cannot do <print[3,3]>? I feel like converting numbers to character is counter-intuitive.
Dave-ee Jones #3
Posted 06 October 2017 - 03:43 AM
Is there a reason you cannot do <print[3,3]>? I feel like converting numbers to character is counter-intuitive.

Well, it helps the parser identify where arguments are. If it was set out how you had it, it would have to have dynamic checking, like so:

--# This can test for arguments inside marks separated by commas
<color['3','3']>
--# This has to check for arguments before and after commas,
--# which means dynamic parsing. The first argument is surrounded
--# by a '[' and a ',' making it hard for the parser to identify it.
<color[3,3]>

Other than that, there's no reason why I can't do your method. I could definitely work on a way of making the parser identify it, but I think it is actually helpful having the ' '. For me, anyway.

If you want to test it and have a look at my parsing code I'm happy to send you the file? That way I've got some feedback as well. :)/>
Edited on 06 October 2017 - 01:46 AM
KingofGamesYami #4
Posted 06 October 2017 - 04:09 AM
It shouldn't be two hard to identify two numerical arguments without the quotes. Of course, I'm not familiar with how you're parsing the file. If you send me it I could comment on specific changes which would allow this.
Dave-ee Jones #5
Posted 06 October 2017 - 04:20 AM
It shouldn't be two hard to identify two numerical arguments without the quotes. Of course, I'm not familiar with how you're parsing the file. If you send me it I could comment on specific changes which would allow this.

It's more convenient code-wise. The way I'm doing it is a one liner. Plus, it's more uniform this way, I think. But I'm open.
Dave-ee Jones #6
Posted 06 October 2017 - 05:30 AM
Making a second draft of the parsing. This program is a bit..big..
I've got 144 lines (which doesn't sound like much), but it's all really good code that's..not doing anything right now. I tend to focus too much on the backend more than I should :/


Shark D2 (draft 2) is 305 lines. Executes raw Sharkles (URLs) with DNS resolving, line-by-line execution and now has support for arguments set out like so:

<color[blue]>
  <print[5,5]>
    Hey. I'm still blue and at 5,5!
  </print>
</color>
(doesn't require ' ' anymore).

PLANNED FEATURES:
  • UI (includes Sharkle bar, Menu and a page - if loaded)
  • Site hosting on networks (send/receive site data, accessed via Sharkle bar)
  • Certificates (potentially) - allows for private sites (need a specific certificate to be able to access a site)
  • Error Codes (resolves to pages like 'not-found' and 'timeout' etc.
Edited on 08 October 2017 - 11:10 PM
Jummit #7
Posted 10 October 2017 - 10:31 AM
Just one tip: If you want people to use it, make it like the real html so everybody knows the syntax. Nobody will learn a complete new syntax just for making websites for this. If this is just a little project which is not for the world, then its logic that you can do what you want.
CLNinja #8
Posted 10 October 2017 - 06:58 PM
Just one tip: If you want people to use it, make it like the real html so everybody knows the syntax. Nobody will learn a complete new syntax just for making websites for this. If this is just a little project which is not for the world, then its logic that you can do what you want.
He specified that its for a browser inside of computercraft, so it really doesnt matter what he does with the language.
Jummit #9
Posted 11 October 2017 - 07:34 PM
Just one tip: If you want people to use it, make it like the real html so everybody knows the syntax. Nobody will learn a complete new syntax just for making websites for this. If this is just a little project which is not for the world, then its logic that you can do what you want.
He specified that its for a browser inside of computercraft, so it really doesnt matter what he does with the language.
I would use his program in Minecraft if it is good, and then I would like to have a familiar language implemented so i can get started without looking at a doc of the language before.
Dave-ee Jones #10
Posted 11 October 2017 - 11:41 PM
It's fair enough that people won't want to learn another language just to use Shark effectively. Creating a GUI-based editor for it might work but would be very tricky, but very cool indeed. I doubt Shark will be as good as Thunderhawk (not quite as polished I would think) but they each have their own unique features.

We'll see how it goes. I'm not sure if I'm going to have time to work on it today but you never know. A 15-minute break can work wonders on a program. Haha :)/>
Dave-ee Jones #11
Posted 24 October 2017 - 03:41 AM
Just an update on how this project is going..

AMAZING! Well, the code isn't overly neat. Here's a few quick features Shark has:

You can manually type in a Sharkle to access default pages like:
  • local://errors/
  • local://about/
  • local://not-found/
  • local://test/ (test domain I've made)
It has some redirecting functionality. E.g.

local://test/
--# Goes to..
local://test/index.sls

local://test/index
--# Goes to..
local://test/index.sls

And DNS (which is what the 'local' is). Default DNS is 'local' and 'localhost'. However the DNS file in the 'sharkfs' directory also contains 'me', 'main' and 'fun' (all different computer IDs).

Keep in mind that the server/client site hosting/requesting isn't implemented yet. It's pretty simple though:
Client asks if server has this file, server says no or gives them the contents of the file (SLS file). Easy :)/>

It also logs any errors on pages (which is what the 'local://errors/' page is for - it tells you how many errors were on the last page you visited) and logs all the pages you visited to a 'history' file in the 'sharkfs' directory (don't currently have a 'local://history/' page to read this file as of yet. Needa work on a scrolling bar..

I haven't officially released Shark yet, and for good reason (it's not working enough to release it to the public officially) but for those who want to have a play of how it's currently working you can access it here: MY GITHUB REPO
You need to download the 'sharkfs' and 'shark' files/folders and put them in the root directory of a computer, then just run 'shark'.

The repo contains all previous drafts. Each draft is a complete re-write of Shark. My next draft should be a completely working version of Shark that has neater code and more OOP involved making it easier on me to write (or harder, sometimes you get some ridiculously-long table indexing..).
Edited on 24 October 2017 - 01:42 AM
Dave-ee Jones #12
Posted 24 October 2017 - 04:13 AM
Here's a list of planned features (quite exciting..):
  • Menu (History, Settings, About, Errors, Quit)
  • Shark Pages (History, Settings, About, Errors, Home)
  • Site-hosting via Server/Client system
  • Site Handlers
  • Error Codes (Not Found: Site, Not Found: Page, Host didn't respond, Host requires certificate from client, Certificate denied, DNS couldn't resolve hostname)
Site Handlers are my idea of Shark's version of PHP. When I eventually implement input boxes the text will be sent to the server with information of what site, page and textbox the text was put in (and the text itself), which the 'site handler' goes through and responds to the client with information.
Use Examples:
  • Login/Register pages
  • 'Online' Notepad
  • Controlling your reactor remotely
  • Control your house's redstone circuits remotely
Basically infinite examples..
Dave-ee Jones #13
Posted 27 October 2017 - 05:50 AM
Renamed OP to suit the topic.

Update on Draft 4:
  • Menu is complete
  • Shark Pages are almost complete (don't have 'Settings', 'History' and 'Themes' yet)
  • Site Handles haven't been started yet (will worry about that when Shark is up and running)
  • Site-hosting is implemented (with DNS) but isn't working, sadly. Still trying to figure out what the bugs are. Completely fixed and working! Check it out!

The files for Draft 4 can be found in the repo. If you do try it out and notice any bugs, lemme know with an 'Issue' on the Github or just post a comment here!
Edited on 29 October 2017 - 11:25 PM
Dave-ee Jones #14
Posted 01 November 2017 - 04:43 AM
Shark V1 has been released, go check it out!