Author |
Message |
mirhagk
|
Posted: Sat Jan 01, 2011 4:26 pm Post subject: Extending web scripting languages |
|
|
If I were to (just for fun) try to create another web scripting language (like javascript), would it be possible to use firefox and google chrome addons to make it work?
Just wondering if this is posssible |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
|
|
|
|
mirhagk
|
Posted: Sat Jan 01, 2011 5:23 pm Post subject: RE:Extending web scripting languages |
|
|
Okay so any clue about how to get started? Like would I just declare it as "text/mylanguage" (also does it have to be text, can I use a byte stream?)
Then how does the javascript add on access it? |
|
|
|
|
|
Tony
|
Posted: Sat Jan 01, 2011 5:40 pm Post subject: RE:Extending web scripting languages |
|
|
you can implement your entire interpreter in JS, and use JS to access the DOM and read the source. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
mirhagk
|
Posted: Sat Jan 01, 2011 6:03 pm Post subject: RE:Extending web scripting languages |
|
|
Oh wait, I guess that i can just assign an id to the script tag, and grab that with the DOM. (probably should've realized this, guess the holidays threw me off, man HTML is sweet).
Thank you so much tony. One last question though. Do you know what characters I cannot define in the script tag (like < and > would probably break the html, anything else? [ie can I use a byte stream, except without certain elements. I'd make them not full bytes but rather 7-bit values with one of the values to ensure that I don't use values like < and >. Perhaps just set the first bit to high would do this?]) Thank you so much, and with the answering of this question comes a night of planning, and then intense programming tomorrow lol.
Edit: Or can/should I follow standard and make it a type, then use the javascript to grab it by type?
like
type="text/myscript"
and what's with the text part, does that mean it can be something else (byte stream) |
|
|
|
|
|
Tony
|
Posted: Sat Jan 01, 2011 6:14 pm Post subject: RE:Extending web scripting languages |
|
|
you can any characters, including <>, if you keep them inside a CDATA block -- the same way that inline JavaScript does not break HTML pages. http://en.wikipedia.org/wiki/CDATA
I don't know how browsers interpret type="text/whatever" |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
|