Jump to content


Check out our Community Blogs

Firebird_38

Member Since 01 Aug 2008
Offline Last Active Apr 15 2013 03:35 PM
-----

Topics I've Started

Compiler

12 September 2010 - 01:47 PM

Hey I wanna make a compiler that compiles pascal (preferable delphi flavor, with some added stuffs) into PHP and Java (depending on whether it'll run on a client or a server, of course...).

So, instead of making a scanner and a parser and so forth, is therew any code available that'll spit out an AST? That'd be nice.

I know that there's the FreePascal source (handy dandy!), but I see no AST being produced there...

Th reason I want this is because, well, I'm sick and tired of having to program in languages that don't have compile time type checking (like PHP and Java, where you don't know anything is wrong until you've installed it and are testing it).

Besides, it'd be nice if you could write:


 
procedure TMyWebApp.Init; [client]
begin
...
UserNameEdit.OnExit:=CheckAvail;
...
end;
 
procedure TMyWebApp.CheckAvail; [client]
begin
 if not UserAvail(UserNameEdit.Text) then
  begin
   ShowMessage('That username you can''t have!');
   UserNameEdit.Focus;
  end;
end;
 
function TMyWebApp.UserAvail(name:String):Boolean; [server]
begin
 result:=dbquery('SELECT Count(*) FROM users WHERE name=%1',[name])[0].value=0;
end;

Seems pretty cool, don't it?

This would be translated for you... with AJAX and stuff. (Yay!)

Client:
<script language="javascript">
function Init() {
 
 GetObj("UserNameEdit").OnExit=CheckAvail;
 
}
 
function CheckAvail() {
 if (AjaxCall("UserAvail",GetObj("UserNameEdit").Text)) {
   window.alert('That username you can''t have!');
   GetObj("UserNameEdit").Focus;
  }
}
</script>

Or something like that...

And the server:

function TMyWebApp_UserAvail($name) {
 return=(dbquery('SELECT Count(*) FROM users WHERE name=%1',[$name])[0]->value==0);
end;

Something like this...

But details need to be worked out... Anyone else see the benefits? 1 unified language to work with... built in database access framework in OODBMS style (preferable anyway), security (preferred also), and support for a host of environments (flash actionscript, html, java, cell phones and EVEN win32 apps!) all in one language, one environment, from 1 source.

Compile for target (here it's the LAMP target :)) and go!

Debugging support would be nice too... Yeah, it all needs some work (10000 man-hours worth) but it would be great! YOU would want a copy!

I think...

And please don't say I should go with C++ as the source language. That will be a target, not a source (as C++ is notoriously hard to read (and write) and produces the buggiest programs (ie windows) ever (with buffer overrun vulnerabilities, any1 hear that before?).

So, pascal it is.

Anyway, I figured I'd put it out there if someone has some input or comments...

Please help! My Teachers needs this in the morning!

23 April 2010 - 05:08 AM

I need program that does make database and save it into the computer and has to sort it things! Quickly!

Must use "functions" whats functions?

Thank!
--Newbie, 1 post

Does anyone else find this disturbing? Why on earth should we be doing their homework? And then to say "please help... need it tmorrow!"

Yeah, well, I'm assuming you've done this course for a few months now and it seems you're a little late taking your first peek at it. You'll be failing...
And please, can you write coherent sentences? It's hard enough to be figuring out what you're trying to get us to do if you write in non-gibberish...

Just a pet peeve... I guess it's never going to change...

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download