1. Ewl
- Posted by Philip Mullen <PETER at pmullen.fsnet.co.uk> Feb 16, 2002
- 530 views
This is a multi-part message in MIME format. ------=_NextPart_000_003F_01C1B6D5.25DCC840 boundary="----=_NextPart_001_0040_01C1B6D5.25DCC840" ------=_NextPart_001_0040_01C1B6D5.25DCC840 charset="iso-8859-1" Hello, for the last couple of days i have been working with the euphoria gets command as i am trying ti see how easy it is to create my own langugae, it is extremly limited but i just want to try, But I can't seem to get the program to read in the command and then take the proper action, if any one out there can see why could they send me an ammended version and the notes to how they did it? ------=_NextPart_001_0040_01C1B6D5.25DCC840 charset="iso-8859-1" Content-Transfer-Encoding: 8bit <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 5.50.4134.600" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#fffff0> <DIV><FONT face=Arial size=2>Hello, for the last couple of days i have been working with the euphoria gets command as i am trying ti see how easy it is to create my own langugae, it is extremly limited but i just want to try, But I can't seem to get the program to read in the command and then take the proper action, if any one out there can see why could they send me an ammended version ------=_NextPart_001_0040_01C1B6D5.25DCC840-- ------=_NextPart_000_003F_01C1B6D5.25DCC840 Content-Type: application/octet-stream; name="Ewl.ex" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="Ewl.ex" include get.e=0A= include machine.e=0A= include sort.e=0A= include wildcard.e=0A= include input.e=0A= =0A= with trace=0A= =0A= sequence command=0A= puts(1,=0A= "Do you wish to trace ? (Y) / (N):\n ")=0A= command =3D upper(user_input())=0A= if 'Y' =3D command[1] then=0A= trace(1)=0A= end if=0A= =0A= if 'Y' =3D command[1] then=0A= trace(1)=0A= =0A= elsif 'N' =3D command[1] then=0A= trace(0)=0A= end if=0A= =0A= =0A= object temp=0A= temp =3D command_line()=0A= =0A= if length(temp) <=3D 2 then=0A= puts(1,"No program file selcted, Aborting")=0A= abort(42)=0A= end if=0A= =0A= sequence runfile,PS=0A= atom file=0A= =0A= PS =3D {}=0A= =0A= runfile=3Dtemp[3]=0A= file=3D open(runfile,"r")=0A= =0A= if file =3D -1 then=0A= printf(1,"%s does not exist, or you have got the wrong path",{runfile})=0A= abort(42)=0A= end if=0A= =0A= temp =3D gets(file)=0A= =0A= while not atom(temp) do=0A= =0A= PS =3D append(PS, temp)=0A= temp =3D gets(PS)=0A= =0A= end while=0A= =0A= =0A= while 1 do=0A= =0A= if compare(PS, 'a') =3D 0 then=0A= abort(42)=0A= =0A= elsif compare(PS,'h') =3D 0 then=0A= puts(1,"Hello")=0A= end if=0A= =0A= end while=0A= =0A= =0A= ------=_NextPart_000_003F_01C1B6D5.25DCC840 Content-Type: application/octet-stream; name="Abort.ewl" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="Abort.ewl" >va=0A= ------=_NextPart_000_003F_01C1B6D5.25DCC840 Content-Type: application/octet-stream; name="input.e" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="input.e" without warning=0A= =0A= constant KEYBOARD =3D 0,=0A= SCREEN =3D 1,=0A= ERROR =3D 2=0A= =0A= constant TRUE =3D 1=0A= constant WHITE_SPACE =3D " \t\n"=0A= constant FORM_FEED =3D 12=0A= =0A= global function user_input()=0A= -- get user input from keyboard=0A= object line=0A= =0A= while TRUE do=0A= line =3D gets(KEYBOARD)=0A= if sequence(line) then=0A= -- delete any leading whitespace=0A= while find(line[1], WHITE_SPACE) do=0A= line =3D line[2..length(line)]=0A= if length(line) =3D 0 then=0A= exit=0A= end if=0A= end while=0A= if length(line) > 0 then=0A= exit=0A= end if=0A= end if=0A= puts(SCREEN, "\n? ")=0A= end while=0A= -- delete trailing whitespace=0A= while find(line[length(line)], WHITE_SPACE) do=0A= line =3D line[1..length(line)-1]=0A= end while=0A= return line=0A= end function=0A= ------=_NextPart_000_003F_01C1B6D5.25DCC840--
2. Re: Ewl
- Posted by Mark Brown <mabrown at SENET.COM.AU> Feb 16, 2002
- 473 views
This is a multi-part message in MIME format. ------=_NextPart_000_0011_01C1B750.72A3F920 boundary="----=_NextPart_001_0012_01C1B750.72A3F920" ------=_NextPart_001_0012_01C1B750.72A3F920 charset="iso-8859-1" Hi Philip, I assume you are trying to get your program to work with the "abort.ewl" file that came with your email using something like..... ex ewl.ex abort.ewl I have made a couple of small changes to your code which allows the program to get to the end. At the end it gets stuck in an endless while which I have left as it is as I am not sure what you are trying to achieve. If it isn't doing what you want, please let us know and include a bit more info such as what your command line is when you run the program and what your end result is meant to be. All the best, Mark ----- Original Message ----- From: Philip Mullen To: EUforum Sent: Saturday, February 16, 2002 9:31 PM Subject: Ewl ============ The Euphoria Mailing List ============ Hello, for the last couple of days i have been working with the euphoria gets command as i am trying ti see how easy it is to create my own langugae, it is extremly limited but i just want to try, But I can't seem to get the program to read in the command and then take the proper action, if any one out there can see why could they send me an ammended version and the notes to how they did it? ==^================================================================ This email was sent to: mabrown at SENET.COM.AU EASY UNSUBSCRIBE click here: http://topica.com/u/?b1dd66.b2mr14 Or send an email to: EUforum-unsubscribe at topica.com T O P I C A -- Register now to manage your mail! http://www.topica.com/partner/tag02/register ==^================================================================ ------=_NextPart_001_0012_01C1B750.72A3F920 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 8bit <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 5.50.4207.2601" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#fffff0> <DIV><FONT face=Arial size=2>Hi Philip,</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>I assume you are trying to get your program to work with the</FONT></DIV> <DIV><FONT face=Arial size=2>"abort.ewl" file that came with your email using something like.....</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>ex ewl.ex abort.ewl</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>I have made a couple of small changes to your code which </FONT></DIV> <DIV><FONT face=Arial size=2>allows the program to get to the end. At the end it gets </FONT></DIV> <DIV><FONT face=Arial size=2>stuck in an endless while which I have left as it is as I am</FONT></DIV> <DIV><FONT face=Arial size=2>not sure what you are trying to achieve.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>If it isn't doing what you want, please let us know and include </FONT></DIV> <DIV><FONT face=Arial size=2>a bit more info such as what your command line is when </FONT></DIV> <DIV><FONT face=Arial size=2>you run the program and what your end result is meant to be.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>All the best,</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Mark</FONT></DIV> <BLOCKQUOTE dir=ltr style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"> <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV> <DIV style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> <A title=PETER at pmullen.fsnet.co.uk href="mailto:PETER at pmullen.fsnet.co.uk">Philip Mullen</A> </DIV> <DIV style="FONT: 10pt arial"><B>To:</B> <A title=EUforum at topica.com href="mailto:EUforum at topica.com">EUforum</A> </DIV> <DIV style="FONT: 10pt arial"><B>Sent:</B> Saturday, February 16, 2002 9:31 PM</DIV> <DIV style="FONT: 10pt arial"><B>Subject:</B> Ewl</DIV> <DIV><BR></DIV><PRE>============ The Euphoria Mailing List ============ </PRE> <DIV><FONT face=Arial size=2>Hello, for the last couple of days i have been working with the euphoria gets command as i am trying ti see how easy it is to create my own langugae, it is extremly limited but i just want to try, But I can't seem to get the program to read in the command and then take the proper action, if any one out there can see why could they send me an ammended version and the notes to how they did it?</FONT></DIV><PRE>==^================================================================ This email was sent to: mabrown at SENET.COM.AU EASY UNSUBSCRIBE click here: <A href="http://topica.com/u/?b1dd66.b2mr14">http://topica.com/u/?b1dd66.b2mr14</A> Or send an email to: EUforum-unsubscribe at topica.com T O P I C A -- Register now to manage your mail! <A href="http://www.topica.com/partner/tag02/register">http://www.topica.com/partner/tag02/register</A> ------=_NextPart_001_0012_01C1B750.72A3F920-- ------=_NextPart_000_0011_01C1B750.72A3F920 Content-Type: application/octet-stream; name="Ewl.ex" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="Ewl.ex" include get.e=0A= include machine.e=0A= include sort.e=0A= include wildcard.e=0A= include input.e=0A= =0A= with trace=0A= =0A= sequence command=0A= =0A= puts(1,"Do you wish to trace ? (Y) / (N):\n ")=0A= command =3D upper(user_input())=0A= =0A= --if 'Y' =3D command[1] then=0A= -- trace(1)=0A= --end if=0A= --=0A= --if 'Y' =3D command[1] then=0A= -- trace(1)=0A= --=0A= --elsif 'N' =3D command[1] then=0A= -- trace(0)=0A= --end if=0A= =0A= =0A= =0A= if command[1] =3D 'Y' then=0A= trace(1)=0A= elsif command[1] =3D 'N' then=0A= trace(0)=0A= end if=0A= =0A= =0A= =0A= =0A= object temp=0A= temp =3D command_line()=0A= =0A= if length(temp) <=3D 2 then=0A= puts(1,"No program file selcted, Aborting")=0A= abort(42)=0A= end if=0A= =0A= sequence runfile,PS=0A= atom file=0A= =0A= PS =3D {}=0A= =0A= runfile =3D temp[3]=0A= file =3D open(runfile,"r")=0A= =0A= if file =3D -1 then=0A= printf(1,"%s does not exist, or you have got the wrong path",{runfile})=0A= abort(42)=0A= end if=0A= =0A= --temp =3D gets(file)=0A= =0A= while not atom(temp) do=0A= temp =3D gets(file)=0A= PS =3D append(PS, temp)=0A= --temp =3D gets(PS)=0A= end while=0A= =0A= =0A= while 1 do=0A= if compare(PS, 'a') =3D 0 then=0A= abort(42)=0A= elsif compare(PS,'h') =3D 0 then=0A= puts(1,"Hello")=0A= end if=0A= end while=0A= =0A= =0A= ------=_NextPart_000_0011_01C1B750.72A3F920--
3. Re: Ewl
- Posted by Philip Mullen <PETER at pmullen.fsnet.co.uk> Feb 16, 2002
- 481 views
This is a multi-part message in MIME format. ------=_NextPart_000_0049_01C1B71D.47419720 charset="iso-8859-1" ----- Original Message ----- From: Mark Brown To: EUforum Sent: Saturday, February 16, 2002 2:14 PM Subject: Re: Ewl Hi Philip, I assume you are trying to get your program to work with the "abort.ewl" file that came with your email using something like..... ex ewl.ex abort.ewl I have made a couple of small changes to your code which allows the program to get to the end. At the end it gets stuck in an endless while which I have left as it is as I am not sure what you are trying to achieve. If it isn't doing what you want, please let us know and include a bit more info such as what your command line is when you run the program and what your end result is meant to be. All the best, Mark Thanxs mark, you were correct about the command line parameters. And about the final loop, Whats ment to happen is that the interpreter take the PS variable and runs it throught the loop trying to find a match to the PS and then follows an action, like if the PS virable was A then the program would end. This is the meaning of the Abort.ewl file ------=_NextPart_000_0049_01C1B71D.47419720 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 8bit <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 5.50.4134.600" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#fffff0> <DIV><FONT face=Arial size=2></FONT> </DIV> <BLOCKQUOTE dir=ltr style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"> <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV> <DIV style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> <A title=mabrown at SENET.COM.AU href="mailto:mabrown at SENET.COM.AU">Mark Brown</A> </DIV> <DIV style="FONT: 10pt arial"><B>To:</B> <A title=EUforum at topica.com href="mailto:EUforum at topica.com">EUforum</A> </DIV> <DIV style="FONT: 10pt arial"><B>Sent:</B> Saturday, February 16, 2002 2:14 PM</DIV> <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: Ewl</DIV> <DIV><BR></DIV><PRE>============ The Euphoria Mailing List ============ </PRE> <DIV><FONT face=Arial size=2>Hi Philip,</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>I assume you are trying to get your program to work with the</FONT></DIV> <DIV><FONT face=Arial size=2>"abort.ewl" file that came with your email using something like.....</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>ex ewl.ex abort.ewl</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>I have made a couple of small changes to your code which </FONT></DIV> <DIV><FONT face=Arial size=2>allows the program to get to the end. At the end it gets </FONT></DIV> <DIV><FONT face=Arial size=2>stuck in an endless while which I have left as it is as I am</FONT></DIV> <DIV><FONT face=Arial size=2>not sure what you are trying to achieve.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>If it isn't doing what you want, please let us know and include </FONT></DIV> <DIV><FONT face=Arial size=2>a bit more info such as what your command line is when </FONT></DIV> <DIV><FONT face=Arial size=2>you run the program and what your end result is meant to be.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>All the best,</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Mark</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Thanxs mark, you were correct about the command line parameters.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>And about the final loop, Whats ment to happen is that the interpreter take the PS variable and runs it throught the loop trying to find a match to the PS and then follows an action, like if the PS virable was A then the program would end. This is the meaning of the Abort.ewl ------=_NextPart_000_0049_01C1B71D.47419720--
4. Re: Ewl
- Posted by Derek Parnell <ddparnell at bigpond.com> Feb 16, 2002
- 500 views
Philip, I've inserted an updated version of ewl.ex here. The main two changes were that I used 'concatenate' rather than 'append' to join the instructions from the file together, secondly, I introduced an instruction pointer to be used as an index into the sequence holding the instructions. -------- include get.e include machine.e include sort.e include wildcard.e include input.e with trace sequence command puts(1, "Do you wish to trace ? (Y) / (N):\n ") command = upper(user_input()) if 'Y' = command[1] then trace(1) end if if 'Y' = command[1] then trace(1) elsif 'N' = command[1] then trace(0) end if object temp temp = command_line() if length(temp) <= 2 then puts(1,"No program file selcted, Aborting") abort(42) end if sequence runfile,PS atom file PS = {} runfile=temp[3] file= open(runfile,"r") if file = -1 then printf(1,"%s does not exist, or you have got the wrong path",{runfile}) abort(42) end if temp = gets(file) while not atom(temp) do -- Concatenate rather than append PS &= temp temp = gets(file) end while integer ip -- This is the "instruction pointer" -- Set to start at the first instruction. ip = 1 -- This loops until there are no more instructions. -- Each iteration looks at ONE instruction. -- When the instruction is identified, it is executed -- and the IP is updated to point to the next instruction to execute. while ip <= length(PS) do if compare(PS[ip], 'a') = 0 then abort(42) elsif compare(PS[ip],'h') = 0 then puts(1,"Hello") ip += 1 else ip += 1 end if end while ---------- cheers, Derek ----- Original Message ----- From: Philip Mullen To: EUforum Sent: Saturday, February 16, 2002 9:31 PM Subject: Ewl Hello, for the last couple of days i have been working with the euphoria gets command as i am trying ti see how easy it is to create my own langugae, it is extremly limited but i just want to try, But I can't seem to get the program to read in the command and then take the proper action, if any one out there can see why could they send me an ammended version and the notes to how they did it?