Page 1 of 3
Making your own programming language...
Posted: Fri Jun 06, 2003 2:30 pm
by CrYpTiC
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...
Posted: Fri Jun 06, 2003 2:53 pm
by Tim
Re:Making your own programming language...
Posted: Fri Jun 06, 2003 3:02 pm
by AGI1122
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.
Re:Making your own programming language...
Posted: Sat Jun 07, 2003 12:59 pm
by CrYpTiC
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...
Posted: Sat Jun 07, 2003 4:47 pm
by df
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...
Re:Making your own programming language...
Posted: Sat Jun 07, 2003 4:49 pm
by df
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.
write it in php and have php execute the contents of a string variable??
i dont really get what your trying to do.. sounds like your trying to workaround for a lack of triggers + stored procedures in mysql...
Re:Making your own programming language...
Posted: Sun Jun 08, 2003 4:14 am
by Eero Ränik
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.
Yeah, the code's just written with Turbo Pascal 4... Try Free Pascal, the code works perfectly with it.
Re:Making your own programming language...
Posted: Sun Jun 08, 2003 5:31 am
by AGI1122
df wrote:
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.
write it in php and have php execute the contents of a string variable??
i dont really get what your trying to do.. sounds like your trying to workaround for a lack of triggers + stored procedures in mysql...
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.
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...
Posted: Sun Jun 08, 2003 7:00 am
by df
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.
Re:Making your own programming language...
Posted: Sun Jun 08, 2003 7:09 am
by AGI1122
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:
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
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.
Re:Making your own programming language...
Posted: Sun Jun 08, 2003 11:31 am
by df
have you looked at other flatfile systems? dbase? etc
Re:Making your own programming language...
Posted: Sun Jun 08, 2003 11:35 am
by AGI1122
No I haven't... link please?
EDIT: Found dbase... not what I need though. Any other flat file systems? :-\
Re:Making your own programming language...
Posted: Sun Jun 08, 2003 3:53 pm
by df
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??
Re:Making your own programming language...
Posted: Sun Jun 08, 2003 4:05 pm
by AGI1122
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.
Re:Making your own programming language...
Posted: Mon Jun 09, 2003 1:09 am
by df
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?