Pages: [1] 2 3
  Print  
Author Topic: Progress  (Read 7152 times)
Offline (Male) Josh @ Dreamland
Posted on: October 21, 2009, 07:38:22 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2955

View Profile Email
I have successfully implemented 90% of everything, and am working on the rest of the ten percent as I attempt to parse system headers.

Let me tell you, I'm surprised. Those coders managed to write headers that have attitude. These things are sentient, angry source codes, and they don't like new parsers. Honestly, the things are some sort of intelligent. They have to be.

Code: [Select]
Including file from features.h
Including file from sys/cdefs.h
Including file from sys/cdefs.h
Including file from features.h
Including file from sys/cdefs.h
Including file from features.h
Including file from sys/cdefs.h
Including file from features.h
Including file from sys/cdefs.h
Including file from features.h
Including file from sys/cdefs.h
Including file from features.h
...Repeats past max SMF character limit...
Including file from sys/cdefs.h
Including file from features.h
Including file from sys/cdefs.h
Including file from features.h
Including file from sys/cdefs.h
Including file from features.h
Including file from sys/cdefs.h
Including file from features.h
Parse time: 1340 milliseconds

Line 330, position 25: Failed to include sys/cdefs.h: File not found
Macros (44):
  _ATFILE_SOURCE: 1
  _BSD_SOURCE: 1
  _FEATURES_H: 1
  _ISOC99_SOURCE: 1
  _LARGEFILE64_SOURCE: 1
  _LARGEFILE_SOURCE: 1
  _POSIX_C_SOURCE: 200112L
  _POSIX_SOURCE: 1
  _SVID_SOURCE: 1
  _SYS_CDEFS_H: 1
  _XOPEN_SOURCE: 600
  _XOPEN_SOURCE_EXTENDED: 1
  __FAVOR_BSD: 1
  __GLIBC_HAVE_LONG_LONG: 1
  __GLIBC_MINOR__: 9
  __GLIBC_PREREQ(maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min): \
        ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
  __GLIBC__: 2
  __GNUC_PREREQ(maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min,maj,min): 0
  __GNU_LIBRARY__: 6
  __KERNEL_STRICT_NAMES: #endif
  __STDC_IEC_559_COMPLEX__: 1
  __STDC_IEC_559__: 1
  __STDC_ISO_10646__: 200009L
  __USE_ANSI: 1
  __USE_ATFILE: 1
  __USE_BSD: 1
  __USE_FILE_OFFSET64: 1
  __USE_FORTIFY_LEVEL: 0
  __USE_GNU: 1
  __USE_ISOC95: 1
  __USE_ISOC99: 1
  __USE_LARGEFILE: 1
  __USE_LARGEFILE64: 1
  __USE_MISC: 1
  __USE_POSIX: 1
  __USE_POSIX199309: 1
  __USE_POSIX199506: 1
  __USE_POSIX2: 1
  __USE_REENTRANT: 1
  __USE_SVID: 1
  __USE_UNIX98: 1
  __USE_XOPEN: 1
  __USE_XOPEN2K: 1
  __USE_XOPEN_EXTENDED: 1

Variables:auto:   Serves as typename
bool:   Serves as typename
char:   Serves as typename
const:   Serves as typename
double:   Serves as typename
float:   Serves as typename
int:   Serves as typename
long:   Serves as typename
register:   Serves as typename
short:   Serves as typename
signed:   Serves as typename
static:   Serves as typename
unsigned:   Serves as typename
volatile:   Serves as typename

The best I can make of that output is that somewhere along the line, I had too many files open.
...Fixed. Now it loops forever like... like it should, I suppose.

I know the error is because I forgot to share my macro function implementation with the expression evaluator, and will fix that next. I just thought I'd share the O___o moment and the news that the basics are al(most)l working.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) Micah
Reply #1 Posted on: October 22, 2009, 05:28:44 PM

Resident Troll
Joined: May 2008
Posts: 129

View Profile
Using a recursive descent parser or lex and yacc would have been incredibly faster and easier to write and more memory-efficient, not to mention you wouldn't have errors like that.
Logged
Offline (Male) Josh @ Dreamland
Reply #2 Posted on: October 22, 2009, 07:03:55 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2955

View Profile Email
For the fifteenth time, go for it. Show us all how fast and easy it is to write. Outdo me.

Quote
<JoshDreamland>   Out of curiosity, what parser generator was GCC made in?
<segher>   none
<segher>   both C and C++ use a hand-written parser
<segher>   dunno about fortran and ada
<segher>   (much) older versions of GCC used a bison parser
<segher>   the hand-written parser is much smaller and faster than the old bison parser; more importantly though, it allows for much better diagnostics on errors
...
<segher>   oh, bison is nice for small parsers
<segher>   then again, most jobs i need small parsers for i would do in perl or haskell :-)

Why don't you write it in Perl or Haskell, also?
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) Micah
Reply #3 Posted on: October 22, 2009, 07:15:58 PM

Resident Troll
Joined: May 2008
Posts: 129

View Profile
I'm actually writing a lexer and parser in Haskell at the moment. :P And the lexer was 17 lines, and very easily modifiable and simple.

And the problem with your citation of gcc's handwritten parser is that I'm sure they used a recursive descent parser (which is a lot like writing a grammar actually, only it's real code), while yours is just a mash.

I'll just drop this now, because I don't feel like writing a parser for ENIGMA, and yours will probably work just fine.
« Last Edit: October 22, 2009, 07:24:23 PM by miky » Logged
Offline (Male) Josh @ Dreamland
Reply #4 Posted on: October 22, 2009, 07:31:07 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2955

View Profile Email
So, you've dropped the yacc idea and any resulting simplicity and have moved on to wanting a recursive descent model. My original syntax checker resembled one, actually; It had a file full of inline'd functions that would each do simple error checking. Examples being must_follow_operator(), and expect_semicolon(). I hated it, and later scrapped the entire thing, mostly because it's nice to see all the code (or at least a lot of it) in one place.

Also, I later realized how much simpler it is if you do such checking only when necessary, especially for GML. Since a semicolon is almost never expected, it made no sense to skip one each time.
« Last Edit: October 22, 2009, 07:38:04 PM by Josh @ Dreamland » Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) RetroX
Reply #5 Posted on: October 22, 2009, 07:41:24 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
I made an expression parser ("2   +    2" returns 4, etc.) in ~500 lines.  At first, I added a clock() to see how fast it was.  Even if I execute twenty very long expressions, I still can't get the milliseconds counter to go above zero with the limitations of a long double and clock().
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Unknown gender) Micah
Reply #6 Posted on: October 22, 2009, 07:59:18 PM

Resident Troll
Joined: May 2008
Posts: 129

View Profile
So, you've dropped the yacc idea and any resulting simplicity and have moved on to wanting a recursive descent model.
Actually, I didn't drop the yacc idea. I was just saying that there are researched ways to write a handmade parser that work very well.

RetroX: I'm interested in seeing how you did that.
Logged
Offline (Male) Josh @ Dreamland
Reply #7 Posted on: October 22, 2009, 08:03:02 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2955

View Profile Email
Clock() isn't accurate enough on Linux.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Female) IsmAvatar
Reply #8 Posted on: October 22, 2009, 08:41:20 PM

LateralGM Developer
LGM Developer
Location: Pennsylvania/USA
Joined: Apr 2008
Posts: 886

View Profile Email
use time(0) rather than clock(). clock tends to only update once every few seconds on unix. I noticed this when I seeded my random number generator with it and noticed that it would repeatedly generate the same sequence for a while.
Logged
Offline (Unknown gender) Micah
Reply #9 Posted on: October 22, 2009, 09:36:51 PM

Resident Troll
Joined: May 2008
Posts: 129

View Profile
Speaking of seeding random numbers, on OSX Tiger (I don't know about this any other versions), you can move the mouse into the lower right corner to go into a screensaver. If there are multiple computers with synchronized clocks, you can move the mouse into the lower right corner at the same time on each of them, and if you are using the slideshow screensaver and the same set of images, it will show them in the same order forever. :D
Logged
Offline (Male) RetroX
Reply #10 Posted on: October 23, 2009, 04:20:02 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
Clock() isn't accurate enough on Linux.
Yes, it is.  If you have the right kernel settings.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Unknown gender) Micah
Reply #11 Posted on: October 23, 2009, 06:08:01 PM

Resident Troll
Joined: May 2008
Posts: 129

View Profile
Not everyone does, so do you really think it's a good idea to write production code that needs Clock() to be that accurate?

I don't know why you have to defend every single thing about Linux, especially when it's questionable whether they're criticisms or not.
Logged
Offline (Male) RetroX
Reply #12 Posted on: October 24, 2009, 11:09:12 AM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
Not everyone does, so do you really think it's a good idea to write production code that needs Clock() to be that accurate?

I don't know why you have to defend every single thing about Linux, especially when it's questionable whether they're criticisms or not.
The kernel and shell themselves will work properly by default with clock().  If it doesn't work in Ubuntu, it's Ubuntu.  I hate how people use Ubuntu for making complains about GNU/Linux in general.  It modifies everything.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Unknown gender) Game_boy
Reply #13 Posted on: October 24, 2009, 12:24:05 PM
Member
Joined: Apr 2008
Posts: 228

View Profile
Ubuntu is how most people will see Linux when they try it, and how most people will be running and reviewing Linux applications. It may not be the fault of the kernel programmers but they need to share some responsibility for fixing it in Ubuntu [if it needs to be fixed] by communicating with their kernel developers or issuing a patch to reverse/mitigate the change Ubuntu makes.

For example, the NT kernel by itself is lightweight, portable and designed well. But the vast majority of users only see it in Windows, and would assume it is slow, bloated and locked-in to x86. So it is irrelevant how good the kernel is or how it's meant to function.
Logged
Offline (Male) Josh @ Dreamland
Reply #14 Posted on: October 24, 2009, 12:27:14 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2955

View Profile Email
I'm currently on Ubuntu myself, as it's the only distro I can boot with my card, as stated. Can't wait 'til my Fedora-oriented clock()-based FPS regulator stops working.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Pages: [1] 2 3
  Print