03:53:36
##forth
<rendar>
hi KipIngram
06:21:14
##forth
<MrMobius>
KipIngram: do you end up redoing a lot of stack juggling then?
06:21:31
##forth
<MrMobius>
like you were processing 4 things in a loop and have to go back and add a 5th
06:26:17
##forth
<tpbsd>
MrMobius, I find I dont have to as each word is unique when designed, and I never have to go back to it after the embedded project is finished
06:27:19
##forth
<tpbsd>
if a word needs 5 and not 4 items on the stack, that will all happen within the word design at the time
06:27:37
##forth
<MrMobius>
I think that works ok for simple things but if there's any complexity, refactoring is a normal part of writing software
06:27:52
##forth
<MrMobius>
Combining two things you though initially though should be separate or vice versa
06:31:19
##forth
<MrMobius>
or maybe just rewrite the word rather than modify it
06:40:21
##forth
<tpbsd>
MrMobius, yeah refactoring is a major interest, but real world enbedded project words are always very simple, especially when short
06:43:27
##forth
<tpbsd>
for instance this is my thermometer Word that converts counted pulses to degrees C
06:43:30
##forth
<tpbsd>
: degrees.c? (count -- C ) \ convert lmt01.count to degC, Temp (C) = ((count/4096) *256) -50
06:43:30
##forth
<tpbsd>
0 swap \ convert numbers to s31.32 and calculate
06:43:31
##forth
<tpbsd>
0 4096 f/
06:43:31
##forth
<tpbsd>
;
06:44:03
##forth
<tpbsd>
it's boringly simple, there is no need to make it faster or smaller
06:44:19
##forth
<tpbsd>
and the output is fixed point
06:44:48
##forth
<tpbsd>
here it is reading the temp right now: t 32,3 C 90,1 F ok.
06:44:57
##forth
<ghodawalaaman_>
Hello o/
06:45:16
##forth
<tpbsd>
hello ghodawalaaman_
06:45:24
##forth
<ghodawalaaman_>
:D
06:47:52
##forth
<tpbsd>
MrMobius, I could refactor a lot, but why ? the thermometer is about 1k in a 64k mcu that cost $0.60, the Mecrisp-Stellaris is about 20k, so I still have about 30Kb left that will never get used
06:48:29
##forth
<tpbsd>
and the 1k is mainly that long because it's a prototype and has a lot of unused stuff in it
06:48:54
##forth
<ghodawalaaman_>
can someone link me to the smallest forth specification?
06:49:31
##forth
<ghodawalaaman_>
I am creating a forth interpreter that's why I am asking...
06:52:30
##forth
<tpbsd>
MrMobius, it's very unusual for me to need to worry about >2 items on the stack in one word
07:05:06
##forth
<ghodawalaaman_>
nice, Thanks
07:05:33
##forth
<ghodawalaaman_>
DKordic: maybe I should implement some old specification of forth
07:05:37
##forth
<ghodawalaaman_>
it will be easier IMO
07:07:22
##forth
<DKordic>
ghodawalaaman_: I would not recomend that. Start with Dave Gauer's page.
07:08:18
##forth
<ghodawalaaman_>
this one?
07:09:14
##forth
<DKordic>
""Implementing Forth"". That one is inspiring, and it can wait.
07:09:38
##forth
<DKordic>
The essence of Forth is composition of functions. Concatenation of machine code is also composition of their functions.
07:17:12
##forth
<DKordic>
ghodawalaaman_: def swap(*D, **W): OK(D[1], D[0], *D[2:], **W)
07:17:45
##forth
<ghodawalaaman_>
it's forth?
07:17:46
##forth
<ghodawalaaman_>
:o
07:18:04
##forth
<DKordic>
Yes!
07:18:28
##forth
<ghodawalaaman_>
now I think I might not be able to implement all of it
07:18:29
##forth
<ghodawalaaman_>
maybe
07:18:31
##forth
<ghodawalaaman_>
I don't know
07:20:33
##forth
<DKordic>
def to(V, *D, **W): W[name()] = V; return OK(*D, **W)
07:21:10
##forth
<DKordic>
All of what?
07:22:19
##forth
<ghodawalaaman_>
all of the feature of forth
07:23:39
##forth
<DKordic>
I understand You might feel intimidated. IMHO any effort will be well worth it.
07:24:04
##forth
<ghodawalaaman_>
Thanks :)
07:24:44
##forth
<DKordic>
What are You seeking?
07:25:04
##forth
<DKordic>
W/Cognitive_closure ?
07:25:18
##forth
<ghodawalaaman_>
wdym?
07:25:57
##forth
<DKordic>
Why are You interested in implementing Forth?
07:26:27
##forth
<ghodawalaaman_>
because it's really interesting language
07:26:38
##forth
<DKordic>
For me it showed that Python and C are far more difficult than it needs to be.
07:27:10
##forth
<ghodawalaaman_>
that's true, it depends which type of programming you like
07:27:33
##forth
<ghodawalaaman_>
btw do I keep the function name case-sesitive or not?
07:28:31
##forth
<DKordic>
I don't see that as a question ;) . Case sensitive of course.
07:28:59
##forth
<ghodawalaaman_>
okay okay :D
07:29:34
##forth
<ghodawalaaman_>
so basically now the user of my compiler can define their own DuP or dUP or dup
07:29:55
##forth
<ghodawalaaman_>
only DUP all capital will be the built-in function
07:30:00
##forth
<ghodawalaaman_>
other function will be use defined
07:30:14
##forth
<DKordic>
As well as "": 13 17 19 ;"".
07:30:43
##forth
<ghodawalaaman_>
nooo, it will make it harder
07:31:18
##forth
<ghodawalaaman_>
or wait maybe I can do it?
07:38:07
##forth
<DKordic>
Even gforth has case-insensitive, as well as case-sensitive, Namespaces. I haven't seen anyone do it... Wouldn't it be clever to make base 10 and 16 number literals their own dictionaries (or how should we call it)?
07:40:32
##forth
<DKordic>
ghodawalaaman_: "": swap : ToS [ Literal ] ; : NoS [ Literal ] ; ToS NoS ;""? Would this be a good test for Your (Forth) system?
07:41:08
##forth
<ghodawalaaman_>
yeah, but currenly it only support +,-,*,/
07:41:13
##forth
<ghodawalaaman_>
and dup and MOD
07:41:23
##forth
<ghodawalaaman_>
I have made is case sensitive
07:42:22
##forth
<DKordic>
Are You aware of the idea of ""Maxwell's Equations of Software""?
07:44:16
##forth
<ghodawalaaman_>
I am making a very very long switch case, it's not ideal no?
07:44:24
##forth
<ghodawalaaman_>
let me googe it
07:45:17
##forth
<MrMobius>
I wouldn't worry too much about making it ideal of it's your first try :)
07:45:43
##forth
<ghodawalaaman_>
yeah :D
07:52:07
##forth
<DKordic>
In Python Variables (local, and nonlocal (including module)) are implemented through chained Hash Tables.
07:53:36
##forth
<ghodawalaaman_>
if I implement all of core function then my language will be turing complete right?
07:53:41
##forth
<DKordic>
From Python FAQ["Where is Switch Statement"]: ""{True: yes, False: no}[test()]()"".
07:53:58
##forth
<DKordic>
W/Turing_tarpit
07:54:17
##forth
<ghodawalaaman_>
wdym?
07:55:02
##forth
<DKordic>
IMHO Forth "'Standards"" are a waste of time.
07:55:54
##forth
<DKordic>
Even R{5,6,7}RS is disappointing.
07:57:17
##forth
<ghodawalaaman_>
umm
07:57:33
##forth
<ghodawalaaman_>
DKordic: can you link me to a specification which is easy to implement?
08:00:30
##forth
<ghodawalaaman_>
also forth gives us the ability to store variable
08:00:35
##forth
<ghodawalaaman_>
I don't know how to handle that case?
08:04:50
##forth
<DKordic>
By updating Hash Table (or how ever we shall call it)?
08:06:50
##forth
<ghodawalaaman_>
DKordic: yeah but that doesn't look cool, you know what I mean :p
08:07:22
##forth
<DKordic>
Sorry, which parts exactly. I might agree.
08:07:55
##forth
<ghodawalaaman_>
I mean, if I show the user/developer 1,2,3 etc integer instead of 0x28943723aa address then they might not like it
08:09:21
##forth
<DKordic>
I am not following... Address of what? What are ""1,2,3""?
08:10:10
##forth
<ghodawalaaman_>
if we store the data as HashTable then the key will be 1,2,3 etc instead any random number.... oh wait we can have a random number as key
08:10:12
##forth
<ghodawalaaman_>
hmmm
08:11:46
##forth
<DKordic>
Lua is opsessed with HTs. There might be more appropriate DS.
08:15:10
##forth
<ghodawalaaman_>
what do I do
08:15:13
##forth
<ghodawalaaman_>
I am so confused
08:15:20
##forth
<ghodawalaaman_>
HashTable seems like a good idea
08:15:20
##forth
<DKordic>
Why?
08:15:41
##forth
<ghodawalaaman_>
what do you suggest? please tell me something
08:15:51
##forth
<DKordic>
It is a broad concept. It's special case might as well be linked list.
08:16:36
##forth
<ghodawalaaman_>
hmm, let me think
08:17:00
##forth
<DKordic>
Find simple things to begin with.
08:17:30
##forth
<ghodawalaaman_>
can I get address of a list variable in c#
08:17:40
##forth
<DKordic>
I lost the link... Challenge is most rewarding whrn it is not far above or bellow one's current competence.
08:17:58
##forth
<ghodawalaaman_>
yeah that's true
08:18:13
##forth
<ghodawalaaman_>
implementing forth is neither above or below my skill level
08:33:54
##forth
<ghodawalaaman_>
DKordic: I just realized something
08:34:04
##forth
<ghodawalaaman_>
the tokenizer function I am using is very naive
08:34:13
##forth
<ghodawalaaman_>
I can't parse ."hello world"
08:34:16
##forth
<ghodawalaaman_>
it will think it like
08:34:19
##forth
<ghodawalaaman_>
."hello
08:34:20
##forth
<ghodawalaaman_>
world"
08:43:30
##forth
<DKordic>
That is why there is whitespace after ."
08:43:42
##forth
<DKordic>
And similar words.
08:51:28
##forth
<ghodawalaaman_>
DKordic: okay so I won't need a lexer or anything
08:51:32
##forth
<ghodawalaaman_>
that's cool!
10:55:54
##forth
<ghodawalaaman_>
I am going mad parsing forth lol
10:55:58
##forth
<ghodawalaaman_>
I underestimated it
11:02:45
##forth
<MrMobius>
what part are you stuck on?
11:04:59
##forth
<ghodawalaaman_>
I think I solved it \o/
11:05:09
##forth
<ghodawalaaman_>
MrMobius: could you give me a test string to see if it works or not
11:05:18
##forth
<ghodawalaaman_>
I still have to parse function
11:05:24
##forth
<MrMobius>
1 2 3 swap drop
11:05:32
##forth
<ghodawalaaman_>
okay
11:05:45
##forth
<ghodawalaaman_>
const string code = ".\" aman\n10 10 - . \" 10 \n 10 \n + .";
11:05:56
##forth
<ghodawalaaman_>
this worked as expected
11:06:15
##forth
<ghodawalaaman_>
MrMobius: I will share the code once it's ready, then we can discuss on the issue
11:06:22
##forth
<ghodawalaaman_>
for now I have created a workaround
13:23:52
##forth
<ghodawalaaman>
delgnam: welcome to forth o/
13:24:14
##forth
<ghodawalaaman>
everyone welcome delgnam, he is new to ##forth language :D
13:24:31
##forth
<delgnam>
Hi o/ ghodawalaaman invited me here.
13:42:48
##forth
<DKordic>
Welcome. Glad to see that.
13:43:22
##forth
<ajhidd2>
o/
13:43:47
##forth
<delgnam>
\o DKordic , ajhidd2
13:44:54
##forth
<DKordic>
ghodawalaaman: I guess You are not familiar with ""mk-counter"" example. It is very elegant. It shows the connection between Objects and Subroutines (hopefully functions).
13:46:07
##forth
<ghodawalaaman>
yeah, also it's been some time since I last touched forth language
16:07:07
##forth
<KipIngram>
delgnam: Welcome to Forth and to ##forth. Hope you enjoy learning the language!
16:11:17
##forth
<delgnam>
thanks KipIngram
17:54:02
##forth
<ghodawalaaman>
Hello o/
17:54:20
##forth
<ghodawalaaman>
how many context can forth have?
17:54:36
##forth
<ghodawalaaman>
public enum Context { Number, Comment, PrintString, Name, IfElse, DoWhile, }
17:55:06
##forth
<ghodawalaaman>
I can only think of these ones
21:00:28
##forth
<KipIngram>
ghodawalaaman: I don't generally think of it that way - most of those things don't really correspond to what I would call a "context" - as far as the compiler is concerned it's just executing words. For example, comments of the ( ...) form are just handled by the ( word. IF ... THEN just gets handled by the immediate words IF and THEN; the compiler just looks them up and executes them (since
21:00:30
##forth
<KipIngram>
they're immediate) the same way it does everything else. Communication between then is handled via the stack, but the compiler itself is oblivious to that communication.
21:01:07
##forth
<KipIngram>
One of the things that makes Forth so simple and easy to implement is that the compiler doesn't get complicated by trying to handle diverse things like that.