Making your own programming language...
Making your own programming language...
I've always been interested in making my own programming language, but... where would I start. If you wanted to make your own custom programming language, what would you use to make it? Another language? That's where I've always come to a slump...Any answers will help very much.
Re:Making your own programming language...
This is sort of related to what I need help with. I have been writing a flatfile driver, that uses mysql queries to do stuff.
Now, what I need to figure out is how to "interpret" this part of the query as if it where a language:
WHERE ((cat_id=board_cat && board_id='1') || (board_name='Test'))
As you can see it is sort of like an if statment.
If ((cat_id=board_cat && board_id='1') || (board_name='Test')) {
// Select this row because it is in the where clause.
}
Not exactly sure how to parse something like this though. Oh and I am writing this in PHP incase it helps.
Now, what I need to figure out is how to "interpret" this part of the query as if it where a language:
WHERE ((cat_id=board_cat && board_id='1') || (board_name='Test'))
As you can see it is sort of like an if statment.
If ((cat_id=board_cat && board_id='1') || (board_name='Test')) {
// Select this row because it is in the where clause.
}
Not exactly sure how to parse something like this though. Oh and I am writing this in PHP incase it helps.
Re:Making your own programming language...
Tim, that's really confusing lol. I got turbo pascal like it said, but whenever I put in the code he said to, it got errors. You think he wrote the coding wrong? The coding's on the intro part if you want to look at it.
Re:Making your own programming language...
there is nothing wrong with crenshaws code. its just old.
i got it all working in C a few years back when I looked over the crenshaw notes...
i got it all working in C a few years back when I looked over the crenshaw notes...
-- Stu --
Re:Making your own programming language...
write it in php and have php execute the contents of a string variable??Chris Cromer wrote: This is sort of related to what I need help with. I have been writing a flatfile driver, that uses mysql queries to do stuff.
Now, what I need to figure out is how to "interpret" this part of the query as if it where a language:
WHERE ((cat_id=board_cat && board_id='1') || (board_name='Test'))
As you can see it is sort of like an if statment.
If ((cat_id=board_cat && board_id='1') || (board_name='Test')) {
// Select this row because it is in the where clause.
}
Not exactly sure how to parse something like this though. Oh and I am writing this in PHP incase it helps.
i dont really get what your trying to do.. sounds like your trying to workaround for a lack of triggers + stored procedures in mysql...
-- Stu --
Re:Making your own programming language...
Yeah, the code's just written with Turbo Pascal 4... Try Free Pascal, the code works perfectly with it.CrYpTiC wrote: Tim, that's really confusing lol. I got turbo pascal like it said, but whenever I put in the code he said to, it got errors. You think he wrote the coding wrong? The coding's on the intro part if you want to look at it.
Re:Making your own programming language...
I can't execute the contents of it, because it uses a different system. For instance var=var2 while in php it would be var==var2 so the differences in language would cause it to not be possible.df wrote:write it in php and have php execute the contents of a string variable??Chris Cromer wrote: This is sort of related to what I need help with. I have been writing a flatfile driver, that uses mysql queries to do stuff.
Now, what I need to figure out is how to "interpret" this part of the query as if it where a language:
WHERE ((cat_id=board_cat && board_id='1') || (board_name='Test'))
As you can see it is sort of like an if statment.
If ((cat_id=board_cat && board_id='1') || (board_name='Test')) {
// Select this row because it is in the where clause.
}
Not exactly sure how to parse something like this though. Oh and I am writing this in PHP incase it helps.
i dont really get what your trying to do.. sounds like your trying to workaround for a lack of triggers + stored procedures in mysql...
Plus I have to worry about fields from other tables as well as data.
I am building my own database system in php. It's a flatfile system that uses mysql queries to write/read flat files on the server.
Re:Making your own programming language...
so your writing a flatfile system and you need a SQL parser right??
good luck there.. SQL is a complex language.
the first database i ever remeber using was a flatfile system..
PC-File, the first shareware program ever.. circa 1981 or somegthing... i dunno. early 80's.
i started writeing my own DB system i still have some of it here somewhere. 64bit journaled goodness in C.
good luck there.. SQL is a complex language.
the first database i ever remeber using was a flatfile system..
PC-File, the first shareware program ever.. circa 1981 or somegthing... i dunno. early 80's.
i started writeing my own DB system i still have some of it here somewhere. 64bit journaled goodness in C.
-- Stu --
Re:Making your own programming language...
Yeah basically, an SQL parser is what I need to parse the WHERE clause of the queries.
I think my biggest challenge will be queries like this one:
This query has JOINS, WHERE, LIMIT, and ORDER BY as well as selects data from multiple tables and compares them... so this is going to be a very daunting task to do.
I think my biggest challenge will be queries like this one:
Code: Select all
SELECT c.*, b.*, t.*, m.real_name, m.display_name, m.groups, l.real_name AS last_real_name, l.display_name AS last_display_name, l.groups AS last_groups, r.topic, r.log_time, r2.board, r2.mark_read FROM cbb_categories AS c, cbb_boards AS b, cbb_topics AS t, cbb_members AS m, cbb_members AS l LEFT JOIN cbb_mark_read AS r ON (r.userid='2' && r.topic=t.topic_id && r.type='1') LEFT JOIN cbb_mark_read AS r2 ON (r2.userid='2' && r2.board='9' && r2.type='0') WHERE (c.cat_id=b.board_cat && b.board_id='9' && t.topic_board=b.board_id && m.member_id=t.first_member_id && l.member_id=t.last_member_id) ORDER BY t.sticky DESC, t.post_time DESC LIMIT 0,15
Re:Making your own programming language...
have you looked at other flatfile systems? dbase? etc
-- Stu --
Re:Making your own programming language...
No I haven't... link please?
EDIT: Found dbase... not what I need though. Any other flat file systems? :-\
EDIT: Found dbase... not what I need though. Any other flat file systems? :-\
Re:Making your own programming language...
DBM is or was a flatfile type system.
i dont know of any flatfile system that is relational, most are non relational single table type beasts.
any reason you cant use a standard DB for whatever your trying to do??
i dont know of any flatfile system that is relational, most are non relational single table type beasts.
any reason you cant use a standard DB for whatever your trying to do??
-- Stu --
Re:Making your own programming language...
Well I was making this for distribution with CBB, that way people could use flatfile if they don't have a real database(such as mysql).
I won't be using it myself, but wanted the option to be available for people.
I won't be using it myself, but wanted the option to be available for people.
Re:Making your own programming language...
i think, if they are going to have a minimum php of 4.3.2 or something you can expect them to have mysql at least?
-- Stu --