|
| 14 Mar 2014 04:17 PM |
It's called JunkScript and its purpose is to be very easy... for the language creator. Not for the user.
There are only 26 variables to work with (a through z)
Here's the list of commands, you put one on each line:
m [MESSAGE HERE] - Display a message i [MESSAGE HERE] - Display an input box and store result in the input variable s [VARIABLE] - Take the input variable and store its value in [variable] d [VARIABLE] - Display a message box with the value of a variable + - Add variables A and B, store result in C. v [VARIABLE] [NUMBER] - Store [number] in variable [variable] f [LINE] - If variable A = variable B then goto line [line] t [VARIABLE] [VARIABLE] - Transfer value from first variable to second variable
Tell me what example programs to write
Also, the acronym was going to be JScript, but I realized that would be an insult to the real JScript |
|
|
| Report Abuse |
|
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
| |
|
|
| 14 Mar 2014 04:28 PM |
Here's one that does addition and subtraction:
i Enter first number s x i Enter second number s y i Enter operation (1 for add, 2 for subtract) s a v 2 b f 20 t x a t y b + m Result is... d c
t x a t y b - m Result is... d c |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 14 Mar 2014 04:33 PM |
Interesting. You should make the functions for messages vararg-able for concatenation (perhaps use commas for clarity): m "A is " A " and b is " B and add loops - only need the while as the others can be built from it, though adding nesting does get complicated. 2 common programs made with new languages are fizzbuzz and 99 bottles of a drink on the wall.
I've been doing compiler stuff today as well, following compilers iecc com/crenshaw/ which teaches you about compiler stuff, but without going into lots of the complicated theory - you have a working compiler by the second lesson. However it is in Turbo Pascal :/ I've been porting it to Python as I go and tidying it up, and I've now gotten to: a = 5 b = 10 if a = 5 c = 15 else if b = 10 d = 20 else e = 25 endif endif f = 30 end compiling to (ignoring the [condition] part - this tutorial works by teaching a different bit in each lesson but saving the same base, so the condition part has been taught in a previous lesson but in this latest one on lexical scanning, it has been removed for simplicity): [condition]; BEQ L0; MOVE #5, D0; LEA A(PC), A0; MOVE D0, (A0); MOVE #10, D0; LEA B(PC), A0; MOVE D0, (A0); ... L1; // It doesn't like this opcode L0; MOVE #15, D0; LEA C(PC), A0; MOVE D0, (A0); L1; END; MOVE #5, D0; LEA A(PC), A0; MOVE D0, (A0); MOVE #10, D0; LEA B(PC), A0; MOVE D0, (A0); [condition]; BEQ L2; MOVE #5, D0; LEA A(PC), A0; MOVE D0, (A0); MOVE #15, D0; LEA C(PC), A0; MOVE D0, (A0); ... L3; // It doesn't like this opcode L2; [condition]; BEQ L4; MOVE #10, D0; LEA B(PC), A0; MOVE D0, (A0); MOVE #20, D0; LEA D(PC), A0; MOVE D0, (A0); ... L5; // It doesn't like this opcode L4; MOVE #25, D0; LEA E(PC), A0; MOVE D0, (A0); L5; L3; MOVE #30, D0; LEA F(PC), A0; MOVE D0, (A0); END;
|
|
|
| Report Abuse |
|
|
|
| 14 Mar 2014 04:35 PM |
@droid
It's designed to be easy for me to make (I'm a noob at this, lol). But you can make a loop, kind of. Use if statements as a replacement for goto [line] and you're set XD |
|
|
| Report Abuse |
|
|
MettaurSp
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 3179 |
|
|
| 14 Mar 2014 04:35 PM |
| Did TI-Basic have a syntax transplant with Assembly? o3o Y? Neat concept though. |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 14 Mar 2014 04:43 PM |
Oh yeah, didn't notice the goto.
// L is length v L 5 // You should add multicharacter variable names, use a dictionary // L is counter variable v I 1 // And opcodes too would help // You could add labels instead of code numbers // Like start_loop:, then g[oto] start_loop
// Do your stuff (oh yeah, do you have comments) m The current value of I is d I
// Put I into A and 1 into B t I A v B 1 // So that addition does I + 1 + // Move result back to I (so I = I + 1) t C I
// Put I and L into A and B so that equality can be compared t I A t L B f 3 // Assuming comments aren't counted, this'd be the line after I and L declared // Greater/less than and inequality opcodes would be cool too |
|
|
| Report Abuse |
|
|
morash
|
  |
| Joined: 22 May 2010 |
| Total Posts: 5834 |
|
|
| 14 Mar 2014 05:06 PM |
| I'm trying to design a language that translates code into visual objects in a JavaScript/HTML combo thing, but I keep getting the error message "Variable '$' not defined. Line 1 Char 1" |
|
|
| Report Abuse |
|
|
|
| 14 Mar 2014 05:37 PM |
| It's a Scripting Language. |
|
|
| Report Abuse |
|
|
morash
|
  |
| Joined: 22 May 2010 |
| Total Posts: 5834 |
|
|
| 14 Mar 2014 07:50 PM |
| ^Thanks for the statement captain obvious^ |
|
|
| Report Abuse |
|
|
|
| 14 Mar 2014 08:31 PM |
I just have one idea for a SCRIPTING language.
It's syntax is almost like English, and it's supposed to be like English, except for programming.
Example if you didn't understand:
if a is equal to b, then set a to 24 or set b to 24 that's it
"That's it" is basically end.
Commas and punctuation are required also.
|
|
|
| Report Abuse |
|
|
| |
|
|
| 14 Mar 2014 08:32 PM |
"b, then"
"that's it"
","
"'"
Hate it already. |
|
|
| Report Abuse |
|
|
|
| 14 Mar 2014 08:33 PM |
And why not "otherwise"?
if ... then
otherwise
finish |
|
|
| Report Abuse |
|
|
|
| 14 Mar 2014 08:35 PM |
Otherwise is good
But what if you need to:
if a is equal to b and c, then set a to 24 or else, if b is equal to c, then set b to 24 or else set c to 24 |
|
|
| Report Abuse |
|
|
|
| 14 Mar 2014 08:35 PM |
| This sounds a ton like Ti-Basic. |
|
|
| Report Abuse |
|
|
| |
|
|
| 14 Mar 2014 08:38 PM |
if a is equal to b and c then --I dont even think that there should be a , there... set a to 24 otherwise, if b is equal to c then set b to 24 otherwise set c to 24 |
|
|
| Report Abuse |
|
|
MettaurSp
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 3179 |
|
|
| 14 Mar 2014 08:43 PM |
| Only I/O and variable stuff with some mathematics so far. Needs a bit more variable control such as more math-y operations o3o |
|
|
| Report Abuse |
|
|
|
| 14 Mar 2014 09:22 PM |
| Requiring more typing for the same result doesn't make things easier.. trust me. Although some imagine a language in which proper english may be typed and interpreted to do a task, substituting more appropriate words only makes the language more readable to a non programmer. Personally, I would get slowed down by the common notation, as I can read and understand symbols/short words quicker. |
|
|
| Report Abuse |
|
|
Usering
|
  |
| Joined: 18 Aug 2012 |
| Total Posts: 10281 |
|
|
| 14 Mar 2014 10:01 PM |
| Did you make it in Lua or in another language? |
|
|
| Report Abuse |
|
|
|
| 15 Mar 2014 02:38 AM |
| You, my friend, just remade assembly. <.< |
|
|
| Report Abuse |
|
|
|
| 15 Mar 2014 02:54 AM |
v [VARIABLE] [NUMBER] - Store [number] in variable [variable] t [VARIABLE] [VARIABLE] - Transfer value from first variable to second variable
Fix the consistency. I prefer if you do "Transfer value from SECOND variable to FIRST variable."
EOS db 0x00 ;End of String Marker |
|
|
| Report Abuse |
|
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
|
| 15 Mar 2014 03:22 AM |
"You, my friend, just remade assembly. <.<"
Because what makes a programming language is its syntax. |
|
|
| Report Abuse |
|
|
|
| 15 Mar 2014 03:51 AM |
Indeed it is.
EOS db 0x00 ;End of String Marker |
|
|
| Report Abuse |
|
|