-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
3,949 additions
and
2,319 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
Building on a Unix-like system | ||
------------------------------ | ||
|
||
Type 'make' or 'make test'. | ||
|
||
The latter builds all the examples and runs them, comparing their | ||
output with the expected output. | ||
|
||
Type 'make install' to install the binaries and manual page under | ||
/usr/local. (Type 'make uninstall' to remove them.) You may have to | ||
do this using 'sudo' or while logged in as root. | ||
|
||
Edit 'Makefile' to change the way things are built and/or the places | ||
where things are installed. | ||
|
||
|
||
Building on MacOS X | ||
------------------- | ||
|
||
Run the 'build-mac.sh' script from a terminal or by double-clicking on | ||
it in the Finder. | ||
|
||
You will need Xcode. The provided project is known to work with Xcode | ||
versions 3.2.6 and 4.3.2. | ||
|
||
Modify build-mac.sh and/or peg.xcodeproj to change the way things are | ||
built. | ||
|
||
|
||
Building on Windows | ||
------------------- | ||
|
||
Run the 'build-win.cmd' script. | ||
|
||
You will need Visual Studio 2010 Express. | ||
|
||
Modify build-win.cmd, leg.vcxproj, leg.vcxproj.filters, peg.gyp, | ||
peg.sln, peg.vcxproj and/or peg.vcxproj.filters to change the way | ||
things are built. | ||
|
||
Local implementations of getopt() and basename() are provided in the | ||
'win' directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
xcodebuild -project peg.xcodeproj -configuration Release | ||
|
||
cp build/Release/peg ./ | ||
cp build/Release/leg ./ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@echo off | ||
call "%VS100COMNTOOLS%vsvars32.bat" | ||
msbuild peg.sln /p:Configuration=Release | ||
|
||
xcopy /Y /D Release\*.exe .\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
%{ | ||
#include <stdio.h> | ||
%} | ||
|
||
Expr = a:NUMBER PLUS ~{ printf("fail at PLUS\n") } b:NUMBER { printf("got addition\n"); } | ||
| ( a:NUMBER MINUS b:NUMBER { printf("got subtraction\n"); } ) ~{ printf("fail at subtraction\n") } | ||
| a:NUMBER TIMES b:NUMBER { printf("got multiplication\n"); } | ||
| a:NUMBER DIVIDE b:NUMBER { printf("got division\n"); } | ||
|
||
NUMBER = < [0-9]+ > - { $$= atoi(yytext); } | ||
PLUS = '+' - | ||
MINUS = '-' - | ||
TIMES = '*' - | ||
DIVIDE = '/' - | ||
|
||
- = (SPACE | EOL)* | ||
SPACE = [ \t] | ||
EOL = '\n' | '\r\n' | '\r' | ';' | ||
|
||
%% | ||
|
||
int main() | ||
{ | ||
while (yyparse()); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
fail at PLUS | ||
fail at subtraction | ||
got multiplication | ||
fail at subtraction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
%{ | ||
#define YY_CTX_LOCAL 1 | ||
#define YY_CTX_MEMBERS \ | ||
int count; | ||
%} | ||
|
||
Char = ('\n' | '\r\n' | '\r') { yy->count++ } | ||
| . | ||
|
||
%% | ||
|
||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
int main() | ||
{ | ||
yycontext yy; | ||
memset(&yy, 0, sizeof(yy)); | ||
while (yyparse(&yy)) | ||
; | ||
printf("%d newlines\n", yy.count); | ||
yyrelease(&yy); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
24 newlines |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.