Jump to content


  • Content Count

  • Joined

  • Last visited

  1. I see - fascinating! And thank you for a detailed and well thought out answer. I have an interest in such things because I myself have written a Pascal like compiler - from scratch. Well, it will eventually be a compiler when it is capable of actually generating object code. At present it only reads in a program and creates a tree out of objects. The constructor of each object reads in the program and creates sub objects that mirror the recursive structure of the program and resolving procedure, function calls and variable references along the way. It uses the shunting yard algorithm for constructing expressions. The tree is executable, and at present I'm using it as a simplified scripting language as a machinery control front end. I say simplified in that it is even more "wordy" than actual Pascal - i.e. many operators that are usually single character symbols can optionally be replaced with words. So a program can almost read like plain English for the benefit of the typical non programmer machine operators that use it... I also built in a feature where it can store its stack in a disc backed file so that it can resume execution after a power or computer failure etc. - that's useful in India where there are plenty of unpredictable power failures. The tree also stores pointers back to the corresponding source which allows the execution to be viewed in realtime etc. At present it only has 4 data types (Boolean, Integer, Real and String), and arrays - no type definitions or records yet. Variables can have read and write functions and procedures associated with them - so reading and writing to variables can have side effects - similar to properties. My eventual plan for that (mainly out of fascination with this sort of thing) is to extend it to output arbitrary assembler or machine code by using itself as a backend generator - i.e. the definition of the target CPU or assembler would itself be written in the language - allowing easy extension to new CPUs and differing architectures etc. I mainly view it as an interesting hobby - certainly nothing that hasn't been done before!
  2. Since you've answered my question I wonder if I can ask an off topic question - out of interest. I've read that the compiler compiles from Smart Pascal to human readable JavaScript. But I have also read that it recreates all the OOP capabilities of Smart Pascal by creating VMTs directly. Since JavaScript works by sending source code to browsers - and then the browser either interprets or compiles the JavaScript, surely the VMTs are created at that point - by the browser. So where is Smart Pascals opportunity to define the VMT? I'm sure this is because I know not a lot about JavaScript and I'm missing some information on what can and can't be done... It must be that Smart Pascal is actually producing something at a lower level than I regard as human readable JavaScript - and the browser also understands this lower level form. Is there something equivalent to assembler in JavaScript???
  3. Hi Lennart, Wow - yes please! I can't believe I've only just come across Smart Pascal. I've thought for a long time that as a language Object Pascal deserves universality. You guys are proving that that's possible - bringing clarity to the web! There's a reason that Wirth derived languages are used in safety critical engineering - you guessed it - clarity (structured text in safety PLCs, Ada in military avionics systems). Because that's what engineers with big responsibilities need! So I for one believe you guys are going in the right direction.
  4. I am new to smart pascal (2 days experience so far) - but I really like what I've seen so far - and I like that I could use the same language on both client and server. I need to create an https server. I've seen the hello world http server that works with NodeJS and I've been looking for an https equivalent but found none so far. It looks like I could descend one from TNJCustomServer - which is going to be quite a learning curve for me. So first I would like to ask nicely - has anyone already done this?
  • Create New...